fix broken build

This commit is contained in:
Sebastian Sdorra
2011-09-15 13:27:02 +02:00
parent 158d3552c3
commit 5daade4f7b
2 changed files with 71 additions and 37 deletions

View File

@@ -46,6 +46,10 @@ import sonia.scm.cache.Cache;
import sonia.scm.cache.CacheManager; import sonia.scm.cache.CacheManager;
import sonia.scm.util.AssertUtil; import sonia.scm.util.AssertUtil;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
/** /**
* Class description * Class description
* *
@@ -95,12 +99,14 @@ public class BlameViewerUtil extends CacheClearHook
* *
* @return * @return
* *
*
* @throws IOException
* @throws NotSupportedFeatuerException * @throws NotSupportedFeatuerException
* @throws RepositoryException * @throws RepositoryException
*/ */
public BlamePagingResult getBlame(String repositoryId, String revision, public BlamePagingResult getBlame(String repositoryId, String revision,
String path) String path)
throws RepositoryException, NotSupportedFeatuerException throws RepositoryException, NotSupportedFeatuerException, IOException
{ {
AssertUtil.assertIsNotEmpty(repositoryId); AssertUtil.assertIsNotEmpty(repositoryId);
@@ -125,12 +131,14 @@ public class BlameViewerUtil extends CacheClearHook
* *
* @return * @return
* *
*
* @throws IOException
* @throws NotSupportedFeatuerException * @throws NotSupportedFeatuerException
* @throws RepositoryException * @throws RepositoryException
*/ */
public BlamePagingResult getBlame(Repository repository, String revision, public BlamePagingResult getBlame(Repository repository, String revision,
String path) String path)
throws RepositoryException, NotSupportedFeatuerException throws RepositoryException, NotSupportedFeatuerException, IOException
{ {
AssertUtil.assertIsNotNull(repository); AssertUtil.assertIsNotNull(repository);

View File

@@ -113,6 +113,7 @@ public class RepositoryResource
* @param securityContextProvider * @param securityContextProvider
* @param changesetViewerUtil * @param changesetViewerUtil
* @param repositoryBrowserUtil * @param repositoryBrowserUtil
* @param blameViewerUtil
*/ */
@Inject @Inject
public RepositoryResource( public RepositoryResource(
@@ -132,6 +133,62 @@ public class RepositoryResource
setDisableCache(false); setDisableCache(false);
} }
//~--- methods --------------------------------------------------------------
/**
* Method description
*
*
* @param id
* @param revision
* @param path
*
* @return
*
* @throws IOException
* @throws RepositoryException
*/
@GET
@Path("{id}/blame")
public Response blame(@PathParam("id") String id,
@QueryParam("revision") String revision,
@QueryParam("path") String path)
throws RepositoryException, IOException
{
Response response = null;
try
{
AssertUtil.assertIsNotNull(path);
BlamePagingResult blamePagingResult = blameViewerUtil.getBlame(id,
revision, path);
if (blamePagingResult != null)
{
response = Response.ok(blamePagingResult).build();
}
else
{
response = Response.ok().build();
}
}
catch (IllegalStateException ex)
{
response = Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
catch (RepositoryNotFoundException ex)
{
response = Response.status(Response.Status.NOT_FOUND).build();
}
catch (NotSupportedFeatuerException ex)
{
response = Response.status(Response.Status.BAD_REQUEST).build();
}
return response;
}
//~--- get methods ---------------------------------------------------------- //~--- get methods ----------------------------------------------------------
/** /**
@@ -230,37 +287,6 @@ public class RepositoryResource
return response; return response;
} }
@GET
@Path("{id}/blame")
public Response blame(@PathParam("id") String id,
@QueryParam("revision") String revision,
@QueryParam("path") String path)
{
Response response = null;
try {
AssertUtil.assertIsNotNull(path);
BlamePagingResult blamePagingResult = blameViewerUtil.getBlame(id, revision, path);
if (blamePagingResult != null) {
response = Response.ok(blamePagingResult).build();
}
else
{
response = Response.ok().build();
}
} catch (IllegalStateException ex) {
response = Response.status(Response.Status.NOT_FOUND).build();
} catch (RepositoryException ex) {
response = Response.status(Response.Status.NOT_FOUND).build();
} catch (NotSupportedFeatuerException ex) {
response = Response.status(Response.Status.BAD_REQUEST).build();
}
return response;
}
/** /**
* Method description * Method description
* *
@@ -540,6 +566,9 @@ public class RepositoryResource
//~--- fields --------------------------------------------------------------- //~--- fields ---------------------------------------------------------------
/** Field description */
private BlameViewerUtil blameViewerUtil;
/** Field description */ /** Field description */
private ChangesetViewerUtil changesetViewerUtil; private ChangesetViewerUtil changesetViewerUtil;
@@ -549,9 +578,6 @@ public class RepositoryResource
/** Field description */ /** Field description */
private RepositoryBrowserUtil repositoryBrowserUtil; private RepositoryBrowserUtil repositoryBrowserUtil;
/** Field description */
private BlameViewerUtil blameViewerUtil;
/** Field description */ /** Field description */
private RepositoryManager repositoryManager; private RepositoryManager repositoryManager;