cache;
+
+ /** disables the cache */
+ private boolean disableCache;
+
+ /** the repsitory */
+ private Repository repository;
+
+ /** request for the command */
+ private BrowseCommandRequest request = new BrowseCommandRequest();
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/api/CatCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/CatCommandBuilder.java
new file mode 100644
index 0000000000..e066e38357
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/api/CatCommandBuilder.java
@@ -0,0 +1,173 @@
+/**
+ * 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.api;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+import com.google.common.io.Closeables;
+
+import sonia.scm.repository.Repository;
+import sonia.scm.repository.spi.CatCommand;
+import sonia.scm.repository.spi.CatCommandRequest;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+
+/**
+ * Shows the content of a file in the {@link Repository}.
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public final class CatCommandBuilder
+{
+
+ /**
+ * Constructs a new {@link CatCommandBuilder}, this constructor should
+ * only be called from the {@link RepositoryService}.
+ *
+ * @param catCommand implementation of the {@link CatCommand}
+ */
+ CatCommandBuilder(CatCommand catCommand)
+ {
+ this.catCommand = catCommand;
+ }
+
+ //~--- methods --------------------------------------------------------------
+
+ /**
+ * Reset each parameter to its default value.
+ *
+ * @return {@code this}
+ */
+ public CatCommandBuilder reset()
+ {
+ request.reset();
+
+ return this;
+ }
+
+ /**
+ * Passes the content of the given file to the outputstream.
+ *
+ * @param outputStream outputstream for the content
+ * @param path file path
+ *
+ * @return {@code this}
+ */
+ public CatCommandBuilder retriveContent(OutputStream outputStream,
+ String path)
+ {
+ getCatResult(outputStream, path);
+
+ return this;
+ }
+
+ //~--- get methods ----------------------------------------------------------
+
+ /**
+ * Returns the content of the given file.
+ *
+ * @param path file path
+ * @return content of the file
+ */
+ public String getContent(String path)
+ {
+ String content = null;
+ ByteArrayOutputStream baos = null;
+
+ try
+ {
+ baos = new ByteArrayOutputStream();
+ getCatResult(baos, path);
+ content = baos.toString();
+ }
+ finally
+ {
+ Closeables.closeQuietly(baos);
+ }
+
+ return content;
+ }
+
+ //~--- set methods ----------------------------------------------------------
+
+ /**
+ * Sets the revision of the file.
+ *
+ *
+ * @param revision revision of the file
+ *
+ * @return {@code this}
+ */
+ public CatCommandBuilder setRevision(String revision)
+ {
+ request.setRevision(revision);
+
+ return this;
+ }
+
+ //~--- get methods ----------------------------------------------------------
+
+ /**
+ * Executes the cat command.
+ *
+ *
+ * @param outputStream the outputstream for the content
+ * @param path path of the file
+ */
+ private void getCatResult(OutputStream outputStream, String path)
+ {
+ Preconditions.checkNotNull(outputStream, "OutputStream is required");
+ Preconditions.checkArgument(!Strings.isNullOrEmpty(path),
+ "path is required");
+
+ CatCommandRequest requestClone = request.clone();
+
+ requestClone.setPath(path);
+ catCommand.getCatResult(requestClone, outputStream);
+ }
+
+ //~--- fields ---------------------------------------------------------------
+
+ /** implementation of the cat command */
+ private CatCommand catCommand;
+
+ /** request for the cat command */
+ private CatCommandRequest request = new CatCommandRequest();
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/api/Command.java b/scm-core/src/main/java/sonia/scm/repository/api/Command.java
new file mode 100644
index 0000000000..5caba59440
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/api/Command.java
@@ -0,0 +1,45 @@
+/**
+ * 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.api;
+
+/**
+ * Enumeration of available commands.
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public enum Command
+{
+ LOG, BROWSE, CAT, DIFF, BLAME
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/api/CommandNotSupportedException.java b/scm-core/src/main/java/sonia/scm/repository/api/CommandNotSupportedException.java
new file mode 100644
index 0000000000..ddf1cc7b21
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/api/CommandNotSupportedException.java
@@ -0,0 +1,93 @@
+/**
+ * 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.api;
+
+/**
+ * This exception is thrown if the {@link RepositoryService} does not support
+ * the requested command.
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public final class CommandNotSupportedException extends RuntimeException
+{
+
+ /**
+ * Constructs a new {@link CommandNotSupportedException}.
+ *
+ *
+ * @param command not supported command
+ */
+ public CommandNotSupportedException(Command command)
+ {
+ //J-
+ this(
+ command,
+ "The requested feature "
+ .concat(command.toString())
+ .concat(" is not supported")
+ );
+ //J+
+ }
+
+ /**
+ * Constructs a new {@link CommandNotSupportedException}.
+ *
+ *
+ * @param command not supported command
+ * @param message message to be shown
+ */
+ public CommandNotSupportedException(Command command, String message)
+ {
+ super(message);
+ }
+
+ //~--- get methods ----------------------------------------------------------
+
+ /**
+ * Returns the command which is not supported.
+ *
+ *
+ * @return not supported command
+ */
+ public Command getCommand()
+ {
+ return command;
+ }
+
+ //~--- fields ---------------------------------------------------------------
+
+ /** not supported command */
+ private Command command;
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java
new file mode 100644
index 0000000000..e1f54ef7e5
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/api/DiffCommandBuilder.java
@@ -0,0 +1,173 @@
+/**
+ * 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.api;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import com.google.common.base.Preconditions;
+import com.google.common.io.Closeables;
+
+import sonia.scm.repository.spi.DiffCommand;
+import sonia.scm.repository.spi.DiffCommandRequest;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+
+/**
+ * Shows differences between revisions for a specified file or
+ * the entire revision.
+ * Note: One of the parameter path or revision have to be set.
+ * TODO check current behavior.
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public final class DiffCommandBuilder
+{
+
+ /**
+ * Constructs a new {@link DiffCommandBuilder}, this constructor should
+ * only be called from the {@link RepositoryService}.
+ *
+ * @param implementation of {@link DiffCommand}
+ *
+ * @param diffCommand
+ */
+ DiffCommandBuilder(DiffCommand diffCommand)
+ {
+ this.diffCommand = diffCommand;
+ }
+
+ //~--- methods --------------------------------------------------------------
+
+ /**
+ * Passes the difference of the given parameter to the outputstream.
+ *
+ *
+ * @param outputStream outputstream for the difference
+ *
+ * @return {@code this}
+ */
+ public DiffCommandBuilder retriveContent(OutputStream outputStream)
+ {
+ getDiffResult(outputStream);
+
+ return this;
+ }
+
+ //~--- get methods ----------------------------------------------------------
+
+ /**
+ * Returns the content of the difference as string.
+ *
+ * @return content of the difference
+ */
+ public String getContent()
+ {
+ String content = null;
+ ByteArrayOutputStream baos = null;
+
+ try
+ {
+ baos = new ByteArrayOutputStream();
+ getDiffResult(baos);
+ content = baos.toString();
+ }
+ finally
+ {
+ Closeables.closeQuietly(baos);
+ }
+
+ return content;
+ }
+
+ //~--- set methods ----------------------------------------------------------
+
+ /**
+ * Show the difference only for the given path.
+ *
+ *
+ * @param path path for difference
+ *
+ * @return {@code this}
+ */
+ public DiffCommandBuilder setPath(String path)
+ {
+ request.setPath(path);
+
+ return this;
+ }
+
+ /**
+ * Show the difference only for the given revision.
+ *
+ *
+ * @param revision revision for difference
+ *
+ * @return {@code this}
+ */
+ public DiffCommandBuilder setRevision(String revision)
+ {
+ request.setRevision(revision);
+
+ return this;
+ }
+
+ //~--- get methods ----------------------------------------------------------
+
+ /**
+ * Method description
+ *
+ *
+ * @param outputStream
+ * @param path
+ */
+ private void getDiffResult(OutputStream outputStream)
+ {
+ Preconditions.checkNotNull(outputStream, "OutputStream is required");
+ Preconditions.checkArgument(request.isValid(),
+ "path and/or revision is required");
+ diffCommand.getDiffResult(request, outputStream);
+ }
+
+ //~--- fields ---------------------------------------------------------------
+
+ /** implementation of the diff command */
+ private DiffCommand diffCommand;
+
+ /** request for the diff command implementation */
+ private DiffCommandRequest request = new DiffCommandRequest();
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java
new file mode 100644
index 0000000000..af483b202c
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java
@@ -0,0 +1,451 @@
+/**
+ * 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.api;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+
+import sonia.scm.cache.Cache;
+import sonia.scm.cache.CacheManager;
+import sonia.scm.repository.Changeset;
+import sonia.scm.repository.ChangesetPagingResult;
+import sonia.scm.repository.Repository;
+import sonia.scm.repository.spi.LogCommand;
+import sonia.scm.repository.spi.LogCommandRequest;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.Serializable;
+
+/**
+ * LogCommandBuilder is able to show the history of a file in a
+ * {@link Repository} or the entire history of a {@link Repository}.
+ * This class could be used to retrieve a single {@link Changeset} by its id
+ * or to get a list of changesets in a {@link ChangesetPagingResult}
+ * which can be used for paging.
+ *
+ * Samples:
+ *
+ *
+ * Get a instance of LogCommandBuilder:
+ *
+ * public class Sample {
+ *
+ * {@literal @}Inject
+ * public Sample(RepositoryServiceFactory factory){
+ * LogCommandBuilder log = factory.create("repository-id").getLogCommand();
+ * }
+ *
+ * }
+ *
+ *
+ * Retrieve a single {@link Changeset}:
+ *
+ * LogCommand log = repositoryService.getLogCommand();
+ * Changeset changeset = log.getChangeset("id-of-the-commit");
+ *
+ *
+ * Retrieve changesets of a {@link Repository} with paging:
+ *
+ * LogCommand log = repositoryService.getLogCommand();
+ * ChangesetPagingResult changesetPagingResult =
+ * log.setPagingStart(25).setPagingLimit(25).getChangesets();
+ *
+ *
+ * Retrieve all changesets of a file in a {@link Repository}:
+ *
+ * LogCommand log = repositoryService.getLogCommand();
+ * ChangesetPagingResult changesetPagingResult =
+ * log.setPath("pom.xml").disablePagingLimit().getChangesets();
+ *
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public final class LogCommandBuilder
+{
+
+ /** name of the cache */
+ private static final String CACHE_NAME = "sonia.scm.cache.log";
+
+ //~--- constructors ---------------------------------------------------------
+
+ /**
+ * Constructs a new {@link LogCommandBuilder}, this constructor should
+ * only be called from the {@link RepositoryService}.
+ *
+ * @param cacheManager cache manager
+ * @param logCommand implementation of the {@link LogCommand}
+ * @param repository repository to query
+ */
+ LogCommandBuilder(CacheManager cacheManager, LogCommand logCommand,
+ Repository repository)
+ {
+ this.cache = cacheManager.getCache(CacheKey.class,
+ ChangesetPagingResult.class, CACHE_NAME);
+ this.logCommand = logCommand;
+ this.repository = repository;
+ }
+
+ //~--- methods --------------------------------------------------------------
+
+ /**
+ * Disable paging limit all available changesets will be retrieved.
+ * This method does the same as {@link #setPagingLimit(int)}
+ * with a value of -1.
+ *
+ *
+ * @return {@code this}
+ */
+ public LogCommandBuilder disablePagingLimit()
+ {
+ request.setPagingLimit(-1);
+
+ return this;
+ }
+
+ /**
+ * Reset each parameter to its default value.
+ *
+ *
+ * @return {@code this}
+ */
+ public LogCommandBuilder reset()
+ {
+ request.reset();
+
+ return this;
+ }
+
+ //~--- get methods ----------------------------------------------------------
+
+ /**
+ * Returns the {@link Changeset} with the given id or null if the
+ * {@link Changeset} could not be found in the {@link Repository}.
+ *
+ *
+ * @param id id of the {@link Changeset}
+ *
+ * @return the {@link Changeset} with the given id or null
+ */
+ public Changeset getChangeset(String id)
+ {
+ Changeset changeset = null;
+
+ if (disableCache)
+ {
+ changeset = logCommand.getChangeset(id);
+ }
+ else
+ {
+ CacheKey key = new CacheKey(repository, id);
+ ChangesetPagingResult cpr = cache.get(key);
+
+ if (cpr == null)
+ {
+ changeset = logCommand.getChangeset(id);
+
+ if (changeset != null)
+ {
+ cpr = new ChangesetPagingResult(1, ImmutableList.of(changeset));
+ cache.put(key, cpr);
+ }
+ }
+ else
+ {
+ changeset = cpr.iterator().next();
+ }
+ }
+
+ return changeset;
+ }
+
+ /**
+ * Return all changesets with the given parameters.
+ *
+ *
+ * @return all changesets with the given parameters
+ */
+ public ChangesetPagingResult getChangesets()
+ {
+ ChangesetPagingResult cpr = null;
+
+ if (disableCache)
+ {
+ cpr = logCommand.getChangesets(request);
+ }
+ else
+ {
+ CacheKey key = new CacheKey(repository, request);
+
+ cpr = cache.get(key);
+
+ if (cpr == null)
+ {
+ cpr = logCommand.getChangesets(request);
+
+ if (cpr != null)
+ {
+ cache.put(key, cpr);
+ }
+ }
+ }
+
+ return cpr;
+ }
+
+ //~--- set methods ----------------------------------------------------------
+
+ /**
+ * Retrieve only changesets of the given branch.
+ *
+ *
+ * @param branch branch name to query
+ *
+ * @return {@code this}
+ */
+ public LogCommandBuilder setBranch(String branch)
+ {
+ request.setBranch(branch);
+
+ return this;
+ }
+
+ /**
+ * Disables the cache for changesets. This means that every {@link Changeset}
+ * is directly retrieved from the {@link Repository}. Note: Disabling
+ * the cache cost a lot of performance and could be much more slower.
+ *
+ *
+ * @param disableCache true to disable the cache
+ *
+ * @return {@code this}
+ */
+ public LogCommandBuilder setDisableCache(boolean disableCache)
+ {
+ this.disableCache = disableCache;
+
+ return this;
+ }
+
+ /**
+ * Retrieve changesets until the given the {@link Changeset}
+ * with the given id.
+ *
+ *
+ * @param endChangeset id of the end {@link Changeset}
+ *
+ * @return {@code this}
+ */
+ public LogCommandBuilder setEndChangeset(String endChangeset)
+ {
+ request.setEndChangeset(endChangeset);
+
+ return this;
+ }
+
+ /**
+ * Set the limit for the returned changesets. The default value is 20.
+ * Setting the value to -1 means to disable the limit.
+ *
+ *
+ * @param pagingLimit limit for returned changesets
+ *
+ * @return {@code this}
+ */
+ public LogCommandBuilder setPagingLimit(int pagingLimit)
+ {
+ request.setPagingLimit(pagingLimit);
+
+ return this;
+ }
+
+ /**
+ * Sets the start value for paging. The value is 0.
+ *
+ *
+ * @param pagingStart start value for paging
+ *
+ * @return {@code this}
+ */
+ public LogCommandBuilder setPagingStart(int pagingStart)
+ {
+ request.setPagingStart(pagingStart);
+
+ return this;
+ }
+
+ /**
+ * Retrieve only changesets which are affect the given path.
+ *
+ *
+ * @param path file path in the {@link Repository}.
+ *
+ * @return {@code this}
+ */
+ public LogCommandBuilder setPath(String path)
+ {
+ request.setPath(path);
+
+ return this;
+ }
+
+ /**
+ * Start at the given {@link Changeset}.
+ *
+ *
+ * @param startChangeset changeset id to start with
+ *
+ * @return {@code this}
+ */
+ public LogCommandBuilder setStartChangeset(String startChangeset)
+ {
+ request.setStartChangeset(startChangeset);
+
+ return this;
+ }
+
+ //~--- inner classes --------------------------------------------------------
+
+ /**
+ * Class description
+ *
+ *
+ * @version Enter version here..., 12/06/05
+ * @author Enter your name here...
+ */
+ private static class CacheKey implements Serializable
+ {
+
+ /**
+ * Constructs ...
+ *
+ *
+ * @param repository
+ * @param request
+ */
+ public CacheKey(Repository repository, LogCommandRequest request)
+ {
+ this.repositoryId = repository.getId();
+ this.request = request;
+ }
+
+ /**
+ * Constructs ...
+ *
+ *
+ *
+ * @param repository
+ * @param changesetId
+ */
+ public CacheKey(Repository repository, String changesetId)
+ {
+ this.repositoryId = repository.getId();
+ this.changesetId = changesetId;
+ }
+
+ //~--- methods ------------------------------------------------------------
+
+ /**
+ * Method description
+ *
+ *
+ * @param obj
+ *
+ * @return
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == null)
+ {
+ return false;
+ }
+
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+
+ final CacheKey other = (CacheKey) obj;
+
+ return Objects.equal(repositoryId, other.repositoryId)
+ && Objects.equal(changesetId, other.changesetId)
+ && Objects.equal(request, other.request);
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ @Override
+ public int hashCode()
+ {
+ return Objects.hashCode(repositoryId, changesetId, request);
+ }
+
+ //~--- fields -------------------------------------------------------------
+
+ /** Field description */
+ private String changesetId;
+
+ /** Field description */
+ private String repositoryId;
+
+ /** Field description */
+ private LogCommandRequest request;
+ }
+
+
+ //~--- fields ---------------------------------------------------------------
+
+ /** cache for changesets */
+ private Cache cache;
+
+ /** disable cache */
+ private boolean disableCache;
+
+ /** Implementation of the log command */
+ private LogCommand logCommand;
+
+ /** repository to query */
+ private Repository repository;
+
+ /** request for the log command */
+ private LogCommandRequest request = new LogCommandRequest();
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java
new file mode 100644
index 0000000000..53207c7406
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java
@@ -0,0 +1,165 @@
+/**
+ * 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.api;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import sonia.scm.cache.CacheManager;
+import sonia.scm.repository.Repository;
+import sonia.scm.repository.spi.RepositoryServiceProvider;
+
+/**
+ * From the {@link RepositoryService} it is possible to access all commands for
+ * a single {@link Repository}. The {@link RepositoryService} is only access
+ * able from the {@link RepositoryServiceFactory}.
+ *
+ *
+ * Note: Not every {@link RepositoryService} supports every command. If
+ * the command is not supported the method will trow a
+ * {@link CommandNotSupportedException}. It is possible to check if the command
+ * is supported by the {@link RepositoryService} with the
+ * {@link RepositoryService#isSupported(Command)} method.
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public final class RepositoryService
+{
+
+ /**
+ * Constructs a new {@link RepositoryService}. This constructor should only
+ * be called from the {@link RepositoryServiceFactory}.
+ *
+ * @param cacheManager cache manager
+ * @param provider implementation for {@link RepositoryServiceProvider}
+ * @param repository the repository
+ */
+ RepositoryService(CacheManager cacheManager,
+ RepositoryServiceProvider provider, Repository repository)
+ {
+ this.cacheManager = cacheManager;
+ this.provider = provider;
+ this.repository = repository;
+ }
+
+ //~--- get methods ----------------------------------------------------------
+
+ /**
+ * The blame command shows changeset information by line for a given file.
+ *
+ * @return instance of {@link BlameCommandBuilder}
+ * @throws CommandNotSupportedException if the command is not supported
+ * by the implementation of the repository service provider.
+ */
+ public BlameCommandBuilder getBlameCommand()
+ {
+ return new BlameCommandBuilder(cacheManager, provider.getBlameCommand(),
+ repository);
+ }
+
+ /**
+ * The browse command allows browsing of a repository.
+ *
+ * @return instance of {@link BrowseCommandBuilder}
+ * @throws CommandNotSupportedException if the command is not supported
+ * by the implementation of the repository service provider.
+ */
+ public BrowseCommandBuilder getBrowseCommand()
+ {
+ return new BrowseCommandBuilder(cacheManager, provider.getBrowseCommand(),
+ repository);
+ }
+
+ /**
+ * The cat command show the content of a given file.
+ *
+ * @return instance of {@link CatCommandBuilder}
+ * @throws CommandNotSupportedException if the command is not supported
+ * by the implementation of the repository service provider.
+ */
+ public CatCommandBuilder getCatCommand()
+ {
+ return new CatCommandBuilder(provider.getCatCommand());
+ }
+
+ /**
+ * The diff command shows differences between revisions for a specified file
+ * or the entire revision.
+ *
+ * @return instance of {@link DiffCommandBuilder}
+ * @throws CommandNotSupportedException if the command is not supported
+ * by the implementation of the repository service provider.
+ */
+ public DiffCommandBuilder getDiffCommand()
+ {
+ return new DiffCommandBuilder(provider.getDiffCommand());
+ }
+
+ /**
+ * The log command shows revision history of entire repository or files.
+ *
+ * @return instance of {@link LogCommandBuilder}
+ * @throws CommandNotSupportedException if the command is not supported
+ * by the implementation of the repository service provider.
+ */
+ public LogCommandBuilder getLogCommand()
+ {
+ return new LogCommandBuilder(cacheManager, provider.getLogCommand(),
+ repository);
+ }
+
+ /**
+ * Returns true if the command is supported by the repository service.
+ *
+ *
+ * @param command command
+ *
+ * @return true if the command is supported
+ */
+ public boolean isSupported(Command command)
+ {
+ return provider.getSupportedCommands().contains(command);
+ }
+
+ //~--- fields ---------------------------------------------------------------
+
+ /** cache manager */
+ private CacheManager cacheManager;
+
+ /** implementation of the repository service provider */
+ private RepositoryServiceProvider provider;
+
+ /** the repository */
+ private Repository repository;
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java
new file mode 100644
index 0000000000..55097b5433
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceFactory.java
@@ -0,0 +1,228 @@
+/**
+ * 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.api;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+
+import sonia.scm.cache.CacheManager;
+import sonia.scm.repository.Repository;
+import sonia.scm.repository.RepositoryManager;
+import sonia.scm.repository.RepositoryNotFoundException;
+import sonia.scm.repository.spi.RepositoryServiceProvider;
+import sonia.scm.repository.spi.RepositoryServiceResolver;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.util.Set;
+
+/**
+ * The {@link RepositoryServiceFactory} is the entrypoint of the repository api.
+ * You could create {@link RepositoryService} from a {@link Repository} and
+ * with the {@link RepositoryService} you could browse and control the entire
+ * {@link Repository}.
+ *
+ * Simple usage example:
+ *
+ *
+ * public class Sample {
+ *
+ * private final RepositoryServiceFactory factory;
+ *
+ * {@literal @}Inject
+ * public Sample(RepositoryServiceFactory factory){
+ * this.factory = factory;
+ * }
+ *
+ * public Changeset getChangeset(String repositoryId, String commitId){
+ * RepositoryService service = factory.create(repositoryId);
+ * return service.getLogCommand().getChangeset(commitId);
+ * }
+ *
+ * }
+ *
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+@Singleton
+public final class RepositoryServiceFactory
+{
+
+ /**
+ * Constructs a new {@link RepositoryServiceFactory}. This constructor
+ * should not be called manually, it should only be used by the injection
+ * container.
+ *
+ * @param cacheManager cache manager
+ * @param repositoryManager manager for repositories
+ * @param resolvers a set of {@link RepositoryServiceResolver}
+ */
+ @Inject
+ public RepositoryServiceFactory(CacheManager cacheManager,
+ RepositoryManager repositoryManager,
+ Set resolvers)
+ {
+ this.cacheManager = cacheManager;
+ this.repositoryManager = repositoryManager;
+ this.resolvers = resolvers;
+ }
+
+ //~--- methods --------------------------------------------------------------
+
+ /**
+ * Creates a new RepositoryService for the given repository.
+ *
+ *
+ * @param repositoryId id of the repository
+ *
+ * @return a implementation of RepositoryService
+ * for the given type of repository
+ *
+ * @throws RepositoryNotFoundException if no repository
+ * with the given id is available
+ * @throws RepositoryServiceNotFoundException if no repository service
+ * implementation for this kind of repository is available
+ * @throws IllegalArgumentException if the repository id is null or empty
+ */
+ public RepositoryService create(String repositoryId)
+ throws RepositoryNotFoundException
+ {
+ Preconditions.checkArgument(!Strings.isNullOrEmpty(repositoryId),
+ "a non empty repositoryId is required");
+
+ Repository repository = repositoryManager.get(repositoryId);
+
+ if (repository == null)
+ {
+ throw new RepositoryNotFoundException(
+ "could not find a repository with id ".concat(repositoryId));
+ }
+
+ return create(repository);
+ }
+
+ /**
+ * Creates a new RepositoryService for the given repository.
+ *
+ *
+ * @param type type of the repository
+ * @param name name of the repository
+ *
+ * @return a implementation of RepositoryService
+ * for the given type of repository
+ *
+ * @throws RepositoryNotFoundException if no repository
+ * with the given id is available
+ * @throws RepositoryServiceNotFoundException if no repository service
+ * implementation for this kind of repository is available
+ * @throws IllegalArgumentException if one of the parameters is null or empty
+ */
+ public RepositoryService create(String type, String name)
+ throws RepositoryNotFoundException
+ {
+ Preconditions.checkArgument(!Strings.isNullOrEmpty(type),
+ "a non empty type is required");
+ Preconditions.checkArgument(!Strings.isNullOrEmpty(name),
+ "a non empty name is required");
+
+ Repository repository = repositoryManager.get(type, name);
+
+ if (repository == null)
+ {
+ StringBuilder msg =
+ new StringBuilder("could not find a repository with type ");
+
+ msg.append(type).append(" and name ").append(name);
+
+ throw new RepositoryNotFoundException(msg.toString());
+ }
+
+ return create(repository);
+ }
+
+ /**
+ * Creates a new RepositoryService for the given repository.
+ *
+ *
+ * @param repository the repository
+ *
+ * @return a implementation of RepositoryService
+ * for the given type of repository
+ *
+ * @throws RepositoryServiceNotFoundException if no repository service
+ * implementation for this kind of repository is available
+ * @throws NullPointerException if the repository is null
+ */
+ public RepositoryService create(Repository repository)
+ {
+ Preconditions.checkNotNull(repository, "repository is required");
+
+ RepositoryService service = null;
+
+ for (RepositoryServiceResolver resolver : resolvers)
+ {
+ RepositoryServiceProvider provider = resolver.reslove(repository);
+
+ if (provider != null)
+ {
+ service = new RepositoryService(cacheManager, provider, repository);
+
+ break;
+ }
+ }
+
+ if (service == null)
+ {
+ throw new RepositoryServiceNotFoundException(repository);
+ }
+
+ return service;
+ }
+
+ //~--- fields ---------------------------------------------------------------
+
+ /** Field description */
+ private CacheManager cacheManager;
+
+ /** Field description */
+ private RepositoryManager repositoryManager;
+
+ /** Field description */
+ private Set resolvers;
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceNotFoundException.java b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceNotFoundException.java
new file mode 100644
index 0000000000..09d6b43a4d
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryServiceNotFoundException.java
@@ -0,0 +1,80 @@
+/**
+ * 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.api;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import sonia.scm.repository.Repository;
+
+/**
+ * This exception is throw if no {@link RepositoryService}
+ * is available for the given {@link Repository}.
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public final class RepositoryServiceNotFoundException extends RuntimeException
+{
+
+ /**
+ * Constructs a new {@link RepositoryServiceNotFoundException}.
+ *
+ *
+ * @param repository unsupported repository
+ */
+ public RepositoryServiceNotFoundException(Repository repository)
+ {
+ super("could not find a repository service provider implementation for repository "
+ .concat(repository.getName()));
+ this.repository = repository;
+ }
+
+ //~--- get methods ----------------------------------------------------------
+
+ /**
+ * Returns the unsupported repository.
+ *
+ *
+ * @return unsupported repository
+ */
+ public Repository getRepository()
+ {
+ return repository;
+ }
+
+ //~--- fields ---------------------------------------------------------------
+
+ /** unsupported repository */
+ private Repository repository;
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/api/package-info.java b/scm-core/src/main/java/sonia/scm/repository/api/package-info.java
new file mode 100644
index 0000000000..a1713ee6a9
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/api/package-info.java
@@ -0,0 +1,37 @@
+/**
+ * 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
+ *
+ */
+
+
+
+/**
+ * API for repository access.
+ */
+package sonia.scm.repository.api;
diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/BlameCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/BlameCommand.java
new file mode 100644
index 0000000000..9908a3c35a
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/spi/BlameCommand.java
@@ -0,0 +1,57 @@
+/**
+ * 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.spi;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import sonia.scm.repository.BlameResult;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public interface BlameCommand
+{
+
+ /**
+ * Method description
+ *
+ *
+ * @param request
+ *
+ * @return
+ */
+ public BlameResult getBlameResult(BlameCommandRequest request);
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/BlameCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/BlameCommandRequest.java
new file mode 100644
index 0000000000..f7df5a4371
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/spi/BlameCommandRequest.java
@@ -0,0 +1,68 @@
+/**
+ * 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.spi;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public final class BlameCommandRequest extends FileBaseCommandRequest
+{
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ @Override
+ public BlameCommandRequest clone()
+ {
+ BlameCommandRequest clone = null;
+
+ try
+ {
+ clone = (BlameCommandRequest) super.clone();
+ }
+ catch (CloneNotSupportedException e)
+ {
+
+ // this shouldn't happen, since we are Cloneable
+ throw new InternalError("BlameCommandRequest seems not to be cloneable");
+ }
+
+ return clone;
+ }
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/BrowseCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/BrowseCommand.java
new file mode 100644
index 0000000000..5b6677e3b1
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/spi/BrowseCommand.java
@@ -0,0 +1,57 @@
+/**
+ * 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.spi;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import sonia.scm.repository.BrowserResult;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public interface BrowseCommand
+{
+
+ /**
+ * Method description
+ *
+ *
+ * @param request
+ *
+ * @return
+ */
+ public BrowserResult getBrowserResult(BrowseCommandRequest request);
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/BrowseCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/BrowseCommandRequest.java
new file mode 100644
index 0000000000..52fbf96a0d
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/spi/BrowseCommandRequest.java
@@ -0,0 +1,46 @@
+/**
+ * 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.spi;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.Serializable;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public final class BrowseCommandRequest extends FileBaseCommandRequest
+ implements Resetable, Serializable {}
diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/CatCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/CatCommand.java
new file mode 100644
index 0000000000..83d9f8c5da
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/spi/CatCommand.java
@@ -0,0 +1,56 @@
+/**
+ * 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.spi;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.OutputStream;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public interface CatCommand
+{
+
+ /**
+ * Method description
+ *
+ *
+ * @param request
+ * @param output
+ */
+ public void getCatResult(CatCommandRequest request, OutputStream output);
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/CatCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/CatCommandRequest.java
new file mode 100644
index 0000000000..1673204b1a
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/spi/CatCommandRequest.java
@@ -0,0 +1,69 @@
+/**
+ * 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.spi;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public final class CatCommandRequest extends FileBaseCommandRequest
+ implements Cloneable
+{
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ @Override
+ public CatCommandRequest clone()
+ {
+ CatCommandRequest clone = null;
+
+ try
+ {
+ clone = (CatCommandRequest) super.clone();
+ }
+ catch (CloneNotSupportedException e)
+ {
+
+ // this shouldn't happen, since we are Cloneable
+ throw new InternalError("CatCommandRequest seems not to be cloneable");
+ }
+
+ return clone;
+ }
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/DiffCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/DiffCommand.java
new file mode 100644
index 0000000000..c5197a1860
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/spi/DiffCommand.java
@@ -0,0 +1,56 @@
+/**
+ * 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.spi;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.OutputStream;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public interface DiffCommand
+{
+
+ /**
+ * Method description
+ *
+ *
+ * @param request
+ * @param output
+ */
+ public void getDiffResult(DiffCommandRequest request, OutputStream output);
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/DiffCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/DiffCommandRequest.java
new file mode 100644
index 0000000000..daca399877
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/spi/DiffCommandRequest.java
@@ -0,0 +1,90 @@
+/**
+ * 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.spi;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import com.google.common.base.Strings;
+
+import sonia.scm.Validateable;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public final class DiffCommandRequest extends FileBaseCommandRequest
+ implements Cloneable, Validateable
+{
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ @Override
+ public DiffCommandRequest clone()
+ {
+ DiffCommandRequest clone = null;
+
+ try
+ {
+ clone = (DiffCommandRequest) super.clone();
+ }
+ catch (CloneNotSupportedException e)
+ {
+
+ // this shouldn't happen, since we are Cloneable
+ throw new InternalError("DiffCommandRequest seems not to be cloneable");
+ }
+
+ return clone;
+ }
+
+ //~--- get methods ----------------------------------------------------------
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ @Override
+ public boolean isValid()
+ {
+ return !Strings.isNullOrEmpty(getPath())
+ ||!Strings.isNullOrEmpty(getRevision());
+ }
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/FileBaseCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/FileBaseCommandRequest.java
new file mode 100644
index 0000000000..609ab8d82f
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/spi/FileBaseCommandRequest.java
@@ -0,0 +1,174 @@
+/**
+ * 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.spi;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import com.google.common.base.Objects;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.Serializable;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public abstract class FileBaseCommandRequest implements Resetable, Serializable
+{
+
+ /**
+ * Method description
+ *
+ *
+ * @param obj
+ *
+ * @return
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == null)
+ {
+ return false;
+ }
+
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+
+ final FileBaseCommandRequest other = (FileBaseCommandRequest) obj;
+
+ return Objects.equal(path, other.path)
+ && Objects.equal(revision, other.revision);
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ @Override
+ public int hashCode()
+ {
+ return Objects.hashCode(path, revision);
+ }
+
+ /**
+ * Method description
+ *
+ */
+ @Override
+ public void reset()
+ {
+ path = null;
+ revision = null;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ @Override
+ public String toString()
+ {
+ //J-
+ return Objects.toStringHelper(this)
+ .add("path", path)
+ .add("revision", revision)
+ .toString();
+ //J+
+ }
+
+ //~--- set methods ----------------------------------------------------------
+
+ /**
+ * Method description
+ *
+ *
+ * @param path
+ */
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @param revision
+ */
+ public void setRevision(String revision)
+ {
+ this.revision = revision;
+ }
+
+ //~--- get methods ----------------------------------------------------------
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ String getPath()
+ {
+ return path;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ String getRevision()
+ {
+ return revision;
+ }
+
+ //~--- fields ---------------------------------------------------------------
+
+ /** Field description */
+ private String path;
+
+ /** Field description */
+ private String revision;
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/LogCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/LogCommand.java
new file mode 100644
index 0000000000..419cecb93e
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/spi/LogCommand.java
@@ -0,0 +1,68 @@
+/**
+ * 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.spi;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import sonia.scm.repository.Changeset;
+import sonia.scm.repository.ChangesetPagingResult;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public interface LogCommand
+{
+
+ /**
+ * Method description
+ *
+ *
+ * @param id
+ *
+ * @return
+ */
+ public Changeset getChangeset(String id);
+
+ /**
+ * Method description
+ *
+ *
+ * @param request
+ *
+ * @return
+ */
+ public ChangesetPagingResult getChangesets(LogCommandRequest request);
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/LogCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/LogCommandRequest.java
new file mode 100644
index 0000000000..96fc585c6a
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/spi/LogCommandRequest.java
@@ -0,0 +1,326 @@
+/**
+ * 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.spi;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import com.google.common.base.Objects;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.Serializable;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public final class LogCommandRequest implements Serializable, Resetable
+{
+
+ /**
+ * Method description
+ *
+ *
+ * @param obj
+ *
+ * @return
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == null)
+ {
+ return false;
+ }
+
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+
+ final LogCommandRequest other = (LogCommandRequest) obj;
+
+ return Objects.equal(startChangeset, other.startChangeset)
+ && Objects.equal(endChangeset, other.endChangeset)
+ && Objects.equal(pagingStart, other.pagingStart)
+ && Objects.equal(pagingLimit, other.pagingLimit)
+ && Objects.equal(branch, other.branch)
+ && Objects.equal(path, other.path)
+ && Objects.equal(pending, other.pending);
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ @Override
+ public int hashCode()
+ {
+ return Objects.hashCode(startChangeset, endChangeset, pagingStart,
+ pagingLimit, branch, path, pending);
+ }
+
+ /**
+ * Method description
+ *
+ */
+ @Override
+ public void reset()
+ {
+ startChangeset = null;
+ endChangeset = null;
+ pagingStart = 0;
+ pagingLimit = 20;
+ path = null;
+ branch = null;
+ pending = false;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ @Override
+ public String toString()
+ {
+ //J-
+ return Objects.toStringHelper(this)
+ .add("startChangeset", startChangeset)
+ .add("endChangeset", endChangeset)
+ .add("pagingStart", pagingStart)
+ .add("pagingLimit", pagingLimit)
+ .add("branch", branch)
+ .add("path", path)
+ .add("pending", pending)
+ .toString();
+ //J+
+ }
+
+ //~--- set methods ----------------------------------------------------------
+
+ /**
+ * Method description
+ *
+ *
+ * @param branch
+ */
+ public void setBranch(String branch)
+ {
+ this.branch = branch;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @param endChangeset
+ */
+ public void setEndChangeset(String endChangeset)
+ {
+ this.endChangeset = endChangeset;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @param pagingLimit
+ */
+ public void setPagingLimit(int pagingLimit)
+ {
+ this.pagingLimit = pagingLimit;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @param pagingStart
+ */
+ public void setPagingStart(int pagingStart)
+ {
+ this.pagingStart = pagingStart;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @param path
+ */
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @param pending
+ */
+ public void setPending(boolean pending)
+ {
+ this.pending = pending;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @param startChangeset
+ */
+ public void setStartChangeset(String startChangeset)
+ {
+ this.startChangeset = startChangeset;
+ }
+
+ //~--- get methods ----------------------------------------------------------
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ String getBranch()
+ {
+ return branch;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ String getEndChangeset()
+ {
+ return endChangeset;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ int getPagingLimit()
+ {
+ return pagingLimit;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ int getPagingStart()
+ {
+ return pagingStart;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ String getPath()
+ {
+ return path;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ String getStartChangeset()
+ {
+ return startChangeset;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ boolean isPagingUnlimited()
+ {
+ return pagingLimit < 0;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ boolean isPending()
+ {
+ return pending;
+ }
+
+ //~--- fields ---------------------------------------------------------------
+
+ /** Field description */
+ private String branch;
+
+ /** Field description */
+ private String endChangeset;
+
+ /** Field description */
+ private int pagingLimit = 20;
+
+ /** Field description */
+ private int pagingStart = 0;
+
+ /** Field description */
+ private String path;
+
+ /** Field description */
+ private boolean pending = false;
+
+ /** Field description */
+ private String startChangeset;
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceProvider.java b/scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceProvider.java
new file mode 100644
index 0000000000..6944c50e29
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceProvider.java
@@ -0,0 +1,115 @@
+/**
+ * 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.spi;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import sonia.scm.repository.api.Command;
+import sonia.scm.repository.api.CommandNotSupportedException;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.util.Set;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public abstract class RepositoryServiceProvider
+{
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ public abstract Set getSupportedCommands();
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ public BlameCommand getBlameCommand()
+ {
+ throw new CommandNotSupportedException(Command.BLAME);
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ public BrowseCommand getBrowseCommand()
+ {
+ throw new CommandNotSupportedException(Command.BROWSE);
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ public CatCommand getCatCommand()
+ {
+ throw new CommandNotSupportedException(Command.CAT);
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ public DiffCommand getDiffCommand()
+ {
+ throw new CommandNotSupportedException(Command.DIFF);
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ public LogCommand getLogCommand()
+ {
+ throw new CommandNotSupportedException(Command.LOG);
+ }
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceResolver.java b/scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceResolver.java
new file mode 100644
index 0000000000..f0ed4c0814
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceResolver.java
@@ -0,0 +1,59 @@
+/**
+ * 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.spi;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import sonia.scm.plugin.ExtensionPoint;
+import sonia.scm.repository.Repository;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+@ExtensionPoint
+public interface RepositoryServiceResolver
+{
+
+ /**
+ * Method description
+ *
+ *
+ * @param repository
+ *
+ * @return
+ */
+ public RepositoryServiceProvider reslove(Repository repository);
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/Resetable.java b/scm-core/src/main/java/sonia/scm/repository/spi/Resetable.java
new file mode 100644
index 0000000000..e438955c54
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/spi/Resetable.java
@@ -0,0 +1,49 @@
+/**
+ * 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.spi;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ * @since 1.17
+ */
+public interface Resetable
+{
+
+ /**
+ * Method description
+ *
+ */
+ public void reset();
+}
diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/package-info.java b/scm-core/src/main/java/sonia/scm/repository/spi/package-info.java
new file mode 100644
index 0000000000..b6a0c7f646
--- /dev/null
+++ b/scm-core/src/main/java/sonia/scm/repository/spi/package-info.java
@@ -0,0 +1,37 @@
+/**
+ * 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
+ *
+ */
+
+
+
+/**
+ * SPI for repository access. This package is only for service provider.
+ */
+package sonia.scm.repository.spi;