This commit is contained in:
Sebastian Sdorra
2014-11-02 17:31:06 +01:00
parent 38c0e357e2
commit 1b7ab0a35d
8 changed files with 70 additions and 78 deletions

View File

@@ -57,6 +57,9 @@ import java.io.IOException;
import java.io.OutputStream;
/**
* 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
* {@link UnbundleCommandBuilder}.
*
* @author Sebastian Sdorra <s.sdorra@gmail.com>
* @since 1.43
@@ -64,21 +67,20 @@ import java.io.OutputStream;
public final class BundleCommandBuilder
{
/** Field description */
/** logger for BundleCommandBuilder */
private static final Logger logger =
LoggerFactory.getLogger(BundleCommandBuilder.class);
//~--- constructors ---------------------------------------------------------
/**
* Constructs ...
* Constructs a new {@link BundleCommandBuilder}.
*
*
* @param bundleCommand
* @param repository
* @param bundleCommand bundle command implementation
* @param repository repository
*/
public BundleCommandBuilder(BundleCommand bundleCommand,
Repository repository)
BundleCommandBuilder(BundleCommand bundleCommand, Repository repository)
{
this.bundleCommand = bundleCommand;
this.repository = repository;
@@ -87,12 +89,11 @@ public final class BundleCommandBuilder
//~--- methods --------------------------------------------------------------
/**
* Method description
* Dumps the repository to the given {@link File}.
*
* @param outputFile output file
*
* @param outputFile
*
* @return
* @return bundle response
*
* @throws IOException
* @throws RepositoryException
@@ -113,12 +114,12 @@ public final class BundleCommandBuilder
}
/**
* Method description
* Dumps the repository to the given {@link OutputStream}.
*
*
* @param outputStream
* @param outputStream output stream
*
* @return
* @return bundle response
*
* @throws IOException
* @throws RepositoryException
@@ -135,12 +136,11 @@ public final class BundleCommandBuilder
}
/**
* Method description
* Dumps the repository to the given {@link ByteSink}.
*
* @param sink byte sink
*
* @param sink
*
* @return
* @return bundle response
*
* @throws IOException
* @throws RepositoryException
@@ -155,12 +155,12 @@ public final class BundleCommandBuilder
}
/**
* Method description
* Converts an {@link OutputStream} into a {@link ByteSink}.
*
*
* @param outputStream
* @param outputStream ouput stream to convert
*
* @return
* @return converted byte sink
*/
private ByteSink asByteSink(final OutputStream outputStream)
{
@@ -177,9 +177,9 @@ public final class BundleCommandBuilder
//~--- fields ---------------------------------------------------------------
/** Field description */
/** bundle command implementation */
private final BundleCommand bundleCommand;
/** Field description */
/** repository */
private final Repository repository;
}

View File

@@ -34,6 +34,7 @@
package sonia.scm.repository.api;
/**
* Response of {@link BundleCommandBuilder}.
*
* @author Sebastian Sdorra <s.sdorra@gmail.com>
* @since 1.43

View File

@@ -57,6 +57,8 @@ import java.io.IOException;
import java.io.InputStream;
/**
* The unbundle command can restore an empty repository from a bundle. The
* bundle can be created with the {@link BundleCommandBuilder}.
*
* @author Sebastian Sdorra <s.sdorra@gmail.com>
* @since 1.43
@@ -64,18 +66,18 @@ import java.io.InputStream;
public final class UnbundleCommandBuilder
{
/** Field description */
/** logger for UnbundleCommandBuilder */
private static final Logger logger =
LoggerFactory.getLogger(UnbundleCommandBuilder.class);
//~--- constructors ---------------------------------------------------------
/**
* Constructs ...
* Constructs a new UnbundleCommandBuilder.
*
*
* @param unbundleCommand
* @param repository
* @param unbundleCommand unbundle command implementation
* @param repository repository
*/
public UnbundleCommandBuilder(UnbundleCommand unbundleCommand,
Repository repository)
@@ -87,12 +89,12 @@ public final class UnbundleCommandBuilder
//~--- methods --------------------------------------------------------------
/**
* Method description
* Restores the repository from the given bundle.
*
*
* @param inputFile
* @param inputFile input file
*
* @return
* @return unbundle response
*
* @throws IOException
* @throws RepositoryException
@@ -112,12 +114,12 @@ public final class UnbundleCommandBuilder
}
/**
* Method description
* Restores the repository from the given bundle.
*
*
* @param inputStream
* @param inputStream input stream
*
* @return
* @return unbundle response
*
* @throws IOException
* @throws RepositoryException
@@ -133,12 +135,12 @@ public final class UnbundleCommandBuilder
}
/**
* Method description
* Restores the repository from the given bundle.
*
*
* @param byteSource
* @param byteSource byte source
*
* @return
* @return unbundle response
*
* @throws IOException
* @throws RepositoryException
@@ -153,12 +155,12 @@ public final class UnbundleCommandBuilder
}
/**
* Method description
* Converts an {@link InputStream} into a {@link ByteSource}.
*
*
* @param inputStream
* @param inputStream input stream
*
* @return
* @return byte source
*/
private ByteSource asByteSource(final InputStream inputStream)
{
@@ -175,9 +177,9 @@ public final class UnbundleCommandBuilder
//~--- fields ---------------------------------------------------------------
/** Field description */
/** repository */
private final Repository repository;
/** Field description */
/** unbundle command implementation */
private final UnbundleCommand unbundleCommand;
}

View File

@@ -34,6 +34,7 @@
package sonia.scm.repository.api;
/**
* Response of {@link UnbundleCommandBuilder}.
*
* @author Sebastian Sdorra <s.sdorra@gmail.com>
* @since 1.43

View File

@@ -43,6 +43,7 @@ import sonia.scm.repository.api.BundleResponse;
import java.io.IOException;
/**
* Service provider implementation for the bundle command.
*
* @author Sebastian Sdorra <s.sdorra@gmail.com>
* @since 1.43
@@ -51,16 +52,16 @@ public interface BundleCommand
{
/**
* Method description
* The bundle command dumps a repository to a byte source such as a file.
*
*
* @param request
* @param request bundle command request
*
* @return
* @return bundle response
*
* @throws IOException
* @throws RepositoryException
*/
public BundleResponse bundle(BundleCommandRequest request)
throws IOException, RepositoryException;;
throws IOException, RepositoryException;
}

