#8771 Merged Permission endpoints

This commit is contained in:
Mohamed Karray
2018-08-21 10:35:39 +02:00
24 changed files with 855 additions and 444 deletions

View File

@@ -33,24 +33,19 @@
package sonia.scm.repository.api;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.repository.Repository;
import sonia.scm.repository.RepositoryException;
import sonia.scm.repository.spi.CatCommand;
import sonia.scm.repository.spi.CatCommandRequest;
import sonia.scm.util.IOUtil;
//~--- JDK imports ------------------------------------------------------------
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
@@ -106,23 +101,31 @@ public final class CatCommandBuilder
}
/**
* Passes the content of the given file to the outputstream.
* Passes the content of the given file to the output stream.
*
* @param outputStream outputstream for the content
* @param outputStream output stream for the content
* @param path file path
*
* @return {@code this}
*
* @throws IOException
* @throws RepositoryException
*/
public CatCommandBuilder retriveContent(OutputStream outputStream,
String path)
throws IOException, RepositoryException
{
public void retriveContent(OutputStream outputStream, String path) throws IOException, RepositoryException {
getCatResult(outputStream, path);
}
return this;
/**
* Returns an output stream with the file content.
*
* @param path file path
*/
public InputStream getStream(String path) throws IOException, RepositoryException {
Preconditions.checkArgument(!Strings.isNullOrEmpty(path),
"path is required");
CatCommandRequest requestClone = request.clone();
requestClone.setPath(path);
logger.debug("create cat stream for {}", requestClone);
return catCommand.getCatResultStream(requestClone);
}
//~--- get methods ----------------------------------------------------------

View File

@@ -33,13 +33,10 @@
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.repository.RepositoryException;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
@@ -47,19 +44,9 @@ import java.io.OutputStream;
* @author Sebastian Sdorra
* @since 1.17
*/
public interface CatCommand
{
public interface CatCommand {
/**
* Method description
*
*
* @param request
* @param output
*
* @throws IOException
* @throws RepositoryException
*/
public void getCatResult(CatCommandRequest request, OutputStream output)
throws IOException, RepositoryException;
void getCatResult(CatCommandRequest request, OutputStream output) throws IOException, RepositoryException;
InputStream getCatResultStream(CatCommandRequest request) throws IOException, RepositoryException;
}