added api for repositorybrowser

This commit is contained in:
Sebastian Sdorra
2011-06-12 14:47:34 +02:00
parent 920864b855
commit 2c3c66241f
8 changed files with 567 additions and 2 deletions

View File

@@ -211,6 +211,21 @@ public abstract class AbstractRepositoryHandler<C extends SimpleRepositoryConfig
return config;
}
/**
* Method description
*
*
* @param repository
*
* @return
* @since 1.5
*/
@Override
public RepositoryBrowser getRepositoryBrowser(Repository repository)
{
return null;
}
/**
* Method description
*

View File

@@ -0,0 +1,176 @@
/**
* 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;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author Sebastian Sdorra
* @since 1.5
*/
@XmlRootElement(name="browser-result")
public class BrowserResult
{
/**
* Constructs ...
*
*/
public BrowserResult() {}
/**
* Constructs ...
*
*
* @param revision
* @param tag
* @param branch
* @param file
*/
public BrowserResult(String revision, String tag, String branch,
FileObject file)
{
this.revision = revision;
this.tag = tag;
this.branch = branch;
this.file = file;
}
//~--- get methods ----------------------------------------------------------
/**
* Method description
*
*
* @return
*/
public String getBranch()
{
return branch;
}
/**
* Method description
*
*
* @return
*/
public FileObject getFile()
{
return file;
}
/**
* Method description
*
*
* @return
*/
public String getRevision()
{
return revision;
}
/**
* Method description
*
*
* @return
*/
public String getTag()
{
return tag;
}
//~--- set methods ----------------------------------------------------------
/**
* Method description
*
*
* @param branch
*/
public void setBranch(String branch)
{
this.branch = branch;
}
/**
* Method description
*
*
* @param file
*/
public void setFile(FileObject file)
{
this.file = file;
}
/**
* Method description
*
*
* @param revision
*/
public void setRevision(String revision)
{
this.revision = revision;
}
/**
* Method description
*
*
* @param tag
*/
public void setTag(String tag)
{
this.tag = tag;
}
//~--- fields ---------------------------------------------------------------
/** Field description */
private String branch;
/** Field description */
private FileObject file;
/** Field description */
private String revision;
/** Field description */
private String tag;
}

View File

@@ -0,0 +1,231 @@
/**
* 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;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.LastModifiedAware;
//~--- JDK imports ------------------------------------------------------------
import java.util.Iterator;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author Sebastian Sdorra
* @since 1.5
*/
@XmlRootElement(name = "file")
public class FileObject implements LastModifiedAware, Iterable<FileObject>
{
/**
* Method description
*
*
* @return
*/
@Override
public Iterator<FileObject> iterator()
{
Iterator<FileObject> iterator = null;
if (children != null)
{
iterator = children.iterator();
}
return iterator;
}
//~--- get methods ----------------------------------------------------------
/**
* Method description
*
*
* @return
*/
public List<FileObject> getChildren()
{
return children;
}
/**
* Method description
*
*
* @return
*/
@Override
public Long getLastModified()
{
return lastModified;
}
/**
* Method description
*
*
* @return
*/
public long getLength()
{
return length;
}
/**
* Method description
*
*
* @return
*/
public String getName()
{
return name;
}
/**
* Method description
*
*
* @return
*/
public String getPath()
{
return path;
}
/**
* Method description
*
*
* @return
*/
public boolean isDirectory()
{
return directory;
}
//~--- set methods ----------------------------------------------------------
/**
* Method description
*
*
* @param children
*/
public void setChildren(List<FileObject> children)
{
this.children = children;
}
/**
* Method description
*
*
* @param directory
*/
public void setDirectory(boolean directory)
{
this.directory = directory;
}
/**
* Method description
*
*
* @param lastModified
*/
public void setLastModified(Long lastModified)
{
this.lastModified = lastModified;
}
/**
* Method description
*
*
* @param length
*/
public void setLength(long length)
{
this.length = length;
}
/**
* Method description
*
*
* @param name
*/
public void setName(String name)
{
this.name = name;
}
/**
* Method description
*
*
* @param path
*/
public void setPath(String path)
{
this.path = path;
}
//~--- fields ---------------------------------------------------------------
/** Field description */
private List<FileObject> children;
/** Field description */
private boolean directory;
/** Field description */
private Long lastModified;
/** Field description */
private long length;
/** Field description */
private String name;
/** Field description */
private String path;
}

View File

@@ -0,0 +1,65 @@
/**
* 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;
/**
*
* @author Sebastian Sdorra
* @since 1.5
*/
public interface RepositoryBrowser
{
/**
* Method description
*
*
* @param revision
* @param tag
* @param branch
* @param path
*
* @return
*
* @throws IOException
* @throws RepositoryException
*/
public BrowserResult getResult(String revision, String tag, String branch,
String path)
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.5
*/
public interface RepositoryBrowserProvider
{
/**
* Method description
*
*
* @param repository
*
* @return null if RepositoryBrowser is not supported
*
* @throws RepositoryException
*/
public RepositoryBrowser getRepositoryBrowser(Repository repository)
throws RepositoryException;
}

View File

@@ -47,7 +47,8 @@ import sonia.scm.plugin.ExtensionPoint;
@ExtensionPoint
public interface RepositoryHandler
extends Handler<Repository, RepositoryException>,
ListenerSupport<ConfigChangedListener>
ListenerSupport<ConfigChangedListener>,
RepositoryBrowserProvider
{
/**

View File

@@ -49,7 +49,7 @@ import java.util.Collection;
*/
public interface RepositoryManager
extends TypeManager<Repository, RepositoryException>,
ListenerSupport<RepositoryListener>
ListenerSupport<RepositoryListener>, RepositoryBrowserProvider
{
/**