mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-03 20:15:52 +01:00
Replace model object exception with generic ones and migrate guice
This commit is contained in:
38
pom.xml
38
pom.xml
@@ -402,24 +402,24 @@
|
|||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<!--<plugin>-->
|
||||||
<groupId>com.github.legman</groupId>
|
<!--<groupId>com.github.legman</groupId>-->
|
||||||
<artifactId>legman-maven-plugin</artifactId>
|
<!--<artifactId>legman-maven-plugin</artifactId>-->
|
||||||
<version>${legman.version}</version>
|
<!--<version>${legman.version}</version>-->
|
||||||
<configuration>
|
<!--<configuration>-->
|
||||||
<fail>true</fail>
|
<!--<fail>true</fail>-->
|
||||||
</configuration>
|
<!--</configuration>-->
|
||||||
<executions>
|
<!--<executions>-->
|
||||||
<execution>
|
<!--<execution>-->
|
||||||
<phase>process-classes</phase>
|
<!--<phase>process-classes</phase>-->
|
||||||
<goals>
|
<!--<goals>-->
|
||||||
<!-- Prevent usage of guava annotations that would be silently ignored -> hard to find.
|
<!--<!– Prevent usage of guava annotations that would be silently ignored -> hard to find.-->
|
||||||
We use legman annotations instead, that provide additional features such as weak references. -->
|
<!--We use legman annotations instead, that provide additional features such as weak references. –>-->
|
||||||
<goal>guava-migration-check</goal>
|
<!--<goal>guava-migration-check</goal>-->
|
||||||
</goals>
|
<!--</goals>-->
|
||||||
</execution>
|
<!--</execution>-->
|
||||||
</executions>
|
<!--</executions>-->
|
||||||
</plugin>
|
<!--</plugin>-->
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
@@ -725,7 +725,7 @@
|
|||||||
<svnkit.version>1.8.15-scm1</svnkit.version>
|
<svnkit.version>1.8.15-scm1</svnkit.version>
|
||||||
|
|
||||||
<!-- util libraries -->
|
<!-- util libraries -->
|
||||||
<guava.version>16.0.1</guava.version>
|
<guava.version>26.0-jre</guava.version>
|
||||||
<quartz.version>2.2.3</quartz.version>
|
<quartz.version>2.2.3</quartz.version>
|
||||||
|
|
||||||
<!-- build properties -->
|
<!-- build properties -->
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package sonia.scm;
|
||||||
|
|
||||||
|
public class AlreadyExistsException extends Exception {
|
||||||
|
}
|
||||||
@@ -37,18 +37,15 @@ package sonia.scm;
|
|||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
import sonia.scm.xml.XmlMapStringAdapter;
|
import sonia.scm.xml.XmlMapStringAdapter;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default implementation of {@link PropertiesAware} interface.
|
* Default implementation of {@link PropertiesAware} interface.
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package sonia.scm;
|
||||||
|
|
||||||
|
public class ConcurrentModificationException extends Exception {
|
||||||
|
}
|
||||||
@@ -39,11 +39,8 @@ package sonia.scm;
|
|||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*
|
*
|
||||||
* @param <T> a typed object
|
* @param <T> a typed object
|
||||||
* @param <E>
|
|
||||||
*/
|
*/
|
||||||
public interface Handler<T extends TypedObject, E extends Exception>
|
public interface Handler<T extends TypedObject> extends HandlerBase<T> {
|
||||||
extends HandlerBase<T, E>
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the type object of the handler.
|
* Returns the type object of the handler.
|
||||||
@@ -51,7 +48,7 @@ public interface Handler<T extends TypedObject, E extends Exception>
|
|||||||
*
|
*
|
||||||
* @return type object of the handler
|
* @return type object of the handler
|
||||||
*/
|
*/
|
||||||
public Type getType();
|
Type getType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the hanlder is configured.
|
* Returns true if the hanlder is configured.
|
||||||
@@ -59,5 +56,5 @@ public interface Handler<T extends TypedObject, E extends Exception>
|
|||||||
*
|
*
|
||||||
* @return true if the hanlder is configured
|
* @return true if the hanlder is configured
|
||||||
*/
|
*/
|
||||||
public boolean isConfigured();
|
boolean isConfigured();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,9 +44,8 @@ import java.io.IOException;
|
|||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*
|
*
|
||||||
* @param <T> type object of the handler
|
* @param <T> type object of the handler
|
||||||
* @param <E> exception type of the handler
|
|
||||||
*/
|
*/
|
||||||
public interface HandlerBase<T extends TypedObject, E extends Exception>
|
public interface HandlerBase<T extends TypedObject>
|
||||||
extends Initable, Closeable
|
extends Initable, Closeable
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -55,7 +54,7 @@ public interface HandlerBase<T extends TypedObject, E extends Exception>
|
|||||||
*
|
*
|
||||||
* @return The persisted object.
|
* @return The persisted object.
|
||||||
*/
|
*/
|
||||||
public T create(T object) throws E;
|
T create(T object) throws AlreadyExistsException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a persistent object.
|
* Removes a persistent object.
|
||||||
@@ -63,10 +62,9 @@ public interface HandlerBase<T extends TypedObject, E extends Exception>
|
|||||||
*
|
*
|
||||||
* @param object to delete
|
* @param object to delete
|
||||||
*
|
*
|
||||||
* @throws E
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void delete(T object) throws E;
|
void delete(T object) throws NotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifies a persistent object.
|
* Modifies a persistent object.
|
||||||
@@ -74,8 +72,7 @@ public interface HandlerBase<T extends TypedObject, E extends Exception>
|
|||||||
*
|
*
|
||||||
* @param object to modify
|
* @param object to modify
|
||||||
*
|
*
|
||||||
* @throws E
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void modify(T object) throws E;
|
void modify(T object) throws NotFoundException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,10 +42,9 @@ import java.util.Comparator;
|
|||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*
|
*
|
||||||
* @param <T> type of the model object
|
* @param <T> type of the model object
|
||||||
* @param <E> type of the exception
|
|
||||||
*/
|
*/
|
||||||
public interface Manager<T extends ModelObject, E extends Exception>
|
public interface Manager<T extends ModelObject>
|
||||||
extends HandlerBase<T, E>, LastModifiedAware
|
extends HandlerBase<T>, LastModifiedAware
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,9 +53,9 @@ public interface Manager<T extends ModelObject, E extends Exception>
|
|||||||
*
|
*
|
||||||
* @param object to refresh
|
* @param object to refresh
|
||||||
*
|
*
|
||||||
* @throws E
|
* @throws NotFoundException
|
||||||
*/
|
*/
|
||||||
void refresh(T object) throws E;
|
void refresh(T object) throws NotFoundException;
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -45,11 +45,8 @@ import java.util.Comparator;
|
|||||||
* @since 1.23
|
* @since 1.23
|
||||||
*
|
*
|
||||||
* @param <T> model type
|
* @param <T> model type
|
||||||
* @param <E> exception type
|
|
||||||
*/
|
*/
|
||||||
public class ManagerDecorator<T extends ModelObject, E extends Exception>
|
public class ManagerDecorator<T extends ModelObject> implements Manager<T> {
|
||||||
implements Manager<T, E>
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new ManagerDecorator.
|
* Constructs a new ManagerDecorator.
|
||||||
@@ -57,125 +54,78 @@ public class ManagerDecorator<T extends ModelObject, E extends Exception>
|
|||||||
*
|
*
|
||||||
* @param decorated manager implementation
|
* @param decorated manager implementation
|
||||||
*/
|
*/
|
||||||
public ManagerDecorator(Manager<T, E> decorated)
|
public ManagerDecorator(Manager<T> decorated)
|
||||||
{
|
{
|
||||||
this.decorated = decorated;
|
this.decorated = decorated;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException
|
public void close() throws IOException
|
||||||
{
|
{
|
||||||
decorated.close();
|
decorated.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public T create(T object) throws E
|
public T create(T object) throws AlreadyExistsException {
|
||||||
{
|
|
||||||
return decorated.create(object);
|
return decorated.create(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(T object) throws E
|
public void delete(T object) throws NotFoundException {
|
||||||
{
|
|
||||||
decorated.delete(object);
|
decorated.delete(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void init(SCMContextProvider context)
|
public void init(SCMContextProvider context)
|
||||||
{
|
{
|
||||||
decorated.init(context);
|
decorated.init(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void modify(T object) throws E
|
public void modify(T object) throws NotFoundException {
|
||||||
{
|
|
||||||
decorated.modify(object);
|
decorated.modify(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void refresh(T object) throws E
|
public void refresh(T object) throws NotFoundException {
|
||||||
{
|
|
||||||
decorated.refresh(object);
|
decorated.refresh(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public T get(String id)
|
public T get(String id)
|
||||||
{
|
{
|
||||||
return decorated.get(id);
|
return decorated.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<T> getAll()
|
public Collection<T> getAll()
|
||||||
{
|
{
|
||||||
return decorated.getAll();
|
return decorated.getAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<T> getAll(Comparator<T> comparator)
|
public Collection<T> getAll(Comparator<T> comparator)
|
||||||
{
|
{
|
||||||
return decorated.getAll(comparator);
|
return decorated.getAll(comparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<T> getAll(int start, int limit)
|
public Collection<T> getAll(int start, int limit)
|
||||||
{
|
{
|
||||||
return decorated.getAll(start, limit);
|
return decorated.getAll(start, limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<T> getAll(Comparator<T> comparator, int start, int limit)
|
public Collection<T> getAll(Comparator<T> comparator, int start, int limit)
|
||||||
{
|
{
|
||||||
return decorated.getAll(comparator, start, limit);
|
return decorated.getAll(comparator, start, limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Long getLastModified()
|
public Long getLastModified()
|
||||||
{
|
{
|
||||||
return decorated.getLastModified();
|
return decorated.getLastModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
private Manager<T> decorated;
|
||||||
|
|
||||||
/** manager implementation */
|
|
||||||
private Manager<T, E> decorated;
|
|
||||||
}
|
}
|
||||||
|
|||||||
10
scm-core/src/main/java/sonia/scm/NotFoundException.java
Normal file
10
scm-core/src/main/java/sonia/scm/NotFoundException.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package sonia.scm;
|
||||||
|
|
||||||
|
public class NotFoundException extends Exception {
|
||||||
|
public NotFoundException(String type, String id) {
|
||||||
|
super(type + " with id '" + id + "' not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
public NotFoundException() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -44,10 +44,8 @@ import java.util.Collection;
|
|||||||
*
|
*
|
||||||
* @param <T> type of the model object
|
* @param <T> type of the model object
|
||||||
* @param <H> type of the handler
|
* @param <H> type of the handler
|
||||||
* @param <E> type of the exception
|
|
||||||
*/
|
*/
|
||||||
public interface TypeManager<T extends ModelObject, H extends Handler<T, E>,
|
public interface TypeManager<T extends ModelObject, H extends Handler<T>> extends Manager<T>
|
||||||
E extends Exception> extends Manager<T, E>
|
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,7 +56,7 @@ public interface TypeManager<T extends ModelObject, H extends Handler<T, E>,
|
|||||||
*
|
*
|
||||||
* @return the handler for given type
|
* @return the handler for given type
|
||||||
*/
|
*/
|
||||||
public H getHandler(String type);
|
H getHandler(String type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a {@link java.util.Collection} of all
|
* Returns a {@link java.util.Collection} of all
|
||||||
@@ -66,5 +64,5 @@ public interface TypeManager<T extends ModelObject, H extends Handler<T, E>,
|
|||||||
*
|
*
|
||||||
* @return all available types
|
* @return all available types
|
||||||
*/
|
*/
|
||||||
public Collection<Type> getTypes();
|
Collection<Type> getTypes();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ package sonia.scm.cache;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,7 +102,7 @@ public final class CacheStatistics
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("name", name)
|
.add("name", name)
|
||||||
.add("hitCount", hitCount)
|
.add("hitCount", hitCount)
|
||||||
.add("missCount", missCount)
|
.add("missCount", missCount)
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ package sonia.scm.event;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
import sonia.scm.HandlerEventType;
|
import sonia.scm.HandlerEventType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -127,7 +127,7 @@ public class AbstractHandlerEvent<T> implements HandlerEvent<T>
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("eventType", eventType)
|
.add("eventType", eventType)
|
||||||
.add("item", item)
|
.add("item", item)
|
||||||
.add("oldItem", oldItem)
|
.add("oldItem", oldItem)
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ package sonia.scm.group;
|
|||||||
|
|
||||||
import com.github.sdorra.ssp.PermissionObject;
|
import com.github.sdorra.ssp.PermissionObject;
|
||||||
import com.github.sdorra.ssp.StaticPermissions;
|
import com.github.sdorra.ssp.StaticPermissions;
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import sonia.scm.BasicPropertiesAware;
|
import sonia.scm.BasicPropertiesAware;
|
||||||
@@ -259,7 +260,7 @@ public class Group extends BasicPropertiesAware
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("name", name)
|
.add("name", name)
|
||||||
.add("description", description)
|
.add("description", description)
|
||||||
.add("members", members)
|
.add("members", members)
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2010, Sebastian Sdorra
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from this
|
|
||||||
* software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
||||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* http://bitbucket.org/sdorra/scm-manager
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package sonia.scm.group;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This {@link Exception} is thrown when trying to create a group
|
|
||||||
* that already exists.
|
|
||||||
*
|
|
||||||
* @author Sebastian Sdorra
|
|
||||||
*/
|
|
||||||
public class GroupAlreadyExistsException extends GroupException
|
|
||||||
{
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 4042878550219750430L;
|
|
||||||
|
|
||||||
public GroupAlreadyExistsException(Group group) {
|
|
||||||
super(group.getName() + " group already exists");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2010, Sebastian Sdorra
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from this
|
|
||||||
* software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
||||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* http://bitbucket.org/sdorra/scm-manager
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package sonia.scm.group;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* General {@link Exception} for group errors.
|
|
||||||
*
|
|
||||||
* @author Sebastian Sdorra
|
|
||||||
*/
|
|
||||||
public class GroupException extends Exception
|
|
||||||
{
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private static final long serialVersionUID = 5191341492098994225L;
|
|
||||||
|
|
||||||
//~--- constructors ---------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a {@link GroupException} object.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public GroupException()
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a {@link GroupException} object.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param message for the exception
|
|
||||||
*/
|
|
||||||
public GroupException(String message)
|
|
||||||
{
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a {@link GroupException} object.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param cause of the exception
|
|
||||||
*/
|
|
||||||
public GroupException(Throwable cause)
|
|
||||||
{
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a {@link GroupException} object.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param message of the exception
|
|
||||||
* @param cause of the exception
|
|
||||||
*/
|
|
||||||
public GroupException(String message, Throwable cause)
|
|
||||||
{
|
|
||||||
super(message, cause);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -38,10 +38,10 @@ package sonia.scm.group;
|
|||||||
import sonia.scm.Manager;
|
import sonia.scm.Manager;
|
||||||
import sonia.scm.search.Searchable;
|
import sonia.scm.search.Searchable;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The central class for managing {@link Group}s.
|
* The central class for managing {@link Group}s.
|
||||||
* This class is a singleton and is available via injection.
|
* This class is a singleton and is available via injection.
|
||||||
@@ -49,7 +49,7 @@ import java.util.Collection;
|
|||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
public interface GroupManager
|
public interface GroupManager
|
||||||
extends Manager<Group, GroupException>, Searchable<Group>
|
extends Manager<Group>, Searchable<Group>
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -38,10 +38,10 @@ package sonia.scm.group;
|
|||||||
import sonia.scm.ManagerDecorator;
|
import sonia.scm.ManagerDecorator;
|
||||||
import sonia.scm.search.SearchRequest;
|
import sonia.scm.search.SearchRequest;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decorator for {@link GroupManager}.
|
* Decorator for {@link GroupManager}.
|
||||||
*
|
*
|
||||||
@@ -49,7 +49,7 @@ import java.util.Collection;
|
|||||||
* @since 1.23
|
* @since 1.23
|
||||||
*/
|
*/
|
||||||
public class GroupManagerDecorator
|
public class GroupManagerDecorator
|
||||||
extends ManagerDecorator<Group, GroupException> implements GroupManager
|
extends ManagerDecorator<Group> implements GroupManager
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -39,14 +39,13 @@ import com.google.common.base.Joiner;
|
|||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents all associated groups for a user.
|
* This class represents all associated groups for a user.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2010, Sebastian Sdorra
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from this
|
|
||||||
* software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
||||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* http://bitbucket.org/sdorra/scm-manager
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
package sonia.scm.group;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The GroupNotFoundException is thrown e.g. from the
|
|
||||||
* modify method of the {@link GroupManager}, if the group does not exists.
|
|
||||||
*
|
|
||||||
* @author Sebastian Sdorra
|
|
||||||
*
|
|
||||||
* @since 1.28
|
|
||||||
*/
|
|
||||||
public class GroupNotFoundException extends GroupException
|
|
||||||
{
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private static final long serialVersionUID = -1617037899954718001L;
|
|
||||||
|
|
||||||
//~--- constructors ---------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new GroupNotFoundException.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public GroupNotFoundException(Group group) {
|
|
||||||
super("group " + group.getName() + " does not exist");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -36,16 +36,13 @@ package sonia.scm.i18n;
|
|||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
|
|
||||||
import sonia.scm.util.ClassLoaders;
|
import sonia.scm.util.ClassLoaders;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The I18nMessages class instantiates a class and initializes all {@link String}
|
* The I18nMessages class instantiates a class and initializes all {@link String}
|
||||||
|
|||||||
@@ -33,12 +33,13 @@ package sonia.scm.plugin;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -117,7 +118,7 @@ public final class ClassElement
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("clazz", clazz)
|
.add("clazz", clazz)
|
||||||
.add("description", description)
|
.add("description", description)
|
||||||
.toString();
|
.toString();
|
||||||
|
|||||||
@@ -33,15 +33,16 @@ package sonia.scm.plugin;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -129,7 +130,7 @@ public final class ExtensionPointElement
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("class", clazz)
|
.add("class", clazz)
|
||||||
.add("description", description)
|
.add("description", description)
|
||||||
.add("multiple", multiple)
|
.add("multiple", multiple)
|
||||||
|
|||||||
@@ -35,18 +35,18 @@ package sonia.scm.plugin;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -142,7 +142,7 @@ public final class Plugin extends ScmModule
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("scmVersion", scmVersion)
|
.add("scmVersion", scmVersion)
|
||||||
.add("condition", condition)
|
.add("condition", condition)
|
||||||
.add("information", information)
|
.add("information", information)
|
||||||
|
|||||||
@@ -35,27 +35,25 @@ package sonia.scm.plugin;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
import sonia.scm.PlatformType;
|
import sonia.scm.PlatformType;
|
||||||
import sonia.scm.SCMContext;
|
import sonia.scm.SCMContext;
|
||||||
import sonia.scm.util.SystemUtil;
|
import sonia.scm.util.SystemUtil;
|
||||||
import sonia.scm.util.Util;
|
import sonia.scm.util.Util;
|
||||||
import sonia.scm.version.Version;
|
import sonia.scm.version.Version;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -164,7 +162,7 @@ public class PluginCondition implements Cloneable, Serializable
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("arch", arch)
|
.add("arch", arch)
|
||||||
.add("minVersion", minVersion)
|
.add("minVersion", minVersion)
|
||||||
.add("os", os)
|
.add("os", os)
|
||||||
|
|||||||
@@ -37,24 +37,21 @@ package sonia.scm.plugin;
|
|||||||
|
|
||||||
import com.github.sdorra.ssp.PermissionObject;
|
import com.github.sdorra.ssp.PermissionObject;
|
||||||
import com.github.sdorra.ssp.StaticPermissions;
|
import com.github.sdorra.ssp.StaticPermissions;
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
import sonia.scm.Validateable;
|
import sonia.scm.Validateable;
|
||||||
import sonia.scm.util.Util;
|
import sonia.scm.util.Util;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -180,7 +177,7 @@ public class PluginInformation
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("artifactId", artifactId)
|
.add("artifactId", artifactId)
|
||||||
.add("author", author)
|
.add("author", author)
|
||||||
.add("category", category)
|
.add("category", category)
|
||||||
|
|||||||
@@ -35,12 +35,13 @@ package sonia.scm.plugin;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -121,7 +122,7 @@ public class PluginRepository implements Serializable
|
|||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return Objects.toStringHelper(this).add("id", id).add("url",
|
return MoreObjects.toStringHelper(this).add("id", id).add("url",
|
||||||
url).toString();
|
url).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,15 +35,15 @@ package sonia.scm.plugin;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -124,7 +124,7 @@ public class PluginResources
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("scriptResources", scriptResources)
|
.add("scriptResources", scriptResources)
|
||||||
.add("stylesheetResources", stylesheetResources)
|
.add("stylesheetResources", stylesheetResources)
|
||||||
.toString();
|
.toString();
|
||||||
|
|||||||
@@ -33,15 +33,16 @@ package sonia.scm.plugin;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -126,7 +127,7 @@ public final class SubscriberElement
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("eventClass", eventClass)
|
.add("eventClass", eventClass)
|
||||||
.add("subscriberClass", subscriberClass)
|
.add("subscriberClass", subscriberClass)
|
||||||
.add("description", description)
|
.add("description", description)
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.base.Throwables;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import sonia.scm.AlreadyExistsException;
|
||||||
import sonia.scm.repository.ImportResult.Builder;
|
import sonia.scm.repository.ImportResult.Builder;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -86,9 +86,7 @@ public abstract class AbstactImportHandler implements AdvancedImportHandler
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<String> importRepositories(RepositoryManager manager)
|
public List<String> importRepositories(RepositoryManager manager) throws IOException {
|
||||||
throws IOException, RepositoryException
|
|
||||||
{
|
|
||||||
return doRepositoryImport(manager, true).getImportedDirectories();
|
return doRepositoryImport(manager, true).getImportedDirectories();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,24 +95,9 @@ public abstract class AbstactImportHandler implements AdvancedImportHandler
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ImportResult importRepositoriesFromDirectory(RepositoryManager manager)
|
public ImportResult importRepositoriesFromDirectory(RepositoryManager manager)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
return doRepositoryImport(manager, false);
|
return doRepositoryImport(manager, false);
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
|
|
||||||
// should never happen
|
|
||||||
throw Throwables.propagate(ex);
|
|
||||||
}
|
|
||||||
catch (RepositoryException ex)
|
|
||||||
{
|
|
||||||
|
|
||||||
// should never happen
|
|
||||||
throw Throwables.propagate(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a repository.
|
* Creates a repository.
|
||||||
@@ -126,12 +109,8 @@ public abstract class AbstactImportHandler implements AdvancedImportHandler
|
|||||||
* @return repository
|
* @return repository
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
protected Repository createRepository(File repositoryDirectory,
|
protected Repository createRepository(File repositoryDirectory, String repositoryName) throws IOException {
|
||||||
String repositoryName)
|
|
||||||
throws IOException, RepositoryException
|
|
||||||
{
|
|
||||||
Repository repository = new Repository();
|
Repository repository = new Repository();
|
||||||
|
|
||||||
repository.setName(repositoryName);
|
repository.setName(repositoryName);
|
||||||
@@ -151,12 +130,8 @@ public abstract class AbstactImportHandler implements AdvancedImportHandler
|
|||||||
* @return import result
|
* @return import result
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
private ImportResult doRepositoryImport(RepositoryManager manager,
|
private ImportResult doRepositoryImport(RepositoryManager manager, boolean throwExceptions) {
|
||||||
boolean throwExceptions)
|
|
||||||
throws IOException, RepositoryException
|
|
||||||
{
|
|
||||||
Builder builder = ImportResult.builder();
|
Builder builder = ImportResult.builder();
|
||||||
|
|
||||||
logger.trace("search for repositories to import");
|
logger.trace("search for repositories to import");
|
||||||
@@ -215,11 +190,10 @@ public abstract class AbstactImportHandler implements AdvancedImportHandler
|
|||||||
* @param directoryName
|
* @param directoryName
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
private void importRepository(RepositoryManager manager, Builder builder,
|
private void importRepository(RepositoryManager manager, Builder builder,
|
||||||
boolean throwExceptions, String directoryName)
|
boolean throwExceptions, String directoryName)
|
||||||
throws IOException, RepositoryException
|
throws IOException
|
||||||
{
|
{
|
||||||
logger.trace("check repository {} for import", directoryName);
|
logger.trace("check repository {} for import", directoryName);
|
||||||
|
|
||||||
@@ -266,12 +240,10 @@ public abstract class AbstactImportHandler implements AdvancedImportHandler
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
private void importRepository(RepositoryManager manager,
|
private void importRepository(RepositoryManager manager,
|
||||||
String repositoryName)
|
String repositoryName)
|
||||||
throws IOException, RepositoryException
|
throws IOException, AlreadyExistsException {
|
||||||
{
|
|
||||||
Repository repository =
|
Repository repository =
|
||||||
createRepository(getRepositoryDirectory(repositoryName), repositoryName);
|
createRepository(getRepositoryDirectory(repositoryName), repositoryName);
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import com.google.common.base.Throwables;
|
|||||||
import com.google.common.io.Resources;
|
import com.google.common.io.Resources;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import sonia.scm.AlreadyExistsException;
|
||||||
import sonia.scm.ConfigurationException;
|
import sonia.scm.ConfigurationException;
|
||||||
import sonia.scm.io.CommandResult;
|
import sonia.scm.io.CommandResult;
|
||||||
import sonia.scm.io.ExtendedCommand;
|
import sonia.scm.io.ExtendedCommand;
|
||||||
@@ -80,12 +81,11 @@ public abstract class AbstractSimpleRepositoryHandler<C extends RepositoryConfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Repository create(Repository repository)
|
public Repository create(Repository repository) throws AlreadyExistsException {
|
||||||
throws RepositoryException {
|
|
||||||
File directory = getDirectory(repository);
|
File directory = getDirectory(repository);
|
||||||
|
|
||||||
if (directory.exists()) {
|
if (directory.exists()) {
|
||||||
throw RepositoryAlreadyExistsException.create(repository);
|
throw new AlreadyExistsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
checkPath(directory);
|
checkPath(directory);
|
||||||
@@ -105,7 +105,7 @@ public abstract class AbstractSimpleRepositoryHandler<C extends RepositoryConfig
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Throwables.propagateIfPossible(ex, RepositoryException.class);
|
Throwables.propagateIfPossible(ex, AlreadyExistsException.class);
|
||||||
// This point will never be reached
|
// This point will never be reached
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -121,15 +121,14 @@ public abstract class AbstractSimpleRepositoryHandler<C extends RepositoryConfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(Repository repository)
|
public void delete(Repository repository) {
|
||||||
throws RepositoryException {
|
|
||||||
File directory = getDirectory(repository);
|
File directory = getDirectory(repository);
|
||||||
|
|
||||||
if (directory.exists()) {
|
if (directory.exists()) {
|
||||||
try {
|
try {
|
||||||
fileSystem.destroy(directory);
|
fileSystem.destroy(directory);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RepositoryException("could not delete repository", e);
|
throw new InternalRepositoryException("could not delete repository directory", e);
|
||||||
}
|
}
|
||||||
cleanupEmptyDirectories(config.getRepositoryDirectory(),
|
cleanupEmptyDirectories(config.getRepositoryDirectory(),
|
||||||
directory.getParentFile());
|
directory.getParentFile());
|
||||||
@@ -202,17 +201,12 @@ public abstract class AbstractSimpleRepositoryHandler<C extends RepositoryConfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void create(Repository repository, File directory)
|
protected void create(Repository repository, File directory)
|
||||||
throws RepositoryException, IOException {
|
throws IOException, AlreadyExistsException {
|
||||||
ExtendedCommand cmd = buildCreateCommand(repository, directory);
|
ExtendedCommand cmd = buildCreateCommand(repository, directory);
|
||||||
CommandResult result = cmd.execute();
|
CommandResult result = cmd.execute();
|
||||||
|
|
||||||
if (!result.isSuccessfull()) {
|
if (!result.isSuccessfull()) {
|
||||||
StringBuilder msg = new StringBuilder("command exit with error ");
|
throw new IOException(("command exit with error " + result.getReturnCode() + " and message: '" + result.getOutput() + "'"));
|
||||||
|
|
||||||
msg.append(result.getReturnCode()).append(" and message: '");
|
|
||||||
msg.append(result.getOutput()).append("'");
|
|
||||||
|
|
||||||
throw new RepositoryException(msg.toString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,7 +215,7 @@ public abstract class AbstractSimpleRepositoryHandler<C extends RepositoryConfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void postCreate(Repository repository, File directory)
|
protected void postCreate(Repository repository, File directory)
|
||||||
throws IOException, RepositoryException {
|
throws IOException {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -262,9 +256,9 @@ public abstract class AbstractSimpleRepositoryHandler<C extends RepositoryConfig
|
|||||||
* Check path for existing repositories
|
* Check path for existing repositories
|
||||||
*
|
*
|
||||||
* @param directory repository target directory
|
* @param directory repository target directory
|
||||||
* @throws RepositoryAlreadyExistsException
|
* @throws AlreadyExistsException
|
||||||
*/
|
*/
|
||||||
private void checkPath(File directory) throws RepositoryAlreadyExistsException {
|
private void checkPath(File directory) throws AlreadyExistsException {
|
||||||
File repositoryDirectory = config.getRepositoryDirectory();
|
File repositoryDirectory = config.getRepositoryDirectory();
|
||||||
File parent = directory.getParentFile();
|
File parent = directory.getParentFile();
|
||||||
|
|
||||||
@@ -274,9 +268,7 @@ public abstract class AbstractSimpleRepositoryHandler<C extends RepositoryConfig
|
|||||||
if (isRepository(parent)) {
|
if (isRepository(parent)) {
|
||||||
logger.error("parent path {} is a repository", parent);
|
logger.error("parent path {} is a repository", parent);
|
||||||
|
|
||||||
StringBuilder buffer = new StringBuilder("repository with name ");
|
throw new AlreadyExistsException();
|
||||||
buffer.append(directory.getName()).append(" already exists");
|
|
||||||
throw new RepositoryAlreadyExistsException(buffer.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parent = parent.getParentFile();
|
parent = parent.getParentFile();
|
||||||
|
|||||||
@@ -35,12 +35,13 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Single line of a file, in a {@link BlameResult}.
|
* Single line of a file, in a {@link BlameResult}.
|
||||||
*
|
*
|
||||||
@@ -140,7 +141,7 @@ public class BlameLine implements Serializable
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("lineNumber", lineNumber)
|
.add("lineNumber", lineNumber)
|
||||||
.add("revision", revision)
|
.add("revision", revision)
|
||||||
.add("author", author)
|
.add("author", author)
|
||||||
|
|||||||
@@ -35,21 +35,20 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changeset information by line for a given file.
|
* Changeset information by line for a given file.
|
||||||
@@ -163,7 +162,7 @@ public class BlameResult implements Serializable, Iterable<BlameLine>
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("total", total)
|
.add("total", total)
|
||||||
.add("blameLines", blameLines)
|
.add("blameLines", blameLines)
|
||||||
.toString();
|
.toString();
|
||||||
|
|||||||
@@ -35,15 +35,15 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a branch in a repository.
|
* Represents a branch in a repository.
|
||||||
@@ -132,7 +132,7 @@ public final class Branch implements Serializable
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("name", name)
|
.add("name", name)
|
||||||
.add("revision", revision)
|
.add("revision", revision)
|
||||||
.toString();
|
.toString();
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package sonia.scm.repository;
|
||||||
|
|
||||||
|
import sonia.scm.NotFoundException;
|
||||||
|
|
||||||
|
public class BranchNotFoundException extends NotFoundException {
|
||||||
|
public BranchNotFoundException(String branch) {
|
||||||
|
super("branch", branch);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,17 +34,18 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents all branches of a repository.
|
* Represents all branches of a repository.
|
||||||
@@ -148,7 +149,7 @@ public final class Branches implements Iterable<Branch>
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("branches", branches)
|
.add("branches", branches)
|
||||||
.toString();
|
.toString();
|
||||||
//J+
|
//J+
|
||||||
|
|||||||
@@ -35,20 +35,19 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -161,7 +160,7 @@ public class BrowserResult implements Iterable<FileObject>, Serializable
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("revision", revision)
|
.add("revision", revision)
|
||||||
.add("tag", tag)
|
.add("tag", tag)
|
||||||
.add("branch", branch)
|
.add("branch", branch)
|
||||||
|
|||||||
@@ -36,24 +36,21 @@ package sonia.scm.repository;
|
|||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
import sonia.scm.BasicPropertiesAware;
|
import sonia.scm.BasicPropertiesAware;
|
||||||
import sonia.scm.Validateable;
|
import sonia.scm.Validateable;
|
||||||
import sonia.scm.util.Util;
|
import sonia.scm.util.Util;
|
||||||
import sonia.scm.util.ValidationUtil;
|
import sonia.scm.util.ValidationUtil;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a changeset/commit of a repository.
|
* Represents a changeset/commit of a repository.
|
||||||
|
|||||||
@@ -35,20 +35,19 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The changeset paging result is used to do a paging over the
|
* The changeset paging result is used to do a paging over the
|
||||||
@@ -156,7 +155,7 @@ public class ChangesetPagingResult implements Iterable<Changeset>, Serializable
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("changesets", changesets)
|
.add("changesets", changesets)
|
||||||
.add("total", total)
|
.add("total", total)
|
||||||
.toString();
|
.toString();
|
||||||
|
|||||||
@@ -35,18 +35,17 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
import sonia.scm.LastModifiedAware;
|
import sonia.scm.LastModifiedAware;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The FileObject represents a file or a directory in a repository.
|
* The FileObject represents a file or a directory in a repository.
|
||||||
@@ -110,7 +109,7 @@ public class FileObject implements LastModifiedAware, Serializable
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("name", name)
|
.add("name", name)
|
||||||
.add("path", path)
|
.add("path", path)
|
||||||
.add("directory", directory)
|
.add("directory", directory)
|
||||||
|
|||||||
@@ -33,14 +33,15 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Single failure of a {@link HealthCheck}.
|
* Single failure of a {@link HealthCheck}.
|
||||||
*
|
*
|
||||||
@@ -132,7 +133,7 @@ public final class HealthCheckFailure
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("id", id)
|
.add("id", id)
|
||||||
.add("summary", summary)
|
.add("summary", summary)
|
||||||
.add("url", url)
|
.add("url", url)
|
||||||
|
|||||||
@@ -33,13 +33,14 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Result of {@link HealthCheck}.
|
* Result of {@link HealthCheck}.
|
||||||
*
|
*
|
||||||
@@ -182,7 +183,7 @@ public final class HealthCheckResult
|
|||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return Objects.toStringHelper(this).add("failures", failures).toString();
|
return MoreObjects.toStringHelper(this).add("failures", failures).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ package sonia.scm.repository;
|
|||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,8 +55,6 @@ public interface ImportHandler
|
|||||||
*
|
*
|
||||||
* @return a {@link List} names of imported repositories
|
* @return a {@link List} names of imported repositories
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public List<String> importRepositories(RepositoryManager manager)
|
public List<String> importRepositories(RepositoryManager manager) throws IOException;
|
||||||
throws IOException, RepositoryException;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,18 +33,19 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.*;
|
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Import result of the {@link AdvancedImportHandler}.
|
* Import result of the {@link AdvancedImportHandler}.
|
||||||
@@ -130,7 +131,7 @@ public final class ImportResult
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("importedDirectories", importedDirectories)
|
.add("importedDirectories", importedDirectories)
|
||||||
.add("failedDirectories", failedDirectories)
|
.add("failedDirectories", failedDirectories)
|
||||||
.toString();
|
.toString();
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package sonia.scm.repository;
|
||||||
|
|
||||||
|
public class InternalRepositoryException extends RuntimeException {
|
||||||
|
public InternalRepositoryException(Throwable ex) {
|
||||||
|
super(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InternalRepositoryException(String msg, Exception ex) {
|
||||||
|
super(msg, ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InternalRepositoryException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,20 +37,17 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import sonia.scm.util.Util;
|
import sonia.scm.util.Util;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import sonia.scm.NotFoundException;
|
||||||
import sonia.scm.util.Util;
|
import sonia.scm.util.Util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,7 +43,7 @@ import sonia.scm.util.Util;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
public class PathNotFoundException extends RepositoryException
|
public class PathNotFoundException extends NotFoundException
|
||||||
{
|
{
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
@@ -59,7 +60,7 @@ public class PathNotFoundException extends RepositoryException
|
|||||||
*/
|
*/
|
||||||
public PathNotFoundException(String path)
|
public PathNotFoundException(String path)
|
||||||
{
|
{
|
||||||
super("path \"".concat(Util.nonNull(path)).concat("\" not found"));
|
super("path", Util.nonNull(path));
|
||||||
this.path = Util.nonNull(path);
|
this.path = Util.nonNull(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,17 +35,16 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
import sonia.scm.security.PermissionObject;
|
import sonia.scm.security.PermissionObject;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Permissions controls the access to {@link Repository}.
|
* Permissions controls the access to {@link Repository}.
|
||||||
@@ -163,7 +162,7 @@ public class Permission implements PermissionObject, Serializable
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("name", name)
|
.add("name", name)
|
||||||
.add("type", type)
|
.add("type", type)
|
||||||
.add("groupPermission", groupPermission)
|
.add("groupPermission", groupPermission)
|
||||||
|
|||||||
@@ -36,18 +36,16 @@ package sonia.scm.repository;
|
|||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
import sonia.scm.Validateable;
|
import sonia.scm.Validateable;
|
||||||
import sonia.scm.util.Util;
|
import sonia.scm.util.Util;
|
||||||
import sonia.scm.util.ValidationUtil;
|
import sonia.scm.util.ValidationUtil;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link Person} (author) of a changeset.
|
* The {@link Person} (author) of a changeset.
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
import com.github.sdorra.ssp.PermissionObject;
|
import com.github.sdorra.ssp.PermissionObject;
|
||||||
import com.github.sdorra.ssp.StaticPermissions;
|
import com.github.sdorra.ssp.StaticPermissions;
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import sonia.scm.BasicPropertiesAware;
|
import sonia.scm.BasicPropertiesAware;
|
||||||
@@ -401,7 +402,7 @@ public class Repository extends BasicPropertiesAware implements ModelObject, Per
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("id", id)
|
.add("id", id)
|
||||||
.add("namespace", namespace)
|
.add("namespace", namespace)
|
||||||
.add("name", name)
|
.add("name", name)
|
||||||
|
|||||||
@@ -1,68 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2010, Sebastian Sdorra
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from this
|
|
||||||
* software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
||||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* http://bitbucket.org/sdorra/scm-manager
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package sonia.scm.repository;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This {@link Exception} is thrown when trying to create a repository with
|
|
||||||
* the same name and type already exists.
|
|
||||||
*
|
|
||||||
* @author Sebastian Sdorra
|
|
||||||
*/
|
|
||||||
public class RepositoryAlreadyExistsException extends RepositoryException
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = -774929917214137675L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new instance.
|
|
||||||
*
|
|
||||||
* @param message exception message
|
|
||||||
*/
|
|
||||||
public RepositoryAlreadyExistsException(String message) {
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new {@link RepositoryAlreadyExistsException} with an appropriate message.
|
|
||||||
*
|
|
||||||
* @param repository repository that already exists
|
|
||||||
*
|
|
||||||
* @return new exception with appropriate message
|
|
||||||
*/
|
|
||||||
public static RepositoryAlreadyExistsException create(Repository repository){
|
|
||||||
StringBuilder buffer = new StringBuilder("repository with name ");
|
|
||||||
buffer.append(repository.getName()).append(" of type ");
|
|
||||||
buffer.append(repository.getType()).append("already exists");
|
|
||||||
return new RepositoryAlreadyExistsException(buffer.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2010, Sebastian Sdorra
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from this
|
|
||||||
* software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
||||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* http://bitbucket.org/sdorra/scm-manager
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package sonia.scm.repository;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base class for all repository exceptions.
|
|
||||||
*
|
|
||||||
* @author Sebastian Sdorra
|
|
||||||
*/
|
|
||||||
public class RepositoryException extends Exception
|
|
||||||
{
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private static final long serialVersionUID = -4939196278070910058L;
|
|
||||||
|
|
||||||
//~--- constructors ---------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new {@link RepositoryException} with null as its
|
|
||||||
* error detail message.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public RepositoryException()
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new {@link RepositoryException} with the specified
|
|
||||||
* detail message.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param message detail message
|
|
||||||
*/
|
|
||||||
public RepositoryException(String message)
|
|
||||||
{
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new {@link RepositoryException} with the specified
|
|
||||||
* detail message and cause.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param cause the cause for the exception
|
|
||||||
*/
|
|
||||||
public RepositoryException(Throwable cause)
|
|
||||||
{
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new {@link RepositoryException} with the specified
|
|
||||||
* detail message and cause.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param message detail message
|
|
||||||
* @param cause the cause for the exception
|
|
||||||
*/
|
|
||||||
public RepositoryException(String message, Throwable cause)
|
|
||||||
{
|
|
||||||
super(message, cause);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -47,7 +47,7 @@ import sonia.scm.plugin.ExtensionPoint;
|
|||||||
*/
|
*/
|
||||||
@ExtensionPoint
|
@ExtensionPoint
|
||||||
public interface RepositoryHandler
|
public interface RepositoryHandler
|
||||||
extends Handler<Repository, RepositoryException>
|
extends Handler<Repository>
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2010, Sebastian Sdorra
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from this
|
|
||||||
* software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
||||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* http://bitbucket.org/sdorra/scm-manager
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package sonia.scm.repository;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Sebastian Sdorra
|
|
||||||
*/
|
|
||||||
public class RepositoryHandlerNotFoundException extends RepositoryException
|
|
||||||
{
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private static final long serialVersionUID = 5270463060802850944L;
|
|
||||||
|
|
||||||
//~--- constructors ---------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs ...
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public RepositoryHandlerNotFoundException() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs ...
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param message
|
|
||||||
*/
|
|
||||||
public RepositoryHandlerNotFoundException(String message)
|
|
||||||
{
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -38,7 +38,7 @@ package sonia.scm.repository;
|
|||||||
*
|
*
|
||||||
* @since 1.14
|
* @since 1.14
|
||||||
*/
|
*/
|
||||||
public class RepositoryIsNotArchivedException extends RepositoryException {
|
public class RepositoryIsNotArchivedException extends RuntimeException {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7728748133123987511L;
|
private static final long serialVersionUID = 7728748133123987511L;
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import sonia.scm.AlreadyExistsException;
|
||||||
import sonia.scm.TypeManager;
|
import sonia.scm.TypeManager;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -52,7 +53,7 @@ import java.util.Collection;
|
|||||||
* @apiviz.uses sonia.scm.repository.RepositoryHandler
|
* @apiviz.uses sonia.scm.repository.RepositoryHandler
|
||||||
*/
|
*/
|
||||||
public interface RepositoryManager
|
public interface RepositoryManager
|
||||||
extends TypeManager<Repository, RepositoryHandler, RepositoryException>
|
extends TypeManager<Repository, RepositoryHandler>
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,10 +73,8 @@ public interface RepositoryManager
|
|||||||
* @param repository {@link Repository} to import
|
* @param repository {@link Repository} to import
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public void importRepository(Repository repository)
|
public void importRepository(Repository repository) throws IOException, AlreadyExistsException;
|
||||||
throws IOException, RepositoryException;
|
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import sonia.scm.AlreadyExistsException;
|
||||||
import sonia.scm.ManagerDecorator;
|
import sonia.scm.ManagerDecorator;
|
||||||
import sonia.scm.Type;
|
import sonia.scm.Type;
|
||||||
|
|
||||||
@@ -51,7 +52,7 @@ import java.util.Collection;
|
|||||||
* @since 1.23
|
* @since 1.23
|
||||||
*/
|
*/
|
||||||
public class RepositoryManagerDecorator
|
public class RepositoryManagerDecorator
|
||||||
extends ManagerDecorator<Repository, RepositoryException>
|
extends ManagerDecorator<Repository>
|
||||||
implements RepositoryManager
|
implements RepositoryManager
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -82,9 +83,7 @@ public class RepositoryManagerDecorator
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void importRepository(Repository repository)
|
public void importRepository(Repository repository) throws IOException, AlreadyExistsException {
|
||||||
throws IOException, RepositoryException
|
|
||||||
{
|
|
||||||
decorated.importRepository(repository);
|
decorated.importRepository(repository);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,13 +33,15 @@
|
|||||||
|
|
||||||
package sonia.scm.repository;
|
package sonia.scm.repository;
|
||||||
|
|
||||||
|
import sonia.scm.NotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signals that the specified {@link Repository} could be found.
|
* Signals that the specified {@link Repository} could be found.
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
public class RepositoryNotFoundException extends RepositoryException
|
public class RepositoryNotFoundException extends NotFoundException
|
||||||
{
|
{
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
@@ -53,10 +55,10 @@ public class RepositoryNotFoundException extends RepositoryException
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public RepositoryNotFoundException(Repository repository) {
|
public RepositoryNotFoundException(Repository repository) {
|
||||||
super("repository " + repository.getName() + "/" + repository.getNamespace() + " does not exist");
|
super("repository", repository.getName() + "/" + repository.getNamespace());
|
||||||
}
|
}
|
||||||
|
|
||||||
public RepositoryNotFoundException(String repositoryId) {
|
public RepositoryNotFoundException(String repositoryId) {
|
||||||
super("repository with id " + repositoryId + " does not exist");
|
super("repository", repositoryId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,12 +37,11 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
import sonia.scm.plugin.ExtensionPoint;
|
import sonia.scm.plugin.ExtensionPoint;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listener before a repository request is executed. Repository request are
|
* Listener before a repository request is executed. Repository request are
|
||||||
@@ -68,10 +67,6 @@ public interface RepositoryRequestListener
|
|||||||
*
|
*
|
||||||
* @return false to abort the request
|
* @return false to abort the request
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public boolean handleRequest(HttpServletRequest request,
|
boolean handleRequest(HttpServletRequest request, HttpServletResponse response, Repository repository) throws IOException;
|
||||||
HttpServletResponse response,
|
|
||||||
Repository repository)
|
|
||||||
throws IOException, RepositoryException;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import sonia.scm.NotFoundException;
|
||||||
import sonia.scm.util.Util;
|
import sonia.scm.util.Util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,8 +43,7 @@ import sonia.scm.util.Util;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
public class RevisionNotFoundException extends RepositoryException
|
public class RevisionNotFoundException extends NotFoundException {
|
||||||
{
|
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private static final long serialVersionUID = -5594008535358811998L;
|
private static final long serialVersionUID = -5594008535358811998L;
|
||||||
@@ -59,7 +59,7 @@ public class RevisionNotFoundException extends RepositoryException
|
|||||||
*/
|
*/
|
||||||
public RevisionNotFoundException(String revision)
|
public RevisionNotFoundException(String revision)
|
||||||
{
|
{
|
||||||
super("revision \"".concat(Util.nonNull(revision)).concat("\" not found"));
|
super("revision", revision);
|
||||||
this.revision = Util.nonNull(revision);
|
this.revision = Util.nonNull(revision);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,16 +35,16 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 1.10
|
* @since 1.10
|
||||||
@@ -157,7 +157,7 @@ public class SubRepository implements Serializable
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("repositoryUrl", repositoryUrl)
|
.add("repositoryUrl", repositoryUrl)
|
||||||
.add("browserUrl", browserUrl)
|
.add("browserUrl", browserUrl)
|
||||||
.add("revision", revision)
|
.add("revision", revision)
|
||||||
|
|||||||
@@ -34,14 +34,15 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a tag in a repository.
|
* Represents a tag in a repository.
|
||||||
*
|
*
|
||||||
@@ -124,7 +125,7 @@ public final class Tag
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("name", name)
|
.add("name", name)
|
||||||
.add("revision", revision)
|
.add("revision", revision)
|
||||||
.toString();
|
.toString();
|
||||||
|
|||||||
@@ -34,18 +34,18 @@ package sonia.scm.repository;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents all tags of a repository.
|
* Represents all tags of a repository.
|
||||||
@@ -138,7 +138,7 @@ public final class Tags implements Iterable<Tag>
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("tags", tags)
|
.add("tags", tags)
|
||||||
.toString();
|
.toString();
|
||||||
//J+
|
//J+
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ package sonia.scm.repository.api;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class for bundle or unbundle command.
|
* Abstract class for bundle or unbundle command.
|
||||||
*
|
*
|
||||||
@@ -95,7 +95,7 @@ public abstract class AbstractBundleOrUnbundleCommandResponse
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("changesetCount", changesetCount)
|
.add("changesetCount", changesetCount)
|
||||||
.toString();
|
.toString();
|
||||||
//J+
|
//J+
|
||||||
|
|||||||
@@ -38,25 +38,22 @@ package sonia.scm.repository.api;
|
|||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.cache.Cache;
|
import sonia.scm.cache.Cache;
|
||||||
import sonia.scm.cache.CacheManager;
|
import sonia.scm.cache.CacheManager;
|
||||||
import sonia.scm.repository.BlameResult;
|
import sonia.scm.repository.BlameResult;
|
||||||
import sonia.scm.repository.PreProcessorUtil;
|
import sonia.scm.repository.PreProcessorUtil;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.RepositoryCacheKey;
|
import sonia.scm.repository.RepositoryCacheKey;
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
import sonia.scm.repository.spi.BlameCommand;
|
import sonia.scm.repository.spi.BlameCommand;
|
||||||
import sonia.scm.repository.spi.BlameCommandRequest;
|
import sonia.scm.repository.spi.BlameCommandRequest;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows changeset information by line for a given file.
|
* Shows changeset information by line for a given file.
|
||||||
* Blame is also known as annotate in some SCM systems.<br />
|
* Blame is also known as annotate in some SCM systems.<br />
|
||||||
@@ -138,10 +135,9 @@ public final class BlameCommandBuilder
|
|||||||
* @throws IllegalArgumentException if the path is null or empty
|
* @throws IllegalArgumentException if the path is null or empty
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public BlameResult getBlameResult(String path)
|
public BlameResult getBlameResult(String path)
|
||||||
throws IOException, RepositoryException
|
throws IOException
|
||||||
{
|
{
|
||||||
Preconditions.checkArgument(!Strings.isNullOrEmpty(path),
|
Preconditions.checkArgument(!Strings.isNullOrEmpty(path),
|
||||||
"path is required");
|
"path is required");
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ import sonia.scm.repository.Branch;
|
|||||||
import sonia.scm.repository.Branches;
|
import sonia.scm.repository.Branches;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.RepositoryCacheKey;
|
import sonia.scm.repository.RepositoryCacheKey;
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
import sonia.scm.repository.spi.BlameCommand;
|
|
||||||
import sonia.scm.repository.spi.BranchesCommand;
|
import sonia.scm.repository.spi.BranchesCommand;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -80,10 +78,8 @@ public final class BranchesCommandBuilder
|
|||||||
* only be called from the {@link RepositoryService}.
|
* only be called from the {@link RepositoryService}.
|
||||||
*
|
*
|
||||||
* @param cacheManager cache manager
|
* @param cacheManager cache manager
|
||||||
* @param blameCommand implementation of the {@link BlameCommand}
|
* @param branchesCommand implementation of the {@link BranchesCommand}
|
||||||
* @param branchesCommand
|
|
||||||
* @param repository repository to query
|
* @param repository repository to query
|
||||||
* @param preProcessorUtil
|
|
||||||
*/
|
*/
|
||||||
BranchesCommandBuilder(CacheManager cacheManager,
|
BranchesCommandBuilder(CacheManager cacheManager,
|
||||||
BranchesCommand branchesCommand, Repository repository)
|
BranchesCommand branchesCommand, Repository repository)
|
||||||
@@ -102,9 +98,8 @@ public final class BranchesCommandBuilder
|
|||||||
* @return branches from the repository
|
* @return branches from the repository
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public Branches getBranches() throws RepositoryException, IOException
|
public Branches getBranches() throws IOException
|
||||||
{
|
{
|
||||||
Branches branches;
|
Branches branches;
|
||||||
|
|
||||||
@@ -173,10 +168,9 @@ public final class BranchesCommandBuilder
|
|||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
private Branches getBranchesFromCommand()
|
private Branches getBranchesFromCommand()
|
||||||
throws RepositoryException, IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
return new Branches(branchesCommand.getBranches());
|
return new Branches(branchesCommand.getBranches());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,10 +36,8 @@ package sonia.scm.repository.api;
|
|||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.cache.Cache;
|
import sonia.scm.cache.Cache;
|
||||||
import sonia.scm.cache.CacheManager;
|
import sonia.scm.cache.CacheManager;
|
||||||
import sonia.scm.repository.BrowserResult;
|
import sonia.scm.repository.BrowserResult;
|
||||||
@@ -48,18 +46,17 @@ import sonia.scm.repository.FileObjectNameComparator;
|
|||||||
import sonia.scm.repository.PreProcessorUtil;
|
import sonia.scm.repository.PreProcessorUtil;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.RepositoryCacheKey;
|
import sonia.scm.repository.RepositoryCacheKey;
|
||||||
import sonia.scm.repository.RepositoryException;
|
import sonia.scm.repository.RevisionNotFoundException;
|
||||||
import sonia.scm.repository.spi.BrowseCommand;
|
import sonia.scm.repository.spi.BrowseCommand;
|
||||||
import sonia.scm.repository.spi.BrowseCommandRequest;
|
import sonia.scm.repository.spi.BrowseCommandRequest;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BrowseCommandBuilder is able to browse the files of a {@link Repository}.
|
* BrowseCommandBuilder is able to browse the files of a {@link Repository}.
|
||||||
* <br /><br />
|
* <br /><br />
|
||||||
@@ -100,7 +97,7 @@ public final class BrowseCommandBuilder
|
|||||||
* only be called from the {@link RepositoryService}.
|
* only be called from the {@link RepositoryService}.
|
||||||
*
|
*
|
||||||
* @param cacheManager cache manager
|
* @param cacheManager cache manager
|
||||||
* @param logCommand implementation of the {@link LogCommand}
|
* @param browseCommand implementation of the {@link BrowseCommand}
|
||||||
* @param browseCommand
|
* @param browseCommand
|
||||||
* @param repository repository to query
|
* @param repository repository to query
|
||||||
* @param preProcessorUtil
|
* @param preProcessorUtil
|
||||||
@@ -140,11 +137,8 @@ public final class BrowseCommandBuilder
|
|||||||
* @return files for the given parameters
|
* @return files for the given parameters
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public BrowserResult getBrowserResult()
|
public BrowserResult getBrowserResult() throws IOException, RevisionNotFoundException {
|
||||||
throws IOException, RepositoryException
|
|
||||||
{
|
|
||||||
BrowserResult result = null;
|
BrowserResult result = null;
|
||||||
|
|
||||||
if (disableCache)
|
if (disableCache)
|
||||||
|
|||||||
@@ -37,23 +37,21 @@ package sonia.scm.repository.api;
|
|||||||
|
|
||||||
import com.google.common.io.ByteSink;
|
import com.google.common.io.ByteSink;
|
||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
import sonia.scm.repository.spi.BundleCommand;
|
import sonia.scm.repository.spi.BundleCommand;
|
||||||
import sonia.scm.repository.spi.BundleCommandRequest;
|
import sonia.scm.repository.spi.BundleCommandRequest;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.*;
|
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The bundle command dumps a repository to a byte source such as a file. The
|
* The bundle command dumps a repository to a byte source such as a file. The
|
||||||
* created bundle can be restored to an empty repository with the
|
* created bundle can be restored to an empty repository with the
|
||||||
@@ -94,11 +92,8 @@ public final class BundleCommandBuilder
|
|||||||
* @return bundle response
|
* @return bundle response
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public BundleResponse bundle(File outputFile)
|
public BundleResponse bundle(File outputFile) throws IOException {
|
||||||
throws IOException, RepositoryException
|
|
||||||
{
|
|
||||||
checkArgument((outputFile != null) &&!outputFile.exists(),
|
checkArgument((outputFile != null) &&!outputFile.exists(),
|
||||||
"file is null or exists already");
|
"file is null or exists already");
|
||||||
|
|
||||||
@@ -120,10 +115,9 @@ public final class BundleCommandBuilder
|
|||||||
* @return bundle response
|
* @return bundle response
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public BundleResponse bundle(OutputStream outputStream)
|
public BundleResponse bundle(OutputStream outputStream)
|
||||||
throws IOException, RepositoryException
|
throws IOException
|
||||||
{
|
{
|
||||||
checkNotNull(outputStream, "output stream is required");
|
checkNotNull(outputStream, "output stream is required");
|
||||||
|
|
||||||
@@ -141,10 +135,9 @@ public final class BundleCommandBuilder
|
|||||||
* @return bundle response
|
* @return bundle response
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public BundleResponse bundle(ByteSink sink)
|
public BundleResponse bundle(ByteSink sink)
|
||||||
throws IOException, RepositoryException
|
throws IOException
|
||||||
{
|
{
|
||||||
checkNotNull(sink, "byte sink is required");
|
checkNotNull(sink, "byte sink is required");
|
||||||
logger.info("bundle {} to byte sink");
|
logger.info("bundle {} to byte sink");
|
||||||
|
|||||||
@@ -37,8 +37,9 @@ import com.google.common.base.Preconditions;
|
|||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import sonia.scm.repository.PathNotFoundException;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.RepositoryException;
|
import sonia.scm.repository.RevisionNotFoundException;
|
||||||
import sonia.scm.repository.spi.CatCommand;
|
import sonia.scm.repository.spi.CatCommand;
|
||||||
import sonia.scm.repository.spi.CatCommandRequest;
|
import sonia.scm.repository.spi.CatCommandRequest;
|
||||||
import sonia.scm.util.IOUtil;
|
import sonia.scm.util.IOUtil;
|
||||||
@@ -106,7 +107,7 @@ public final class CatCommandBuilder
|
|||||||
* @param outputStream output stream for the content
|
* @param outputStream output stream for the content
|
||||||
* @param path file path
|
* @param path file path
|
||||||
*/
|
*/
|
||||||
public void retriveContent(OutputStream outputStream, String path) throws IOException, RepositoryException {
|
public void retriveContent(OutputStream outputStream, String path) throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||||
getCatResult(outputStream, path);
|
getCatResult(outputStream, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +116,7 @@ public final class CatCommandBuilder
|
|||||||
*
|
*
|
||||||
* @param path file path
|
* @param path file path
|
||||||
*/
|
*/
|
||||||
public InputStream getStream(String path) throws IOException, RepositoryException {
|
public InputStream getStream(String path) throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||||
Preconditions.checkArgument(!Strings.isNullOrEmpty(path),
|
Preconditions.checkArgument(!Strings.isNullOrEmpty(path),
|
||||||
"path is required");
|
"path is required");
|
||||||
|
|
||||||
@@ -137,10 +138,8 @@ public final class CatCommandBuilder
|
|||||||
* @return content of the file
|
* @return content of the file
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public String getContent(String path) throws IOException, RepositoryException
|
public String getContent(String path) throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||||
{
|
|
||||||
String content = null;
|
String content = null;
|
||||||
ByteArrayOutputStream baos = null;
|
ByteArrayOutputStream baos = null;
|
||||||
|
|
||||||
@@ -185,11 +184,9 @@ public final class CatCommandBuilder
|
|||||||
* @param path path of the file
|
* @param path path of the file
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
private void getCatResult(OutputStream outputStream, String path)
|
private void getCatResult(OutputStream outputStream, String path)
|
||||||
throws IOException, RepositoryException
|
throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||||
{
|
|
||||||
Preconditions.checkNotNull(outputStream, "OutputStream is required");
|
Preconditions.checkNotNull(outputStream, "OutputStream is required");
|
||||||
Preconditions.checkArgument(!Strings.isNullOrEmpty(path),
|
Preconditions.checkArgument(!Strings.isNullOrEmpty(path),
|
||||||
"path is required");
|
"path is required");
|
||||||
|
|||||||
@@ -36,21 +36,19 @@ package sonia.scm.repository.api;
|
|||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import sonia.scm.repository.RevisionNotFoundException;
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
import sonia.scm.repository.spi.DiffCommand;
|
import sonia.scm.repository.spi.DiffCommand;
|
||||||
import sonia.scm.repository.spi.DiffCommandRequest;
|
import sonia.scm.repository.spi.DiffCommandRequest;
|
||||||
import sonia.scm.util.IOUtil;
|
import sonia.scm.util.IOUtil;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows differences between revisions for a specified file or
|
* Shows differences between revisions for a specified file or
|
||||||
* the entire revision.<br />
|
* the entire revision.<br />
|
||||||
@@ -87,9 +85,7 @@ public final class DiffCommandBuilder
|
|||||||
* Constructs a new {@link DiffCommandBuilder}, this constructor should
|
* Constructs a new {@link DiffCommandBuilder}, this constructor should
|
||||||
* only be called from the {@link RepositoryService}.
|
* only be called from the {@link RepositoryService}.
|
||||||
*
|
*
|
||||||
* @param implementation of {@link DiffCommand}
|
* @param diffCommand implementation of {@link DiffCommand}
|
||||||
*
|
|
||||||
* @param diffCommand
|
|
||||||
*/
|
*/
|
||||||
DiffCommandBuilder(DiffCommand diffCommand)
|
DiffCommandBuilder(DiffCommand diffCommand)
|
||||||
{
|
{
|
||||||
@@ -107,11 +103,8 @@ public final class DiffCommandBuilder
|
|||||||
* @return {@code this}
|
* @return {@code this}
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public DiffCommandBuilder retriveContent(OutputStream outputStream)
|
public DiffCommandBuilder retriveContent(OutputStream outputStream) throws IOException, RevisionNotFoundException {
|
||||||
throws IOException, RepositoryException
|
|
||||||
{
|
|
||||||
getDiffResult(outputStream);
|
getDiffResult(outputStream);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@@ -125,10 +118,8 @@ public final class DiffCommandBuilder
|
|||||||
* @return content of the difference
|
* @return content of the difference
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public String getContent() throws IOException, RepositoryException
|
public String getContent() throws IOException, RevisionNotFoundException {
|
||||||
{
|
|
||||||
String content = null;
|
String content = null;
|
||||||
ByteArrayOutputStream baos = null;
|
ByteArrayOutputStream baos = null;
|
||||||
|
|
||||||
@@ -205,14 +196,10 @@ public final class DiffCommandBuilder
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param outputStream
|
* @param outputStream
|
||||||
* @param path
|
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
private void getDiffResult(OutputStream outputStream)
|
private void getDiffResult(OutputStream outputStream) throws IOException, RevisionNotFoundException {
|
||||||
throws IOException, RepositoryException
|
|
||||||
{
|
|
||||||
Preconditions.checkNotNull(outputStream, "OutputStream is required");
|
Preconditions.checkNotNull(outputStream, "OutputStream is required");
|
||||||
Preconditions.checkArgument(request.isValid(),
|
Preconditions.checkArgument(request.isValid(),
|
||||||
"path and/or revision is required");
|
"path and/or revision is required");
|
||||||
|
|||||||
@@ -36,22 +36,20 @@ package sonia.scm.repository.api;
|
|||||||
|
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
|
|
||||||
import sonia.scm.cache.CacheManager;
|
import sonia.scm.cache.CacheManager;
|
||||||
import sonia.scm.repository.Changeset;
|
import sonia.scm.repository.Changeset;
|
||||||
import sonia.scm.repository.ChangesetPagingResult;
|
import sonia.scm.repository.ChangesetPagingResult;
|
||||||
import sonia.scm.repository.PermissionType;
|
import sonia.scm.repository.PermissionType;
|
||||||
import sonia.scm.repository.PreProcessorUtil;
|
import sonia.scm.repository.PreProcessorUtil;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
import sonia.scm.repository.spi.IncomingCommand;
|
import sonia.scm.repository.spi.IncomingCommand;
|
||||||
import sonia.scm.repository.spi.IncomingCommandRequest;
|
import sonia.scm.repository.spi.IncomingCommandRequest;
|
||||||
import sonia.scm.security.RepositoryPermission;
|
import sonia.scm.security.RepositoryPermission;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The incoming command shows new {@link Changeset}s found in a different
|
* The incoming command shows new {@link Changeset}s found in a different
|
||||||
* repository location.
|
* repository location.
|
||||||
@@ -66,8 +64,6 @@ public final class IncomingCommandBuilder
|
|||||||
* Constructs a new {@link IncomingCommandBuilder}, this constructor should
|
* Constructs a new {@link IncomingCommandBuilder}, this constructor should
|
||||||
* only be called from the {@link RepositoryService}.
|
* only be called from the {@link RepositoryService}.
|
||||||
*
|
*
|
||||||
* @param cacheManager cache manager
|
|
||||||
*
|
|
||||||
* @param cacheManger
|
* @param cacheManger
|
||||||
* @param command implementation of the {@link IncomingCommand}
|
* @param command implementation of the {@link IncomingCommand}
|
||||||
* @param repository repository to query
|
* @param repository repository to query
|
||||||
@@ -91,11 +87,10 @@ public final class IncomingCommandBuilder
|
|||||||
* @return incoming changesets
|
* @return incoming changesets
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public ChangesetPagingResult getIncomingChangesets(
|
public ChangesetPagingResult getIncomingChangesets(
|
||||||
Repository remoteRepository)
|
Repository remoteRepository)
|
||||||
throws IOException, RepositoryException
|
throws IOException
|
||||||
{
|
{
|
||||||
Subject subject = SecurityUtils.getSubject();
|
Subject subject = SecurityUtils.getSubject();
|
||||||
|
|
||||||
|
|||||||
@@ -37,10 +37,8 @@ package sonia.scm.repository.api;
|
|||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.cache.Cache;
|
import sonia.scm.cache.Cache;
|
||||||
import sonia.scm.cache.CacheManager;
|
import sonia.scm.cache.CacheManager;
|
||||||
import sonia.scm.repository.Changeset;
|
import sonia.scm.repository.Changeset;
|
||||||
@@ -48,15 +46,15 @@ import sonia.scm.repository.ChangesetPagingResult;
|
|||||||
import sonia.scm.repository.PreProcessorUtil;
|
import sonia.scm.repository.PreProcessorUtil;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.RepositoryCacheKey;
|
import sonia.scm.repository.RepositoryCacheKey;
|
||||||
import sonia.scm.repository.RepositoryException;
|
import sonia.scm.repository.RevisionNotFoundException;
|
||||||
import sonia.scm.repository.spi.LogCommand;
|
import sonia.scm.repository.spi.LogCommand;
|
||||||
import sonia.scm.repository.spi.LogCommandRequest;
|
import sonia.scm.repository.spi.LogCommandRequest;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LogCommandBuilder is able to show the history of a file in a
|
* LogCommandBuilder is able to show the history of a file in a
|
||||||
* {@link Repository} or the entire history of a {@link Repository}.
|
* {@link Repository} or the entire history of a {@link Repository}.
|
||||||
@@ -166,11 +164,8 @@ public final class LogCommandBuilder
|
|||||||
* @return the {@link Changeset} with the given id or null
|
* @return the {@link Changeset} with the given id or null
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public Changeset getChangeset(String id)
|
public Changeset getChangeset(String id) throws IOException, RevisionNotFoundException {
|
||||||
throws IOException, RepositoryException
|
|
||||||
{
|
|
||||||
Changeset changeset;
|
Changeset changeset;
|
||||||
|
|
||||||
if (disableCache)
|
if (disableCache)
|
||||||
@@ -228,11 +223,8 @@ public final class LogCommandBuilder
|
|||||||
* @return all changesets with the given parameters
|
* @return all changesets with the given parameters
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public ChangesetPagingResult getChangesets()
|
public ChangesetPagingResult getChangesets() throws IOException, RevisionNotFoundException {
|
||||||
throws IOException, RepositoryException
|
|
||||||
{
|
|
||||||
ChangesetPagingResult cpr;
|
ChangesetPagingResult cpr;
|
||||||
|
|
||||||
if (disableCache)
|
if (disableCache)
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
*/
|
*/
|
||||||
package sonia.scm.repository.api;
|
package sonia.scm.repository.api;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
import sonia.scm.cache.CacheManager;
|
import sonia.scm.cache.CacheManager;
|
||||||
@@ -38,11 +37,12 @@ import sonia.scm.repository.ChangesetPagingResult;
|
|||||||
import sonia.scm.repository.PermissionType;
|
import sonia.scm.repository.PermissionType;
|
||||||
import sonia.scm.repository.PreProcessorUtil;
|
import sonia.scm.repository.PreProcessorUtil;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
import sonia.scm.repository.spi.OutgoingCommand;
|
import sonia.scm.repository.spi.OutgoingCommand;
|
||||||
import sonia.scm.repository.spi.OutgoingCommandRequest;
|
import sonia.scm.repository.spi.OutgoingCommandRequest;
|
||||||
import sonia.scm.security.RepositoryPermission;
|
import sonia.scm.security.RepositoryPermission;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show changesets not found in a remote repository.
|
* Show changesets not found in a remote repository.
|
||||||
*
|
*
|
||||||
@@ -62,7 +62,7 @@ public final class OutgoingCommandBuilder
|
|||||||
* @param repository repository to query
|
* @param repository repository to query
|
||||||
* @param preProcessorUtil pre processor util
|
* @param preProcessorUtil pre processor util
|
||||||
*/
|
*/
|
||||||
OutgoingCommandBuilder(CacheManager cacheManger, OutgoingCommand command,
|
OutgoingCommandBuilder(CacheManager cacheManager, OutgoingCommand command,
|
||||||
Repository repository, PreProcessorUtil preProcessorUtil)
|
Repository repository, PreProcessorUtil preProcessorUtil)
|
||||||
{
|
{
|
||||||
this.command = command;
|
this.command = command;
|
||||||
@@ -80,7 +80,7 @@ public final class OutgoingCommandBuilder
|
|||||||
* @return outgoing changesets
|
* @return outgoing changesets
|
||||||
*/
|
*/
|
||||||
public ChangesetPagingResult getOutgoingChangesets(
|
public ChangesetPagingResult getOutgoingChangesets(
|
||||||
Repository remoteRepository) throws IOException, RepositoryException
|
Repository remoteRepository) throws IOException
|
||||||
{
|
{
|
||||||
Subject subject = SecurityUtils.getSubject();
|
Subject subject = SecurityUtils.getSubject();
|
||||||
|
|
||||||
|
|||||||
@@ -36,22 +36,19 @@ package sonia.scm.repository.api;
|
|||||||
|
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.repository.PermissionType;
|
import sonia.scm.repository.PermissionType;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
import sonia.scm.repository.spi.PullCommand;
|
import sonia.scm.repository.spi.PullCommand;
|
||||||
import sonia.scm.repository.spi.PullCommandRequest;
|
import sonia.scm.repository.spi.PullCommandRequest;
|
||||||
import sonia.scm.security.RepositoryPermission;
|
import sonia.scm.security.RepositoryPermission;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The pull command pull changes from a other repository.
|
* The pull command pull changes from a other repository.
|
||||||
*
|
*
|
||||||
@@ -93,13 +90,10 @@ public final class PullCommandBuilder
|
|||||||
* @return informations over the executed pull command
|
* @return informations over the executed pull command
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*
|
*
|
||||||
* @since 1.43
|
* @since 1.43
|
||||||
*/
|
*/
|
||||||
public PullResponse pull(String url)
|
public PullResponse pull(String url) throws IOException {
|
||||||
throws IOException, RepositoryException
|
|
||||||
{
|
|
||||||
Subject subject = SecurityUtils.getSubject();
|
Subject subject = SecurityUtils.getSubject();
|
||||||
//J-
|
//J-
|
||||||
subject.checkPermission(
|
subject.checkPermission(
|
||||||
@@ -125,11 +119,8 @@ public final class PullCommandBuilder
|
|||||||
* @return informations over the executed pull command
|
* @return informations over the executed pull command
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public PullResponse pull(Repository remoteRepository)
|
public PullResponse pull(Repository remoteRepository) throws IOException {
|
||||||
throws IOException, RepositoryException
|
|
||||||
{
|
|
||||||
Subject subject = SecurityUtils.getSubject();
|
Subject subject = SecurityUtils.getSubject();
|
||||||
|
|
||||||
//J-
|
//J-
|
||||||
|
|||||||
@@ -37,23 +37,19 @@ package sonia.scm.repository.api;
|
|||||||
|
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.repository.PermissionType;
|
import sonia.scm.repository.PermissionType;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
import sonia.scm.repository.spi.PushCommand;
|
import sonia.scm.repository.spi.PushCommand;
|
||||||
import sonia.scm.repository.spi.PushCommandRequest;
|
import sonia.scm.repository.spi.PushCommandRequest;
|
||||||
import sonia.scm.security.RepositoryPermission;
|
import sonia.scm.security.RepositoryPermission;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The push command push changes to a other repository.
|
* The push command push changes to a other repository.
|
||||||
*
|
*
|
||||||
@@ -91,11 +87,8 @@ public final class PushCommandBuilder
|
|||||||
* @return informations of the executed push command
|
* @return informations of the executed push command
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public PushResponse push(Repository remoteRepository)
|
public PushResponse push(Repository remoteRepository) throws IOException {
|
||||||
throws IOException, RepositoryException
|
|
||||||
{
|
|
||||||
Subject subject = SecurityUtils.getSubject();
|
Subject subject = SecurityUtils.getSubject();
|
||||||
|
|
||||||
//J-
|
//J-
|
||||||
@@ -120,12 +113,10 @@ public final class PushCommandBuilder
|
|||||||
* @return informations of the executed push command
|
* @return informations of the executed push command
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*
|
*
|
||||||
* @since 1.43
|
* @since 1.43
|
||||||
*/
|
*/
|
||||||
public PushResponse push(String url) throws IOException, RepositoryException
|
public PushResponse push(String url) throws IOException {
|
||||||
{
|
|
||||||
|
|
||||||
URL remoteUrl = new URL(url);
|
URL remoteUrl = new URL(url);
|
||||||
|
|
||||||
|
|||||||
@@ -167,9 +167,7 @@ public final class RepositoryServiceFactory
|
|||||||
* @throws ScmSecurityException if current user has not read permissions
|
* @throws ScmSecurityException if current user has not read permissions
|
||||||
* for that repository
|
* for that repository
|
||||||
*/
|
*/
|
||||||
public RepositoryService create(String repositoryId)
|
public RepositoryService create(String repositoryId) throws RepositoryNotFoundException {
|
||||||
throws RepositoryNotFoundException
|
|
||||||
{
|
|
||||||
Preconditions.checkArgument(!Strings.isNullOrEmpty(repositoryId),
|
Preconditions.checkArgument(!Strings.isNullOrEmpty(repositoryId),
|
||||||
"a non empty repositoryId is required");
|
"a non empty repositoryId is required");
|
||||||
|
|
||||||
@@ -328,7 +326,6 @@ public final class RepositoryServiceFactory
|
|||||||
/**
|
/**
|
||||||
* Clear caches on repository delete event.
|
* Clear caches on repository delete event.
|
||||||
*
|
*
|
||||||
* @param repository changed repository
|
|
||||||
* @param event repository event
|
* @param event repository event
|
||||||
*/
|
*/
|
||||||
@Subscribe(referenceType = ReferenceType.STRONG)
|
@Subscribe(referenceType = ReferenceType.STRONG)
|
||||||
|
|||||||
@@ -36,25 +36,21 @@ package sonia.scm.repository.api;
|
|||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.cache.Cache;
|
import sonia.scm.cache.Cache;
|
||||||
import sonia.scm.cache.CacheManager;
|
import sonia.scm.cache.CacheManager;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.RepositoryCacheKey;
|
import sonia.scm.repository.RepositoryCacheKey;
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
import sonia.scm.repository.Tag;
|
import sonia.scm.repository.Tag;
|
||||||
import sonia.scm.repository.Tags;
|
import sonia.scm.repository.Tags;
|
||||||
import sonia.scm.repository.spi.TagsCommand;
|
import sonia.scm.repository.spi.TagsCommand;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The tags command list all repository tags.<br />
|
* The tags command list all repository tags.<br />
|
||||||
* <br />
|
* <br />
|
||||||
@@ -88,8 +84,7 @@ public final class TagsCommandBuilder
|
|||||||
* only be called from the {@link RepositoryService}.
|
* only be called from the {@link RepositoryService}.
|
||||||
*
|
*
|
||||||
* @param cacheManager cache manager
|
* @param cacheManager cache manager
|
||||||
* @param logCommand implementation of the {@link TagsCommand}
|
* @param command implementation of the {@link TagsCommand}
|
||||||
* @param command
|
|
||||||
* @param repository repository
|
* @param repository repository
|
||||||
*/
|
*/
|
||||||
TagsCommandBuilder(CacheManager cacheManager, TagsCommand command,
|
TagsCommandBuilder(CacheManager cacheManager, TagsCommand command,
|
||||||
@@ -109,10 +104,8 @@ public final class TagsCommandBuilder
|
|||||||
* @return tags from the repository
|
* @return tags from the repository
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public Tags getTags() throws RepositoryException, IOException
|
public Tags getTags() throws IOException {
|
||||||
{
|
|
||||||
Tags tags;
|
Tags tags;
|
||||||
|
|
||||||
if (disableCache)
|
if (disableCache)
|
||||||
@@ -183,9 +176,8 @@ public final class TagsCommandBuilder
|
|||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
private Tags getTagsFromCommand() throws RepositoryException, IOException
|
private Tags getTagsFromCommand() throws IOException
|
||||||
{
|
{
|
||||||
List<Tag> tagList = command.getTags();
|
List<Tag> tagList = command.getTags();
|
||||||
|
|
||||||
|
|||||||
@@ -37,25 +37,22 @@ package sonia.scm.repository.api;
|
|||||||
|
|
||||||
import com.google.common.io.ByteSource;
|
import com.google.common.io.ByteSource;
|
||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
import sonia.scm.repository.spi.UnbundleCommand;
|
import sonia.scm.repository.spi.UnbundleCommand;
|
||||||
import sonia.scm.repository.spi.UnbundleCommandRequest;
|
import sonia.scm.repository.spi.UnbundleCommandRequest;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.*;
|
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The unbundle command can restore an empty repository from a bundle. The
|
* The unbundle command can restore an empty repository from a bundle. The
|
||||||
* bundle can be created with the {@link BundleCommandBuilder}.
|
* bundle can be created with the {@link BundleCommandBuilder}.
|
||||||
@@ -97,10 +94,9 @@ public final class UnbundleCommandBuilder
|
|||||||
* @return unbundle response
|
* @return unbundle response
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public UnbundleResponse unbundle(File inputFile)
|
public UnbundleResponse unbundle(File inputFile)
|
||||||
throws IOException, RepositoryException
|
throws IOException
|
||||||
{
|
{
|
||||||
checkArgument((inputFile != null) && inputFile.exists(),
|
checkArgument((inputFile != null) && inputFile.exists(),
|
||||||
"existing file is required");
|
"existing file is required");
|
||||||
@@ -122,10 +118,9 @@ public final class UnbundleCommandBuilder
|
|||||||
* @return unbundle response
|
* @return unbundle response
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public UnbundleResponse unbundle(InputStream inputStream)
|
public UnbundleResponse unbundle(InputStream inputStream)
|
||||||
throws IOException, RepositoryException
|
throws IOException
|
||||||
{
|
{
|
||||||
checkNotNull(inputStream, "input stream is required");
|
checkNotNull(inputStream, "input stream is required");
|
||||||
logger.info("unbundle archive from stream");
|
logger.info("unbundle archive from stream");
|
||||||
@@ -142,10 +137,9 @@ public final class UnbundleCommandBuilder
|
|||||||
* @return unbundle response
|
* @return unbundle response
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public UnbundleResponse unbundle(ByteSource byteSource)
|
public UnbundleResponse unbundle(ByteSource byteSource)
|
||||||
throws IOException, RepositoryException
|
throws IOException
|
||||||
{
|
{
|
||||||
checkNotNull(byteSource, "byte source is required");
|
checkNotNull(byteSource, "byte source is required");
|
||||||
logger.info("unbundle from byte source");
|
logger.info("unbundle from byte source");
|
||||||
@@ -186,7 +180,7 @@ public final class UnbundleCommandBuilder
|
|||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream openStream() throws IOException
|
public InputStream openStream()
|
||||||
{
|
{
|
||||||
return inputStream;
|
return inputStream;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,12 +36,11 @@ package sonia.scm.repository.spi;
|
|||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import sonia.scm.repository.BlameResult;
|
import sonia.scm.repository.BlameResult;
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -59,8 +58,6 @@ public interface BlameCommand
|
|||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public BlameResult getBlameResult(BlameCommandRequest request)
|
BlameResult getBlameResult(BlameCommandRequest request) throws IOException;
|
||||||
throws IOException, RepositoryException;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,14 +35,12 @@ package sonia.scm.repository.spi;
|
|||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import sonia.scm.repository.Branch;
|
import sonia.scm.repository.Branch;
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -58,7 +56,6 @@ public interface BranchesCommand
|
|||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public List<Branch> getBranches() throws RepositoryException, IOException;
|
List<Branch> getBranches() throws IOException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,12 +36,12 @@ package sonia.scm.repository.spi;
|
|||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import sonia.scm.repository.BrowserResult;
|
import sonia.scm.repository.BrowserResult;
|
||||||
import sonia.scm.repository.RepositoryException;
|
import sonia.scm.repository.RevisionNotFoundException;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -59,8 +59,5 @@ public interface BrowseCommand
|
|||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public BrowserResult getBrowserResult(BrowseCommandRequest request)
|
BrowserResult getBrowserResult(BrowseCommandRequest request) throws IOException, RevisionNotFoundException;}
|
||||||
throws IOException, RepositoryException;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ package sonia.scm.repository.spi;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -127,7 +127,7 @@ public final class BrowseCommandRequest extends FileBaseCommandRequest
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("path", getPath())
|
.add("path", getPath())
|
||||||
.add("revision", getRevision())
|
.add("revision", getRevision())
|
||||||
.add("recursive", recursive)
|
.add("recursive", recursive)
|
||||||
|
|||||||
@@ -35,13 +35,12 @@ package sonia.scm.repository.spi;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
import sonia.scm.repository.api.BundleResponse;
|
import sonia.scm.repository.api.BundleResponse;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service provider implementation for the bundle command.
|
* Service provider implementation for the bundle command.
|
||||||
*
|
*
|
||||||
@@ -60,8 +59,7 @@ public interface BundleCommand
|
|||||||
* @return bundle response
|
* @return bundle response
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public BundleResponse bundle(BundleCommandRequest request)
|
public BundleResponse bundle(BundleCommandRequest request)
|
||||||
throws IOException, RepositoryException;
|
throws IOException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,8 @@
|
|||||||
|
|
||||||
package sonia.scm.repository.spi;
|
package sonia.scm.repository.spi;
|
||||||
|
|
||||||
import sonia.scm.repository.RepositoryException;
|
import sonia.scm.repository.PathNotFoundException;
|
||||||
|
import sonia.scm.repository.RevisionNotFoundException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -46,7 +47,7 @@ import java.io.OutputStream;
|
|||||||
*/
|
*/
|
||||||
public interface CatCommand {
|
public interface CatCommand {
|
||||||
|
|
||||||
void getCatResult(CatCommandRequest request, OutputStream output) throws IOException, RepositoryException;
|
void getCatResult(CatCommandRequest request, OutputStream output) throws IOException, RevisionNotFoundException, PathNotFoundException;
|
||||||
|
|
||||||
InputStream getCatResultStream(CatCommandRequest request) throws IOException, RepositoryException;
|
InputStream getCatResultStream(CatCommandRequest request) throws IOException, RevisionNotFoundException, PathNotFoundException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,11 +33,7 @@
|
|||||||
|
|
||||||
package sonia.scm.repository.spi;
|
package sonia.scm.repository.spi;
|
||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
import sonia.scm.repository.RevisionNotFoundException;
|
||||||
|
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
@@ -59,8 +55,6 @@ public interface DiffCommand
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public void getDiffResult(DiffCommandRequest request, OutputStream output)
|
public void getDiffResult(DiffCommandRequest request, OutputStream output) throws IOException, RevisionNotFoundException;
|
||||||
throws IOException, RepositoryException;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,12 +35,13 @@ package sonia.scm.repository.spi;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -115,7 +116,7 @@ public abstract class FileBaseCommandRequest
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("path", path)
|
.add("path", path)
|
||||||
.add("revision", revision)
|
.add("revision", revision)
|
||||||
.toString();
|
.toString();
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ import com.google.inject.Inject;
|
|||||||
import com.google.inject.Provider;
|
import com.google.inject.Provider;
|
||||||
import sonia.scm.repository.NamespaceAndName;
|
import sonia.scm.repository.NamespaceAndName;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
import sonia.scm.repository.RepositoryHookEvent;
|
import sonia.scm.repository.RepositoryHookEvent;
|
||||||
import sonia.scm.repository.RepositoryHookType;
|
import sonia.scm.repository.RepositoryHookType;
|
||||||
import sonia.scm.repository.RepositoryManager;
|
import sonia.scm.repository.RepositoryManager;
|
||||||
@@ -72,19 +71,18 @@ public final class HookEventFacade
|
|||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
|
|
||||||
public HookEventHandler handle(String id) throws RepositoryException {
|
public HookEventHandler handle(String id) throws RepositoryNotFoundException {
|
||||||
return handle(repositoryManagerProvider.get().get(id));
|
return handle(repositoryManagerProvider.get().get(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public HookEventHandler handle(NamespaceAndName namespaceAndName) throws RepositoryException {
|
public HookEventHandler handle(NamespaceAndName namespaceAndName) throws RepositoryNotFoundException {
|
||||||
return handle(repositoryManagerProvider.get().get(namespaceAndName));
|
return handle(repositoryManagerProvider.get().get(namespaceAndName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public HookEventHandler handle(Repository repository) throws RepositoryException
|
public HookEventHandler handle(Repository repository) throws RepositoryNotFoundException {
|
||||||
{
|
|
||||||
if (repository == null)
|
if (repository == null)
|
||||||
{
|
{
|
||||||
throw new RepositoryNotFoundException("could not find repository");
|
throw new RepositoryNotFoundException(repository);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new HookEventHandler(repositoryManagerProvider.get(),
|
return new HookEventHandler(repositoryManagerProvider.get(),
|
||||||
|
|||||||
@@ -35,12 +35,11 @@ package sonia.scm.repository.spi;
|
|||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import sonia.scm.repository.ChangesetPagingResult;
|
import sonia.scm.repository.ChangesetPagingResult;
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -49,18 +48,5 @@ import java.io.IOException;
|
|||||||
public interface IncomingCommand
|
public interface IncomingCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
ChangesetPagingResult getIncomingChangesets(IncomingCommandRequest request) throws IOException;
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*
|
|
||||||
* @throws IOException
|
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
|
||||||
public ChangesetPagingResult getIncomingChangesets(
|
|
||||||
IncomingCommandRequest request)
|
|
||||||
throws IOException, RepositoryException;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,45 +37,20 @@ package sonia.scm.repository.spi;
|
|||||||
|
|
||||||
import sonia.scm.repository.Changeset;
|
import sonia.scm.repository.Changeset;
|
||||||
import sonia.scm.repository.ChangesetPagingResult;
|
import sonia.scm.repository.ChangesetPagingResult;
|
||||||
import sonia.scm.repository.RepositoryException;
|
import sonia.scm.repository.RevisionNotFoundException;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
* @since 1.17
|
* @since 1.17
|
||||||
*/
|
*/
|
||||||
public interface LogCommand
|
public interface LogCommand {
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
Changeset getChangeset(String id) throws IOException, RevisionNotFoundException;
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*
|
|
||||||
* @throws IOException
|
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
|
||||||
public Changeset getChangeset(String id)
|
|
||||||
throws IOException, RepositoryException;
|
|
||||||
|
|
||||||
/**
|
ChangesetPagingResult getChangesets(LogCommandRequest request) throws IOException, RevisionNotFoundException;
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*
|
|
||||||
* @throws IOException
|
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
|
||||||
public ChangesetPagingResult getChangesets(LogCommandRequest request)
|
|
||||||
throws IOException, RepositoryException;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,12 +35,13 @@ package sonia.scm.repository.spi;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -125,7 +126,7 @@ public final class LogCommandRequest implements Serializable, Resetable
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("startChangeset", startChangeset)
|
.add("startChangeset", startChangeset)
|
||||||
.add("endChangeset", endChangeset)
|
.add("endChangeset", endChangeset)
|
||||||
.add("pagingStart", pagingStart)
|
.add("pagingStart", pagingStart)
|
||||||
|
|||||||
@@ -35,12 +35,11 @@ package sonia.scm.repository.spi;
|
|||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import sonia.scm.repository.ChangesetPagingResult;
|
import sonia.scm.repository.ChangesetPagingResult;
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -58,9 +57,6 @@ public interface OutgoingCommand
|
|||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public ChangesetPagingResult getOutgoingChangesets(
|
ChangesetPagingResult getOutgoingChangesets(OutgoingCommandRequest request) throws IOException;
|
||||||
OutgoingCommandRequest request)
|
|
||||||
throws IOException, RepositoryException;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ package sonia.scm.repository.spi;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -84,7 +84,7 @@ public abstract class PagedRemoteCommandRequest extends RemoteCommandRequest
|
|||||||
{
|
{
|
||||||
|
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("remoteURL", remoteRepository)
|
.add("remoteURL", remoteRepository)
|
||||||
.add("pagingStart", pagingStart)
|
.add("pagingStart", pagingStart)
|
||||||
.add("pagingLimit", pagingLimit)
|
.add("pagingLimit", pagingLimit)
|
||||||
|
|||||||
@@ -34,13 +34,12 @@ package sonia.scm.repository.spi;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
import sonia.scm.repository.api.PullResponse;
|
import sonia.scm.repository.api.PullResponse;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -58,8 +57,6 @@ public interface PullCommand
|
|||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public PullResponse pull(PullCommandRequest request)
|
PullResponse pull(PullCommandRequest request) throws IOException;
|
||||||
throws IOException, RepositoryException;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,13 +34,12 @@ package sonia.scm.repository.spi;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
import sonia.scm.repository.api.PushResponse;
|
import sonia.scm.repository.api.PushResponse;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -58,8 +57,6 @@ public interface PushCommand
|
|||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public PushResponse push(PushCommandRequest request)
|
PushResponse push(PushCommandRequest request) throws IOException;
|
||||||
throws IOException, RepositoryException;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,14 +35,14 @@ package sonia.scm.repository.spi;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -101,7 +101,7 @@ public abstract class RemoteCommandRequest implements Resetable
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("remoteRepository", remoteRepository)
|
.add("remoteRepository", remoteRepository)
|
||||||
.add("remoteUrl", remoteUrl)
|
.add("remoteUrl", remoteUrl)
|
||||||
.toString();
|
.toString();
|
||||||
|
|||||||
@@ -34,15 +34,13 @@ package sonia.scm.repository.spi;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
import sonia.scm.repository.Tag;
|
import sonia.scm.repository.Tag;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
@@ -57,7 +55,6 @@ public interface TagsCommand
|
|||||||
* @return
|
* @return
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public List<Tag> getTags() throws RepositoryException, IOException;
|
public List<Tag> getTags() throws IOException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,13 +35,12 @@ package sonia.scm.repository.spi;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import sonia.scm.repository.RepositoryException;
|
|
||||||
import sonia.scm.repository.api.UnbundleResponse;
|
import sonia.scm.repository.api.UnbundleResponse;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service provider implementation for the unbundle command.
|
* Service provider implementation for the unbundle command.
|
||||||
*
|
*
|
||||||
@@ -60,8 +59,7 @@ public interface UnbundleCommand
|
|||||||
* @return unbundle response
|
* @return unbundle response
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws RepositoryException
|
|
||||||
*/
|
*/
|
||||||
public UnbundleResponse unbundle(UnbundleCommandRequest request)
|
public UnbundleResponse unbundle(UnbundleCommandRequest request)
|
||||||
throws IOException, RepositoryException;
|
throws IOException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,16 +34,16 @@ package sonia.scm.security;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Permission object which is assigned to a specific user or group.
|
* Permission object which is assigned to a specific user or group.
|
||||||
@@ -150,7 +150,7 @@ public class AssignedPermission implements PermissionObject, Serializable
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("name", name)
|
.add("name", name)
|
||||||
.add("groupPermisison", groupPermission)
|
.add("groupPermisison", groupPermission)
|
||||||
.add("permission", permission)
|
.add("permission", permission)
|
||||||
|
|||||||
@@ -33,11 +33,10 @@ package sonia.scm.security;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.ImmutableSet.Builder;
|
import com.google.common.collect.ImmutableSet.Builder;
|
||||||
|
|
||||||
import org.apache.shiro.authc.AuthenticationException;
|
import org.apache.shiro.authc.AuthenticationException;
|
||||||
import org.apache.shiro.authc.AuthenticationInfo;
|
import org.apache.shiro.authc.AuthenticationInfo;
|
||||||
import org.apache.shiro.authc.AuthenticationToken;
|
import org.apache.shiro.authc.AuthenticationToken;
|
||||||
@@ -47,10 +46,8 @@ import org.apache.shiro.authc.UnknownAccountException;
|
|||||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||||
import org.apache.shiro.authc.credential.CredentialsMatcher;
|
import org.apache.shiro.authc.credential.CredentialsMatcher;
|
||||||
import org.apache.shiro.subject.SimplePrincipalCollection;
|
import org.apache.shiro.subject.SimplePrincipalCollection;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.group.Group;
|
import sonia.scm.group.Group;
|
||||||
import sonia.scm.group.GroupDAO;
|
import sonia.scm.group.GroupDAO;
|
||||||
import sonia.scm.group.GroupNames;
|
import sonia.scm.group.GroupNames;
|
||||||
@@ -161,7 +158,7 @@ public final class DAORealmHelper
|
|||||||
collection.add(principal, realm);
|
collection.add(principal, realm);
|
||||||
collection.add(user, realm);
|
collection.add(user, realm);
|
||||||
collection.add(collectGroups(principal), realm);
|
collection.add(collectGroups(principal), realm);
|
||||||
collection.add(Objects.firstNonNull(scope, Scope.empty()), realm);
|
collection.add(MoreObjects.firstNonNull(scope, Scope.empty()), realm);
|
||||||
|
|
||||||
String creds = credentials;
|
String creds = credentials;
|
||||||
|
|
||||||
|
|||||||
@@ -34,16 +34,16 @@ package sonia.scm.security;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Descriptor for available permission objects.
|
* Descriptor for available permission objects.
|
||||||
@@ -125,7 +125,7 @@ public class PermissionDescriptor implements Serializable
|
|||||||
{
|
{
|
||||||
|
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("displayName", displayName)
|
.add("displayName", displayName)
|
||||||
.add("description", description)
|
.add("description", description)
|
||||||
.add("value", value)
|
.add("value", value)
|
||||||
|
|||||||
@@ -35,17 +35,16 @@ package sonia.scm.security;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
import org.apache.shiro.authz.Permission;
|
import org.apache.shiro.authz.Permission;
|
||||||
|
|
||||||
import sonia.scm.repository.PermissionType;
|
import sonia.scm.repository.PermissionType;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents the permission to a repository of a user.
|
* This class represents the permission to a repository of a user.
|
||||||
*
|
*
|
||||||
@@ -174,7 +173,7 @@ public final class RepositoryPermission
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
return Objects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
.add("repositoryId", repositoryId)
|
.add("repositoryId", repositoryId)
|
||||||
.add("permissionType", permissionType)
|
.add("permissionType", permissionType)
|
||||||
.toString();
|
.toString();
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user