View File

@@ -39,6 +39,7 @@ import com.google.common.base.Objects;
import com.google.common.io.ByteSink;
/**
* Request for the bundle command.
*
* @author Sebastian Sdorra <s.sdorra@gmail.com>
* @since 1.43
@@ -47,10 +48,10 @@ public final class BundleCommandRequest
{
/**
* Constructs ...
* Constructs a new bundle command request.
*
*
* @param archive
* @param archive byte sink archive
*/
public BundleCommandRequest(ByteSink archive)
{
@@ -60,12 +61,7 @@ public final class BundleCommandRequest
//~--- methods --------------------------------------------------------------
/**
* Method description
*
*
* @param obj
*
* @return
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj)
@@ -86,10 +82,7 @@ public final class BundleCommandRequest
}
/**
* Method description
*
*
* @return
* {@inheritDoc}
*/
@Override
public int hashCode()
@@ -100,10 +93,10 @@ public final class BundleCommandRequest
//~--- get methods ----------------------------------------------------------
/**
* Method description
* Returns the archive as {@link ByteSink}.
*
*
* @return
* @return {@link ByteSink} archive.
*/
ByteSink getArchive()
{
@@ -112,6 +105,6 @@ public final class BundleCommandRequest
//~--- fields ---------------------------------------------------------------
/** Field description */
/** byte sink archive */
private final ByteSink archive;
}

View File

@@ -43,6 +43,7 @@ import sonia.scm.repository.api.UnbundleResponse;
import java.io.IOException;
/**
* Service provider implementation for the unbundle command.
*
* @author Sebastian Sdorra <s.sdorra@gmail.com>
* @since 1.43
@@ -51,16 +52,16 @@ public interface UnbundleCommand
{
/**
* Method description
* The unbundle command can restore an empty repository from a bundle.
*
*
* @param request
* @param request unbundle request
*
* @return
* @return unbundle response
*
* @throws IOException
* @throws RepositoryException
*/
public UnbundleResponse unbundle(UnbundleCommandRequest request)
throws IOException, RepositoryException;;
throws IOException, RepositoryException;
}

View File

@@ -39,6 +39,7 @@ import com.google.common.base.Objects;
import com.google.common.io.ByteSource;
/**
* Request object for the unbundle command.
*
* @author Sebastian Sdorra <s.sdorra@gmail.com>
* @since 1.43
@@ -47,10 +48,10 @@ public final class UnbundleCommandRequest
{
/**
* Constructs ...
* Constructs a new unbundle command request.
*
*
* @param archive
* @param archive byte source archive
*/
public UnbundleCommandRequest(ByteSource archive)
{
@@ -60,12 +61,7 @@ public final class UnbundleCommandRequest
//~--- methods --------------------------------------------------------------
/**
* Method description
*
*
* @param obj
*
* @return
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj)
@@ -86,10 +82,7 @@ public final class UnbundleCommandRequest
}
/**
* Method description
*
*
* @return
* {@inheritDoc}
*/
@Override
public int hashCode()
@@ -100,10 +93,10 @@ public final class UnbundleCommandRequest
//~--- get methods ----------------------------------------------------------
/**
* Method description
* Returns the archive as {@link ByteSource}.
*
*
* @return
* @return {@link ByteSource} archive
*/
ByteSource getArchive()
{
@@ -112,6 +105,6 @@ public final class UnbundleCommandRequest
//~--- fields ---------------------------------------------------------------
/** Field description */
/** byte source archive */
private final ByteSource archive;
}