From 695242883ed403801e30d061be6f3a41ba92d916 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sat, 1 Nov 2014 12:34:16 +0100 Subject: [PATCH] added api for bundle/unbundle command to repository api --- .../repository/api/BundleCommandBuilder.java | 111 ++++++++++++++ .../scm/repository/api/BundleResponse.java | 41 ++++++ .../sonia/scm/repository/api/Command.java | 7 +- .../scm/repository/api/RepositoryService.java | 43 +++++- .../api/UnbundleCommandBuilder.java | 111 ++++++++++++++ .../scm/repository/api/UnbundleResponse.java | 41 ++++++ .../repository/spi/ArchiveCommandRequest.java | 136 ++++++++++++++++++ .../scm/repository/spi/BundleCommand.java | 66 +++++++++ .../repository/spi/BundleCommandRequest.java | 41 ++++++ .../spi/RepositoryServiceProvider.java | 26 ++++ .../scm/repository/spi/UnbundleCommand.java | 66 +++++++++ .../spi/UnbundleCommandRequest.java | 41 ++++++ 12 files changed, 728 insertions(+), 2 deletions(-) create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/BundleCommandBuilder.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/ArchiveCommandRequest.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/BundleCommand.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommand.java create mode 100644 scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommandRequest.java diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BundleCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/BundleCommandBuilder.java new file mode 100644 index 0000000000..f2a2d93ddc --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/BundleCommandBuilder.java @@ -0,0 +1,111 @@ +/** + * 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 org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; +import sonia.scm.repository.spi.BundleCommand; +import sonia.scm.repository.spi.BundleCommandRequest; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public final class BundleCommandBuilder +{ + + /** Field description */ + private static final Logger logger = + LoggerFactory.getLogger(BundleCommandBuilder.class); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param bundleCommand + * @param repository + */ + public BundleCommandBuilder(BundleCommand bundleCommand, + Repository repository) + { + this.bundleCommand = bundleCommand; + this.repository = repository; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @param outputFile + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + public BundleResponse bundle(File outputFile) + throws IOException, RepositoryException + { + BundleCommandRequest request = new BundleCommandRequest(); + + request.setArchive(outputFile); + logger.info("create bundle at {} for repository {}", outputFile, + repository.getId()); + + return bundleCommand.bundle(request); + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private final BundleCommand bundleCommand; + + /** Field description */ + private final Repository repository; +} diff --git a/scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java b/scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java new file mode 100644 index 0000000000..473161963d --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/BundleResponse.java @@ -0,0 +1,41 @@ +/** + * 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; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public class BundleResponse {} 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 index baf228fa94..ccb0d8c2c0 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/Command.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/Command.java @@ -56,5 +56,10 @@ public enum Command /** * @since 1.31 */ - INCOMING, OUTGOING, PUSH, PULL; + INCOMING, OUTGOING, PUSH, PULL, + + /** + * @since 1.43 + */ + BUNDLE, UNBUNDLE; } 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 index 6155174476..5ae4b33c33 100644 --- a/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java +++ b/scm-core/src/main/java/sonia/scm/repository/api/RepositoryService.java @@ -83,6 +83,8 @@ import java.io.IOException; * @apiviz.uses sonia.scm.repository.api.OutgoingCommandBuilder * @apiviz.uses sonia.scm.repository.api.PullCommandBuilder * @apiviz.uses sonia.scm.repository.api.PushCommandBuilder + * @apiviz.uses sonia.scm.repository.api.BundleCommandBuilder + * @apiviz.uses sonia.scm.repository.api.UnbundleCommandBuilder */ public final class RepositoryService implements Closeable { @@ -204,6 +206,25 @@ public final class RepositoryService implements Closeable repository, preProcessorUtil); } + /** + * The bundle command creates an archive from the repository. + * + * @return instance of {@link BundleCommandBuilder} + * @throws CommandNotSupportedException if the command is not supported + * by the implementation of the repository service provider. + * @since 1.43 + */ + public BundleCommandBuilder getBundleCommand() + { + if (logger.isDebugEnabled()) + { + logger.debug("create bundle command for repository {}", + repository.getName()); + } + + return new BundleCommandBuilder(provider.getBundleCommand(), repository); + } + /** * The cat command show the content of a given file. * @@ -370,6 +391,26 @@ public final class RepositoryService implements Closeable repository); } + /** + * The unbundle command restores a repository from the given bundle. + * + * @return instance of {@link UnbundleCommandBuilder} + * @throws CommandNotSupportedException if the command is not supported + * by the implementation of the repository service provider. + * @since 1.43 + */ + public UnbundleCommandBuilder getUnbundleCommand() + { + if (logger.isDebugEnabled()) + { + logger.debug("create bundle command for repository {}", + repository.getName()); + } + + return new UnbundleCommandBuilder(provider.getUnbundleCommand(), + repository); + } + /** * Returns true if the command is supported by the repository service. * @@ -390,7 +431,7 @@ public final class RepositoryService implements Closeable * @param feature feature * * @return true if the feature is supported - * + * * @since 1.25 */ public boolean isSupported(Feature feature) diff --git a/scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java new file mode 100644 index 0000000000..7da034ade9 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleCommandBuilder.java @@ -0,0 +1,111 @@ +/** + * 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 org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import sonia.scm.repository.Repository; +import sonia.scm.repository.RepositoryException; +import sonia.scm.repository.spi.UnbundleCommand; +import sonia.scm.repository.spi.UnbundleCommandRequest; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; +import java.io.IOException; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public final class UnbundleCommandBuilder +{ + + /** Field description */ + private static final Logger logger = + LoggerFactory.getLogger(UnbundleCommandBuilder.class); + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param unbundleCommand + * @param repository + */ + public UnbundleCommandBuilder(UnbundleCommand unbundleCommand, + Repository repository) + { + this.unbundleCommand = unbundleCommand; + this.repository = repository; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @param inputFile + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + public UnbundleResponse unbundle(File inputFile) + throws IOException, RepositoryException + { + UnbundleCommandRequest request = new UnbundleCommandRequest(); + + request.setArchive(inputFile); + + logger.info("unbundle archive {} at {}", inputFile, repository.getId()); + + return unbundleCommand.unbundle(request); + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private final Repository repository; + + /** Field description */ + private final UnbundleCommand unbundleCommand; +} diff --git a/scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java new file mode 100644 index 0000000000..12c8cbff2f --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/api/UnbundleResponse.java @@ -0,0 +1,41 @@ +/** + * 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; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public class UnbundleResponse {} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/ArchiveCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/ArchiveCommandRequest.java new file mode 100644 index 0000000000..478afc6cf0 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/ArchiveCommandRequest.java @@ -0,0 +1,136 @@ +/** + * 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.File; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public abstract class ArchiveCommandRequest +{ + + /** + * Method description + * + * + * @param obj + * + * @return + */ + @Override + public boolean equals(Object obj) + { + if (obj == null) + { + return false; + } + + if (getClass() != obj.getClass()) + { + return false; + } + + final ArchiveCommandRequest other = (ArchiveCommandRequest) obj; + + return Objects.equal(archive, other.archive); + } + + /** + * Method description + * + * + * @return + */ + @Override + public int hashCode() + { + return Objects.hashCode(archive); + } + + /** + * Method description + * + * + * @return + */ + @Override + public String toString() + { + //J- + return Objects.toStringHelper(this) + .add("archive", archive) + .toString(); + //J+ + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + public File getArchive() + { + return archive; + } + + //~--- set methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @param archive + */ + public void setArchive(File archive) + { + this.archive = archive; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private File archive; +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommand.java new file mode 100644 index 0000000000..69cf3be387 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommand.java @@ -0,0 +1,66 @@ +/** +* 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.RepositoryException; +import sonia.scm.repository.api.BundleResponse; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.IOException; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public interface BundleCommand +{ + + /** + * Method description + * + * + * @param request + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + public BundleResponse bundle(BundleCommandRequest request) + throws IOException, RepositoryException;; +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java new file mode 100644 index 0000000000..6ebd054035 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/BundleCommandRequest.java @@ -0,0 +1,41 @@ +/** + * 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.43 + */ +public class BundleCommandRequest extends ArchiveCommandRequest {} 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 index f29af95ef2..02a667237d 100644 --- a/scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceProvider.java +++ b/scm-core/src/main/java/sonia/scm/repository/spi/RepositoryServiceProvider.java @@ -115,6 +115,19 @@ public abstract class RepositoryServiceProvider implements Closeable throw new CommandNotSupportedException(Command.BROWSE); } + /** + * Method description + * + * + * @return + * + * @since 1.43 + */ + public BundleCommand getBundleCommand() + { + throw new CommandNotSupportedException(Command.BUNDLE); + } + /** * Method description * @@ -217,4 +230,17 @@ public abstract class RepositoryServiceProvider implements Closeable { throw new CommandNotSupportedException(Command.TAGS); } + + /** + * Method description + * + * + * @return + * + * @since 1.43 + */ + public UnbundleCommand getUnbundleCommand() + { + throw new CommandNotSupportedException(Command.UNBUNDLE); + } } diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommand.java b/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommand.java new file mode 100644 index 0000000000..5a3ac0b786 --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommand.java @@ -0,0 +1,66 @@ +/** + * 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.RepositoryException; +import sonia.scm.repository.api.UnbundleResponse; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.IOException; + +/** + * + * @author Sebastian Sdorra + * @since 1.43 + */ +public interface UnbundleCommand +{ + + /** + * Method description + * + * + * @param request + * + * @return + * + * @throws IOException + * @throws RepositoryException + */ + public UnbundleResponse unbundle(UnbundleCommandRequest request) + throws IOException, RepositoryException;; +} diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommandRequest.java new file mode 100644 index 0000000000..57400d0f9a --- /dev/null +++ b/scm-core/src/main/java/sonia/scm/repository/spi/UnbundleCommandRequest.java @@ -0,0 +1,41 @@ +/** + * 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.43 + */ +public class UnbundleCommandRequest extends ArchiveCommandRequest {}