From 01549f346db3219608c8b265907a581976374b5d Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 1 Jul 2011 14:47:25 +0200 Subject: [PATCH] move scm-svn-plugin to its own repository https://bitbucket.org/sdorra/scm-svn-plugin --- plugins/pom.xml | 1 - plugins/scm-svn-plugin/pom.xml | 60 ---- .../api/rest/resources/SvnConfigResource.java | 125 -------- .../sonia/scm/repository/Compatibility.java | 105 ------- .../scm/repository/SvnChangesetViewer.java | 207 ------------- .../java/sonia/scm/repository/SvnConfig.java | 81 ----- .../scm/repository/SvnRepositoryBrowser.java | 290 ------------------ .../scm/repository/SvnRepositoryHandler.java | 227 -------------- .../main/java/sonia/scm/web/SvnDAVConfig.java | 240 --------------- .../java/sonia/scm/web/SvnDAVServlet.java | 89 ------ .../sonia/scm/web/SvnPermissionFilter.java | 114 ------- .../java/sonia/scm/web/SvnServletModule.java | 80 ----- .../main/resources/META-INF/scm/plugin.xml | 63 ---- .../main/resources/sonia/scm/svn.config.js | 124 -------- .../repository/SvnRepositoryHandlerTest.java | 99 ------ 15 files changed, 1905 deletions(-) delete mode 100644 plugins/scm-svn-plugin/pom.xml delete mode 100644 plugins/scm-svn-plugin/src/main/java/sonia/scm/api/rest/resources/SvnConfigResource.java delete mode 100644 plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/Compatibility.java delete mode 100644 plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnChangesetViewer.java delete mode 100644 plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnConfig.java delete mode 100644 plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryBrowser.java delete mode 100644 plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHandler.java delete mode 100644 plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnDAVConfig.java delete mode 100644 plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnDAVServlet.java delete mode 100644 plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnPermissionFilter.java delete mode 100644 plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnServletModule.java delete mode 100644 plugins/scm-svn-plugin/src/main/resources/META-INF/scm/plugin.xml delete mode 100644 plugins/scm-svn-plugin/src/main/resources/sonia/scm/svn.config.js delete mode 100644 plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/SvnRepositoryHandlerTest.java diff --git a/plugins/pom.xml b/plugins/pom.xml index c639d49e74..32730acaea 100644 --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -17,7 +17,6 @@ scm-hg-plugin - scm-svn-plugin scm-git-plugin scm-activedirectory-auth-plugin scm-auth-ldap-plugin diff --git a/plugins/scm-svn-plugin/pom.xml b/plugins/scm-svn-plugin/pom.xml deleted file mode 100644 index 4b1e1b7a3c..0000000000 --- a/plugins/scm-svn-plugin/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - 4.0.0 - - - scm-plugins - sonia.scm.plugins - 1.5-SNAPSHOT - - - sonia.scm.plugins - scm-svn-plugin - 1.5-SNAPSHOT - scm-svn-plugin - https://bitbucket.org/sdorra/scm-manager - Plugin for the version control system Subversion - - - - - javax.servlet - servlet-api - ${servlet.version} - provided - - - - org.tmatesoft.svnkit - svnkit-dav - ${svnkit-dav.version} - - - trilead-ssh2 - org.tmatesoft.svnkit - - - sqljet - org.tmatesoft.sqljet - - - - - - - - sonia.scm - scm-test - 1.5-SNAPSHOT - test - - - - - - 1.3.5.4 - - - diff --git a/plugins/scm-svn-plugin/src/main/java/sonia/scm/api/rest/resources/SvnConfigResource.java b/plugins/scm-svn-plugin/src/main/java/sonia/scm/api/rest/resources/SvnConfigResource.java deleted file mode 100644 index cf824bcb46..0000000000 --- a/plugins/scm-svn-plugin/src/main/java/sonia/scm/api/rest/resources/SvnConfigResource.java +++ /dev/null @@ -1,125 +0,0 @@ -/** - * 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.api.rest.resources; - -//~--- non-JDK imports -------------------------------------------------------- - -import com.google.inject.Inject; -import com.google.inject.Singleton; - -import sonia.scm.repository.RepositoryManager; -import sonia.scm.repository.SvnConfig; -import sonia.scm.repository.SvnRepositoryHandler; - -//~--- JDK imports ------------------------------------------------------------ - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; - -/** - * - * @author Sebastian Sdorra - */ -@Singleton -@Path("config/repositories/svn") -@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) -public class SvnConfigResource -{ - - /** - * Constructs ... - * - * - * @param repositoryManager - */ - @Inject - public SvnConfigResource(RepositoryManager repositoryManager) - { - repositoryHandler = (SvnRepositoryHandler) repositoryManager.getHandler( - SvnRepositoryHandler.TYPE_NAME); - } - - //~--- get methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @return - */ - @GET - public SvnConfig getConfig() - { - SvnConfig config = repositoryHandler.getConfig(); - - if (config == null) - { - config = new SvnConfig(); - repositoryHandler.setConfig(config); - } - - return config; - } - - //~--- set methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @param uriInfo - * @param config - * - * @return - */ - @POST - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public Response setConfig(@Context UriInfo uriInfo, SvnConfig config) - { - repositoryHandler.setConfig(config); - repositoryHandler.storeConfig(); - - return Response.created(uriInfo.getRequestUri()).build(); - } - - //~--- fields --------------------------------------------------------------- - - /** Field description */ - private SvnRepositoryHandler repositoryHandler; -} diff --git a/plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/Compatibility.java b/plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/Compatibility.java deleted file mode 100644 index 3ff8438725..0000000000 --- a/plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/Compatibility.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * 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 - */ -public enum Compatibility -{ - NONE(false, false, false), PRE14(true, true, true), PRE15(false, true, true), - PRE16(false, false, true); - - /** - * Field description - * - * @param pre14Compatible - * @param pre15Compatible - * @param pre16Compatible - */ - private Compatibility(boolean pre14Compatible, boolean pre15Compatible, - boolean pre16Compatible) - { - this.pre14Compatible = pre14Compatible; - this.pre15Compatible = pre15Compatible; - this.pre16Compatible = pre16Compatible; - } - - //~--- get methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @return - */ - public boolean isPre14Compatible() - { - return pre14Compatible; - } - - /** - * Method description - * - * - * @return - */ - public boolean isPre15Compatible() - { - return pre15Compatible; - } - - /** - * Method description - * - * - * @return - */ - public boolean isPre16Compatible() - { - return pre16Compatible; - } - - //~--- fields --------------------------------------------------------------- - - /** Field description */ - private boolean pre14Compatible; - - /** Field description */ - private boolean pre15Compatible; - - /** Field description */ - private boolean pre16Compatible; -} diff --git a/plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnChangesetViewer.java b/plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnChangesetViewer.java deleted file mode 100644 index b68c2260b6..0000000000 --- a/plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnChangesetViewer.java +++ /dev/null @@ -1,207 +0,0 @@ -/** - * 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 org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.tmatesoft.svn.core.SVNException; -import org.tmatesoft.svn.core.SVNLogEntry; -import org.tmatesoft.svn.core.SVNLogEntryPath; -import org.tmatesoft.svn.core.SVNURL; -import org.tmatesoft.svn.core.io.SVNRepository; -import org.tmatesoft.svn.core.io.SVNRepositoryFactory; - -import sonia.scm.util.Util; - -//~--- JDK imports ------------------------------------------------------------ - -import java.io.File; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; - -/** - * - * @author Sebastian Sdorra - */ -public class SvnChangesetViewer implements ChangesetViewer -{ - - /** the logger for SvnChangesetViewer */ - private static final Logger logger = - LoggerFactory.getLogger(SvnChangesetViewer.class); - - //~--- constructors --------------------------------------------------------- - - /** - * Constructs ... - * - * - * @param handler - * @param repostory - */ - public SvnChangesetViewer(SvnRepositoryHandler handler, Repository repostory) - { - this.handler = handler; - this.repostory = repostory; - } - - //~--- get methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @param start - * @param max - * - * @return - */ - @Override - public ChangesetPagingResult getChangesets(int start, int max) - { - ChangesetPagingResult changesets = null; - File directory = handler.getDirectory(repostory); - SVNRepository repository = null; - - try - { - repository = SVNRepositoryFactory.create(SVNURL.fromFile(directory)); - - long total = repository.getLatestRevision(); - long startRev = total - start; - long endRev = total - start - (max - 1); - - if (endRev < 0) - { - endRev = 0; - } - - List changesetList = new ArrayList(); - Collection entries = repository.log(new String[] { "" }, - null, startRev, endRev, true, true); - - for (SVNLogEntry entry : entries) - { - changesetList.add(createChangeset(entry)); - } - - changesets = new ChangesetPagingResult((int) total, changesetList); - } - catch (SVNException ex) - { - logger.error("could not open repository", ex); - } - finally - { - repository.closeSession(); - } - - return changesets; - } - - //~--- methods -------------------------------------------------------------- - - /** - * TODO: type replaced - * - * - * @param modifications - * @param entry - */ - private void appendModification(Modifications modifications, - SVNLogEntryPath entry) - { - switch (entry.getType()) - { - case SVNLogEntryPath.TYPE_ADDED : - modifications.getAdded().add(entry.getPath()); - - break; - - case SVNLogEntryPath.TYPE_DELETED : - modifications.getRemoved().add(entry.getPath()); - - break; - - case SVNLogEntryPath.TYPE_MODIFIED : - modifications.getModified().add(entry.getPath()); - - break; - } - } - - /** - * Method description - * - * - * @param entry - * - * @return - */ - @SuppressWarnings("unchecked") - private Changeset createChangeset(SVNLogEntry entry) - { - Changeset changeset = new Changeset(String.valueOf(entry.getRevision()), - entry.getDate().getTime(), - Person.toPerson(entry.getAuthor()), - entry.getMessage()); - Map changeMap = entry.getChangedPaths(); - - if (Util.isNotEmpty(changeMap)) - { - Modifications modifications = changeset.getModifications(); - - for (SVNLogEntryPath e : changeMap.values()) - { - appendModification(modifications, e); - } - } - - return changeset; - } - - //~--- fields --------------------------------------------------------------- - - /** Field description */ - private SvnRepositoryHandler handler; - - /** Field description */ - private Repository repostory; -} diff --git a/plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnConfig.java b/plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnConfig.java deleted file mode 100644 index c8d65deed5..0000000000 --- a/plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnConfig.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * 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 javax.xml.bind.annotation.XmlRootElement; - -/** - * - * @author Sebastian Sdorra - */ -@XmlRootElement(name = "config") -public class SvnConfig extends SimpleRepositoryConfig -{ - - /** - * Method description - * - * - * @return - */ - public Compatibility getCompatibility() - { - if (compatibility == null) - { - compatibility = Compatibility.NONE; - } - - return compatibility; - } - - //~--- set methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @param compatibility - */ - public void setCompatibility(Compatibility compatibility) - { - this.compatibility = compatibility; - } - - //~--- fields --------------------------------------------------------------- - - /** Field description */ - private Compatibility compatibility = Compatibility.NONE; -} diff --git a/plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryBrowser.java b/plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryBrowser.java deleted file mode 100644 index d3c4dc02e1..0000000000 --- a/plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryBrowser.java +++ /dev/null @@ -1,290 +0,0 @@ -/** - * 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 org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.tmatesoft.svn.core.SVNDirEntry; -import org.tmatesoft.svn.core.SVNException; -import org.tmatesoft.svn.core.SVNNodeKind; -import org.tmatesoft.svn.core.SVNProperties; -import org.tmatesoft.svn.core.SVNURL; -import org.tmatesoft.svn.core.io.SVNRepository; -import org.tmatesoft.svn.core.io.SVNRepositoryFactory; - -import sonia.scm.util.Util; - -//~--- JDK imports ------------------------------------------------------------ - -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * - * @author Sebastian Sdorra - */ -public class SvnRepositoryBrowser implements RepositoryBrowser -{ - - /** the logger for SvnRepositoryBrowser */ - private static final Logger logger = - LoggerFactory.getLogger(SvnRepositoryBrowser.class); - - //~--- constructors --------------------------------------------------------- - - /** - * Constructs ... - * - * - * @param handler - * @param repository - */ - public SvnRepositoryBrowser(SvnRepositoryHandler handler, - Repository repository) - { - this.handler = handler; - this.repository = repository; - } - - //~--- get methods ---------------------------------------------------------- - - /** - * http://wiki.svnkit.com/Printing_Out_File_Contents - * - * - * @param revision - * @param path - * @param output - * - * - * @throws IOException - * @throws RepositoryException - */ - @Override - public void getContent(String revision, String path, OutputStream output) - throws IOException, RepositoryException - { - long revisionNumber = getRevisionNumber(revision); - SVNRepository svnRepository = null; - - try - { - svnRepository = getSvnRepository(); - svnRepository.getFile(path, revisionNumber, new SVNProperties(), output); - } - catch (SVNException ex) - { - logger.error("could not open repository", ex); - } - finally - { - close(svnRepository); - } - } - - /** - * Method description - * - * - * @param revision - * @param path - * - * @return - * - * @throws IOException - * @throws RepositoryException - */ - @Override - public BrowserResult getResult(String revision, String path) - throws IOException, RepositoryException - { - long revisionNumber = getRevisionNumber(revision); - - if (logger.isDebugEnabled()) - { - logger.debug("browser repository {} in path {} at revision {}", - new Object[] { repository.getName(), - path, revision }); - } - - BrowserResult result = null; - SVNRepository svnRepository = null; - - try - { - svnRepository = getSvnRepository(); - - Collection entries = - svnRepository.getDir(Util.nonNull(path), revisionNumber, null, - (Collection) null); - List children = new ArrayList(); - String basePath = Util.EMPTY_STRING; - - if (Util.isNotEmpty(path)) - { - basePath = path; - - if (!basePath.endsWith("/")) - { - basePath = basePath.concat("/"); - } - } - - for (SVNDirEntry entry : entries) - { - children.add(createFileObject(entry, basePath)); - } - - result = new BrowserResult(); - result.setRevision(revision); - result.setFiles(children); - } - catch (SVNException ex) - { - logger.error("could not open repository", ex); - } - finally - { - close(svnRepository); - } - - return result; - } - - //~--- methods -------------------------------------------------------------- - - /** - * Method description - * - * - * @param svnRepository - */ - private void close(SVNRepository svnRepository) - { - if (svnRepository != null) - { - svnRepository.closeSession(); - } - } - - /** - * Method description - * - * - * @param entry - * @param path - * - * @return - */ - private FileObject createFileObject(SVNDirEntry entry, String path) - { - FileObject fileObject = new FileObject(); - - fileObject.setName(entry.getName()); - fileObject.setPath(path.concat(entry.getRelativePath())); - fileObject.setDirectory(entry.getKind() == SVNNodeKind.DIR); - - if (entry.getDate() != null) - { - fileObject.setLastModified(entry.getDate().getTime()); - } - - fileObject.setLength(entry.getSize()); - fileObject.setDescription(entry.getCommitMessage()); - - return fileObject; - } - - //~--- get methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @param revision - * - * @return - * - * @throws RepositoryException - */ - private long getRevisionNumber(String revision) throws RepositoryException - { - long revisionNumber = -1; - - if (Util.isNotEmpty(revision)) - { - try - { - revisionNumber = Long.parseLong(revision); - } - catch (NumberFormatException ex) - { - throw new RepositoryException("given revision is not a svnrevision"); - } - } - - return revisionNumber; - } - - /** - * Method description - * - * - * @return - * - * @throws SVNException - */ - private SVNRepository getSvnRepository() throws SVNException - { - File directory = handler.getDirectory(repository); - - return SVNRepositoryFactory.create(SVNURL.fromFile(directory)); - } - - //~--- fields --------------------------------------------------------------- - - /** Field description */ - private SvnRepositoryHandler handler; - - /** Field description */ - private Repository repository; -} diff --git a/plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHandler.java b/plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHandler.java deleted file mode 100644 index 2cccb9347b..0000000000 --- a/plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHandler.java +++ /dev/null @@ -1,227 +0,0 @@ -/** - * 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 com.google.inject.Inject; -import com.google.inject.Singleton; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.tmatesoft.svn.core.SVNException; -import org.tmatesoft.svn.core.internal.io.fs.FSRepositoryFactory; -import org.tmatesoft.svn.core.io.SVNRepositoryFactory; - -import sonia.scm.Type; -import sonia.scm.io.FileSystem; -import sonia.scm.plugin.ext.Extension; -import sonia.scm.store.StoreFactory; -import sonia.scm.util.AssertUtil; - -//~--- JDK imports ------------------------------------------------------------ - -import java.io.File; -import java.io.IOException; - -/** - * - * @author Sebastian Sdorra - */ -@Singleton -@Extension -public class SvnRepositoryHandler - extends AbstractSimpleRepositoryHandler -{ - - /** Field description */ - public static final String TYPE_DISPLAYNAME = "Subversion"; - - /** Field description */ - public static final String TYPE_NAME = "svn"; - - /** Field description */ - public static final Type TYPE = new Type(TYPE_NAME, TYPE_DISPLAYNAME); - - /** the logger for SvnRepositoryHandler */ - private static final Logger logger = - LoggerFactory.getLogger(SvnRepositoryHandler.class); - - //~--- constructors --------------------------------------------------------- - - /** - * Constructs ... - * - * - * @param storeFactory - * @param fileSystem - */ - @Inject - public SvnRepositoryHandler(StoreFactory storeFactory, FileSystem fileSystem) - { - super(storeFactory, fileSystem); - - // setup FSRepositoryFactory for SvnRepositoryBrowser - FSRepositoryFactory.setup(); - } - - //~--- get methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @param repository - * - * @return - */ - @Override - public ChangesetViewer getChangesetViewer(Repository repository) - { - SvnChangesetViewer changesetViewer = null; - - AssertUtil.assertIsNotNull(repository); - - String type = repository.getType(); - - AssertUtil.assertIsNotEmpty(type); - - if (TYPE_NAME.equals(type)) - { - changesetViewer = new SvnChangesetViewer(this, repository); - } - else - { - throw new IllegalArgumentException("mercurial repository is required"); - } - - return changesetViewer; - } - - /** - * Method description - * - * - * @param repository - * - * @return - */ - @Override - public RepositoryBrowser getRepositoryBrowser(Repository repository) - { - AssertUtil.assertIsNotNull(repository); - - return new SvnRepositoryBrowser(this, repository); - } - - /** - * Method description - * - * - * @return - */ - @Override - public Type getType() - { - return TYPE; - } - - //~--- methods -------------------------------------------------------------- - - /** - * Method description - * - * - * @param repository - * @param directory - * - * @throws IOException - * @throws RepositoryException - */ - @Override - protected void create(Repository repository, File directory) - throws RepositoryException, IOException - { - Compatibility comp = config.getCompatibility(); - - if (logger.isDebugEnabled()) - { - StringBuilder log = new StringBuilder("create svn repository \""); - - log.append(directory.getName()).append("\": pre14Compatible="); - log.append(comp.isPre14Compatible()).append(", pre15Compatible="); - log.append(comp.isPre15Compatible()).append(", pre16Compatible="); - log.append(comp.isPre16Compatible()); - logger.debug(log.toString()); - } - - try - { - SVNRepositoryFactory.createLocalRepository(directory, null, true, false, - comp.isPre14Compatible(), comp.isPre15Compatible(), - comp.isPre16Compatible()); - } - catch (SVNException ex) - { - throw new RepositoryException(ex); - } - } - - /** - * Method description - * - * - * @return - */ - @Override - protected SvnConfig createInitialConfig() - { - return new SvnConfig(); - } - - //~--- get methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @return - */ - @Override - protected Class getConfigClass() - { - return SvnConfig.class; - } -} diff --git a/plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnDAVConfig.java b/plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnDAVConfig.java deleted file mode 100644 index 0a39e80561..0000000000 --- a/plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnDAVConfig.java +++ /dev/null @@ -1,240 +0,0 @@ -/** - * 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.web; - -//~--- non-JDK imports -------------------------------------------------------- - -import org.tmatesoft.svn.core.internal.server.dav.DAVConfig; -import org.tmatesoft.svn.core.internal.server.dav.SVNPathBasedAccess; - -import sonia.scm.repository.SvnConfig; - -/** - * - * @author Sebastian Sdorra - */ -public class SvnDAVConfig extends DAVConfig -{ - - /** - * Constructs ... - * - * - * @param davConfig - * @param config - */ - public SvnDAVConfig(DAVConfig davConfig, SvnConfig config) - { - this.davConfig = davConfig; - this.config = config; - } - - //~--- get methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @return - */ - @Override - public String getActivitiesDBPath() - { - return davConfig.getActivitiesDBPath(); - } - - /** - * Method description - * - * - * @return - */ - @Override - public String getRepositoryName() - { - return davConfig.getRepositoryName(); - } - - /** - * Method description - * - * - * @return - */ - @Override - public String getRepositoryParentPath() - { - return config.getRepositoryDirectory().getAbsolutePath(); - } - - /** - * Method description - * - * - * @return - */ - @Override - public String getRepositoryPath() - { - return davConfig.getRepositoryPath(); - } - - /** - * Method description - * - * - * @return - */ - @Override - public SVNPathBasedAccess getSVNAccess() - { - return davConfig.getSVNAccess(); - } - - /** - * Method description - * - * - * @return - */ - @Override - public String getXSLTIndex() - { - return davConfig.getXSLTIndex(); - } - - /** - * Method description - * - * - * @return - */ - @Override - public boolean isAllowBulkUpdates() - { - return davConfig.isAllowBulkUpdates(); - } - - /** - * Method description - * - * - * @return - */ - @Override - public boolean isAllowDepthInfinity() - { - return davConfig.isAllowDepthInfinity(); - } - - /** - * Method description - * - * - * @return - */ - @Override - public boolean isAnonymousAllowed() - { - return davConfig.isAnonymousAllowed(); - } - - /** - * Method description - * - * - * @return - */ - @Override - public boolean isAutoVersioning() - { - return davConfig.isAutoVersioning(); - } - - /** - * Method description - * - * - * @return - */ - @Override - public boolean isListParentPath() - { - return davConfig.isListParentPath(); - } - - /** - * Method description - * - * - * @return - */ - @Override - public boolean isNoAuthIfAnonymousAllowed() - { - return davConfig.isNoAuthIfAnonymousAllowed(); - } - - /** - * Method description - * - * - * @return - */ - @Override - public boolean isUsingPBA() - { - return davConfig.isUsingPBA(); - } - - /** - * Method description - * - * - * @return - */ - @Override - public boolean isUsingRepositoryPathDirective() - { - return davConfig.isUsingRepositoryPathDirective(); - } - - //~--- fields --------------------------------------------------------------- - - /** Field description */ - private SvnConfig config; - - /** Field description */ - private DAVConfig davConfig; -} diff --git a/plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnDAVServlet.java b/plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnDAVServlet.java deleted file mode 100644 index c5e5f6c6ab..0000000000 --- a/plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnDAVServlet.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * 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.web; - -//~--- non-JDK imports -------------------------------------------------------- - -import com.google.inject.Inject; -import com.google.inject.Singleton; - -import org.tmatesoft.svn.core.internal.server.dav.DAVConfig; -import org.tmatesoft.svn.core.internal.server.dav.DAVServlet; - -import sonia.scm.repository.SvnRepositoryHandler; - -/** - * - * @author Sebastian Sdorra - */ -@Singleton -public class SvnDAVServlet extends DAVServlet -{ - - /** Field description */ - private static final long serialVersionUID = -1462257085465785945L; - - //~--- constructors --------------------------------------------------------- - - /** - * Constructs ... - * - * - * @param handler - */ - @Inject - public SvnDAVServlet(SvnRepositoryHandler handler) - { - this.handler = handler; - } - - //~--- get methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @return - */ - @Override - protected DAVConfig getDAVConfig() - { - return new SvnDAVConfig(super.getDAVConfig(), handler.getConfig()); - } - - //~--- fields --------------------------------------------------------------- - - /** Field description */ - private SvnRepositoryHandler handler; -} diff --git a/plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnPermissionFilter.java b/plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnPermissionFilter.java deleted file mode 100644 index 9c7d582bd9..0000000000 --- a/plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnPermissionFilter.java +++ /dev/null @@ -1,114 +0,0 @@ -/** - * 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.web; - -//~--- non-JDK imports -------------------------------------------------------- - -import com.google.inject.Inject; -import com.google.inject.Provider; -import com.google.inject.Singleton; - -import sonia.scm.repository.RepositoryManager; -import sonia.scm.repository.SvnRepositoryHandler; -import sonia.scm.web.filter.RegexPermissionFilter; -import sonia.scm.web.security.WebSecurityContext; - -//~--- JDK imports ------------------------------------------------------------ - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -import javax.servlet.http.HttpServletRequest; - -/** - * - * @author Sebastian Sdorra - */ -@Singleton -public class SvnPermissionFilter extends RegexPermissionFilter -{ - - /** Field description */ - private static Set WRITEMETHOD_SET = - new HashSet(Arrays.asList("MKACTIVITY", "PROPPATCH", "PUT", - "CHECKOUT", "MKCOL", "MOVE", "COPY", "DELETE", "LOCK", "UNLOCK", - "MERGE")); - - //~--- constructors --------------------------------------------------------- - - /** - * Constructs ... - * - * - * - * @param securityContextProvider - * @param repositoryManager - */ - @Inject - public SvnPermissionFilter( - Provider securityContextProvider, - RepositoryManager repositoryManager) - { - super(securityContextProvider, repositoryManager); - } - - //~--- get methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @return - */ - @Override - protected String getType() - { - return SvnRepositoryHandler.TYPE_NAME; - } - - /** - * Method description - * - * - * @param request - * - * @return - */ - @Override - protected boolean isWriteRequest(HttpServletRequest request) - { - return WRITEMETHOD_SET.contains(request.getMethod().toUpperCase()); - } -} diff --git a/plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnServletModule.java b/plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnServletModule.java deleted file mode 100644 index c0a30ff6c3..0000000000 --- a/plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnServletModule.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * 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.web; - -//~--- non-JDK imports -------------------------------------------------------- - -import com.google.inject.servlet.ServletModule; - -import sonia.scm.web.filter.BasicAuthenticationFilter; - -//~--- JDK imports ------------------------------------------------------------ - -import java.util.HashMap; -import java.util.Map; -import sonia.scm.plugin.ext.Extension; - -/** - * - * @author Sebastian Sdorra - */ -@Extension -public class SvnServletModule extends ServletModule -{ - - /** Field description */ - public static final String PARAMETER_SVN_PARENTPATH = "SVNParentPath"; - - /** Field description */ - public static final String PATTERN_SVN = "/svn/*"; - - //~--- methods -------------------------------------------------------------- - - /** - * Method description - * - */ - @Override - protected void configureServlets() - { - filter(PATTERN_SVN).through(BasicAuthenticationFilter.class); - filter(PATTERN_SVN).through(SvnPermissionFilter.class); - - Map parameters = new HashMap(); - - parameters.put(PARAMETER_SVN_PARENTPATH, - System.getProperty("java.io.tmpdir")); - serve(PATTERN_SVN).with(SvnDAVServlet.class, parameters); - } -} diff --git a/plugins/scm-svn-plugin/src/main/resources/META-INF/scm/plugin.xml b/plugins/scm-svn-plugin/src/main/resources/META-INF/scm/plugin.xml deleted file mode 100644 index 165fdb57cf..0000000000 --- a/plugins/scm-svn-plugin/src/main/resources/META-INF/scm/plugin.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - ${project.groupId} - ${project.artifactId} - ${project.version} - ${project.name} - ${project.description} - Sebastian Sdorra - ${project.url} - - - - 1.1 - - - - - - - \ No newline at end of file diff --git a/plugins/scm-svn-plugin/src/main/resources/sonia/scm/svn.config.js b/plugins/scm-svn-plugin/src/main/resources/sonia/scm/svn.config.js deleted file mode 100644 index a89beca241..0000000000 --- a/plugins/scm-svn-plugin/src/main/resources/sonia/scm/svn.config.js +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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 - * - */ - -Ext.ns("Sonia.svn"); - -Sonia.svn.ConfigPanel = Ext.extend(Sonia.config.SimpleConfigForm, { - - // labels - titleText: 'Subversion Settings', - repositoryDirectoryText: 'Repository directory', - noneCompatibility: 'No compatibility modus', - pre14CompatibleText: 'Pre 1.4 Compatible', - pre15CompatibleText: 'Pre 1.5 Compatible', - pre16CompatibleText: 'Pre 1.6 Compatible', - - // helpTexts - repositoryDirectoryHelpText: 'Location of the Suberversion repositories.', - - initComponent: function(){ - - var config = { - title : this.titleText, - configUrl: restUrl + 'config/repositories/svn.json', - items : [{ - xtype: 'textfield', - name: 'repositoryDirectory', - fieldLabel: this.repositoryDirectoryText, - helpText: this.repositoryDirectoryHelpText, - allowBlank : false - },{ - xtype: 'radiogroup', - name: 'compatibility', - columns: 1, - items: [{ - boxLabel: this.noneCompatibility, - inputValue: 'NONE', - name: 'compatibility' - },{ - boxLabel: this.pre14CompatibleText, - inputValue: 'PRE14', - name: 'compatibility' - },{ - boxLabel: this.pre15CompatibleText, - inputValue: 'PRE15', - name: 'compatibility' - },{ - boxLabel: this.pre16CompatibleText, - inputValue: 'PRE16', - name: 'compatibility' - }] - }] - } - - Ext.apply(this, Ext.apply(this.initialConfig, config)); - Sonia.svn.ConfigPanel.superclass.initComponent.apply(this, arguments); - } - -}); - -Ext.reg("svnConfigPanel", Sonia.svn.ConfigPanel); - -// i18n - -if ( i18n != null && i18n.country == 'de' ){ - - Ext.override(Sonia.svn.ConfigPanel, { - - // labels - titleText: 'Subversion Einstellungen', - repositoryDirectoryText: 'Repository-Verzeichnis', - noneCompatibility: 'Kein Kompatiblitätsmodus', - pre14CompatibleText: 'Mit Versionen vor 1.4 kompatibel', - pre15CompatibleText: 'Mit Versionen vor 1.5 kompatibel', - pre16CompatibleText: 'Mit Versionen vor 1.6 kompatibel', - - // helpTexts - repositoryDirectoryHelpText: 'Verzeichnis der Subversion-Repositories.' - - }); - -} - -// register information panel - -initCallbacks.push(function(main){ - main.registerInfoPanel('svn', { - checkoutTemplate: 'svn checkout {0}', - xtype: 'repositoryExtendedInfoPanel' - }); -}); - -// register panel - -registerConfigPanel({ - xtype : 'svnConfigPanel' -}); diff --git a/plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/SvnRepositoryHandlerTest.java b/plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/SvnRepositoryHandlerTest.java deleted file mode 100644 index ab26da171f..0000000000 --- a/plugins/scm-svn-plugin/src/test/java/sonia/scm/repository/SvnRepositoryHandlerTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * 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.io.DefaultFileSystem; -import sonia.scm.store.StoreFactory; - -import static org.junit.Assert.*; - -//~--- JDK imports ------------------------------------------------------------ - -import java.io.File; - -/** - * - * @author Sebastian Sdorra - */ -public class SvnRepositoryHandlerTest extends SimpleRepositoryHandlerTestBase -{ - - /** - * Method description - * - * - * @param directory - */ - @Override - protected void checkDirectory(File directory) - { - File format = new File(directory, "format"); - - assertTrue(format.exists()); - assertTrue(format.isFile()); - - File db = new File(directory, "db"); - - assertTrue(db.exists()); - assertTrue(db.isDirectory()); - } - - /** - * Method description - * - * - * @param factory - * @param directory - * - * @return - */ - @Override - protected RepositoryHandler createRepositoryHandler(StoreFactory factory, - File directory) - { - SvnRepositoryHandler handler = new SvnRepositoryHandler(factory, - new DefaultFileSystem()); - - handler.init(contextProvider); - - SvnConfig config = new SvnConfig(); - - config.setRepositoryDirectory(directory); - handler.setConfig(config); - - return handler; - } -}