added DiffViewer

This commit is contained in:
Sebastian Sdorra
2011-09-18 10:26:49 +02:00
parent b15235696b
commit 3011c53c27
7 changed files with 201 additions and 20 deletions

View File

@@ -226,6 +226,23 @@ public abstract class AbstractRepositoryHandler<C extends SimpleRepositoryConfig
return config;
}
/**
* Method description
*
*
* @param repository
*
* @return
*
* @throws RepositoryException
*/
@Override
public DiffViewer getDiffViewer(Repository repository)
throws RepositoryException
{
return null;
}
/**
* Method description
*

View File

@@ -28,6 +28,9 @@
* http://bitbucket.org/sdorra/scm-manager
*
*/
package sonia.scm.repository;
/**
@@ -50,5 +53,4 @@ public interface ChangesetViewerProvider
*/
public ChangesetViewer getChangesetViewer(Repository repository)
throws RepositoryException;
}

View File

@@ -0,0 +1,62 @@
/**
* 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;
//~--- JDK imports ------------------------------------------------------------
import java.io.IOException;
import java.io.OutputStream;
/**
*
* @author Sebastian Sdorra
* @since 1.8
*/
public interface DiffViewer
{
/**
* Method description
*
*
* @param revision
* @param path
* @param output
*
* @throws IOException
* @throws RepositoryException
*/
public void getDiff(String revision, String path, OutputStream output)
throws IOException, RepositoryException;
}

View File

@@ -0,0 +1,56 @@
/**
* 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;
/**
*
* @author Sebastian Sdorra
* @since 1.8
*/
public interface DiffViewerProvider
{
/**
* Method description
*
*
*
* @param repository
* @return null if DiffViewer is not supported
*
* @throws RepositoryException
*/
public DiffViewer getDiffViewer(Repository repository)
throws RepositoryException;
}

View File

@@ -59,7 +59,7 @@ public interface RepositoryBrowser
* @throws RepositoryException
*/
public void getContent(String revision, String path, OutputStream output)
throws IOException, RepositoryException;;
throws IOException, RepositoryException;
/**
* Method description

View File

@@ -51,7 +51,7 @@ public interface RepositoryManager
extends TypeManager<Repository, RepositoryException>,
ListenerSupport<RepositoryListener>, RepositoryBrowserProvider,
RepositoryHookSupport, ChangesetViewerProvider,
BlameViewerProvider
BlameViewerProvider, DiffViewerProvider
{
/**

View File

@@ -49,6 +49,7 @@ import sonia.scm.Type;
import sonia.scm.repository.AbstractRepositoryManager;
import sonia.scm.repository.BlameViewer;
import sonia.scm.repository.ChangesetViewer;
import sonia.scm.repository.DiffViewer;
import sonia.scm.repository.PermissionType;
import sonia.scm.repository.PermissionUtil;
import sonia.scm.repository.Repository;
@@ -530,6 +531,32 @@ public class XmlRepositoryManager extends AbstractRepositoryManager
return getAll(null, start, limit);
}
/**
* Method description
*
*
* @param repository
*
* @return
*
* @throws RepositoryException
*/
@Override
public BlameViewer getBlameViewer(Repository repository)
throws RepositoryException
{
AssertUtil.assertIsNotNull(repository);
BlameViewer viewer = null;
if (isReader(repository))
{
viewer = getHandler(repository).getBlameViewer(repository);
}
return viewer;
}
/**
* Method description
*
@@ -550,15 +577,6 @@ public class XmlRepositoryManager extends AbstractRepositoryManager
return getHandler(repository).getChangesetViewer(repository);
}
@Override
public BlameViewer getBlameViewer(Repository repository)
throws RepositoryException
{
AssertUtil.assertIsNotNull(repository);
isReader(repository);
return getHandler(repository).getBlameViewer(repository);
}
/**
* Method description
*
@@ -581,6 +599,32 @@ public class XmlRepositoryManager extends AbstractRepositoryManager
return validTypes;
}
/**
* Method description
*
*
* @param repository
*
* @return
*
* @throws RepositoryException
*/
@Override
public DiffViewer getDiffViewer(Repository repository)
throws RepositoryException
{
AssertUtil.assertIsNotNull(repository);
DiffViewer viewer = null;
if (isReader(repository))
{
viewer = getHandler(repository).getDiffViewer(repository);
}
return viewer;
}
/**
* Method description
*