added exceptions to repository client api

This commit is contained in:
Sebastian Sdorra
2012-07-14 16:25:21 +02:00
parent 5dbce7037d
commit 55e5b1eb54
15 changed files with 120 additions and 18 deletions

View File

@@ -33,6 +33,7 @@ package sonia.scm.repository.client.api;
//~--- non-JDK imports --------------------------------------------------------
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -78,7 +79,7 @@ public final class AddCommandBuilder
*
* @return
*/
public AddCommandBuilder add(String path, String... pathes)
public AddCommandBuilder add(String path, String... pathes) throws IOException
{
add(path);
@@ -99,7 +100,7 @@ public final class AddCommandBuilder
*
* @param path
*/
private void add(String path)
private void add(String path) throws IOException
{
if (Util.isNotEmpty(path))
{

View File

@@ -33,6 +33,7 @@ package sonia.scm.repository.client.api;
//~--- non-JDK imports --------------------------------------------------------
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -75,7 +76,7 @@ public final class BranchCommandBuilder
*
* @return
*/
public BranchCommandBuilder branch(String name)
public BranchCommandBuilder branch(String name) throws IOException
{
if (logger.isDebugEnabled())
{

View File

@@ -34,6 +34,7 @@ package sonia.scm.repository.client.api;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.collect.Lists;
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -97,7 +98,7 @@ public final class CommitCommandBuilder
*
* @return
*/
public Changeset commit(String author, String message)
public Changeset commit(String author, String message) throws IOException
{
request.setAuthor(author);
request.setMessage(message);

View File

@@ -33,6 +33,7 @@ package sonia.scm.repository.client.api;
//~--- non-JDK imports --------------------------------------------------------
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -71,7 +72,7 @@ public final class PushCommandBuilder
* Method description
*
*/
public void push()
public void push() throws IOException
{
if (logger.isDebugEnabled())
{

View File

@@ -33,6 +33,7 @@ package sonia.scm.repository.client.api;
//~--- non-JDK imports --------------------------------------------------------
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -78,7 +79,7 @@ public final class RemoveCommandBuilder
*
* @return
*/
public RemoveCommandBuilder remove(String path, String... pathes)
public RemoveCommandBuilder remove(String path, String... pathes) throws IOException
{
remove(path);
@@ -99,7 +100,7 @@ public final class RemoveCommandBuilder
*
* @param path
*/
private void remove(String path)
private void remove(String path) throws IOException
{
if (Util.isNotEmpty(path))
{

View File

@@ -0,0 +1,85 @@
/**
* 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.client.api;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
/**
*
* @author Sebastian Sdorra
* @since 1.18
*/
public final class RepositoryClientException extends IOException
{
/**
* Constructs ...
*
*/
public RepositoryClientException() {}
/**
* Constructs ...
*
*
* @param message
*/
public RepositoryClientException(String message)
{
super(message);
}
/**
* Constructs ...
*
*
* @param cause
*/
public RepositoryClientException(Throwable cause)
{
super(cause);
}
/**
* Constructs ...
*
*
* @param message
* @param cause
*/
public RepositoryClientException(String message, Throwable cause)
{
super(message, cause);
}
}

View File

@@ -38,6 +38,7 @@ import sonia.scm.repository.client.spi.RepositoryClientFactoryProvider;
//~--- JDK imports ------------------------------------------------------------
import java.io.File;
import java.io.IOException;
/**
*
@@ -69,7 +70,7 @@ public final class RepositoryClientFactory
*
* @return
*/
public RepositoryClient create(File main, File workingCopy)
public RepositoryClient create(File main, File workingCopy) throws IOException
{
return new RepositoryClient(provider.create(main, workingCopy));
@@ -87,7 +88,7 @@ public final class RepositoryClientFactory
* @return
*/
public RepositoryClient create(String url, String username, String password,
File workingCopy)
File workingCopy) throws IOException
{
return new RepositoryClient(provider.create(url, username, password,
workingCopy));

View File

@@ -33,6 +33,7 @@ package sonia.scm.repository.client.api;
//~--- non-JDK imports --------------------------------------------------------
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -77,7 +78,7 @@ public final class TagCommandBuilder
*
* @return
*/
public Tag tag(String name)
public Tag tag(String name) throws IOException
{
request.setName(name);

View File

@@ -31,6 +31,8 @@
package sonia.scm.repository.client.spi;
import java.io.IOException;
/**
*
* @author Sebastian Sdorra
@@ -47,5 +49,5 @@ public interface AddCommand
*
* @param file
*/
public void add(String path);
public void add(String path) throws IOException;
}

View File

@@ -28,6 +28,7 @@
*/
package sonia.scm.repository.client.spi;
import java.io.IOException;
import sonia.scm.repository.Branch;
/**
@@ -37,5 +38,5 @@ import sonia.scm.repository.Branch;
*/
public interface BranchCommand
{
public Branch branch(String name);
public Branch branch(String name) throws IOException;
}

View File

@@ -33,6 +33,7 @@ package sonia.scm.repository.client.spi;
//~--- non-JDK imports --------------------------------------------------------
import java.io.IOException;
import sonia.scm.repository.Changeset;
/**
@@ -51,5 +52,5 @@ public interface CommitCommand
*
* @return
*/
public Changeset commit(CommitRequest request);
public Changeset commit(CommitRequest request) throws IOException;
}

View File

@@ -31,6 +31,8 @@
package sonia.scm.repository.client.spi;
import java.io.IOException;
/**
*
* @author Sebastian Sdorra
@@ -43,5 +45,5 @@ public interface PushCommand
* Method description
*
*/
public void push();
public void push() throws IOException;
}

View File

@@ -31,6 +31,8 @@
package sonia.scm.repository.client.spi;
import java.io.IOException;
/**
*
* @author Sebastian Sdorra
@@ -47,5 +49,5 @@ public interface RemoveCommand
*
* @param path
*/
public void remove(String path);
public void remove(String path) throws IOException;
}

View File

@@ -34,6 +34,7 @@ package sonia.scm.repository.client.spi;
//~--- JDK imports ------------------------------------------------------------
import java.io.File;
import java.io.IOException;
/**
*
@@ -52,7 +53,7 @@ public interface RepositoryClientFactoryProvider
*
* @return
*/
public RepositoryClientProvider create(File main, File workingCopy);
public RepositoryClientProvider create(File main, File workingCopy) throws IOException;
/**
* Method description
@@ -66,5 +67,5 @@ public interface RepositoryClientFactoryProvider
* @return
*/
public RepositoryClientProvider create(String url, String username,
String password, File workingCopy);
String password, File workingCopy) throws IOException;
}

View File

@@ -33,6 +33,7 @@ package sonia.scm.repository.client.spi;
//~--- non-JDK imports --------------------------------------------------------
import java.io.IOException;
import sonia.scm.repository.Tag;
/**
@@ -51,5 +52,5 @@ public interface TagCommand
*
* @return
*/
public Tag tag(TagRequest request);
public Tag tag(TagRequest request) throws IOException;
}