mirror of
				https://github.com/scm-manager/scm-manager.git
				synced 2025-10-31 10:35:56 +01:00 
			
		
		
		
	move core plugins back to main repository, because of a broken release management
This commit is contained in:
		| @@ -0,0 +1,125 @@ | ||||
| /** | ||||
|  * 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; | ||||
| } | ||||
| @@ -0,0 +1,105 @@ | ||||
| /** | ||||
|  * 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; | ||||
| } | ||||
| @@ -0,0 +1,207 @@ | ||||
| /** | ||||
|  * 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<Changeset> changesetList = new ArrayList<Changeset>(); | ||||
|       Collection<SVNLogEntry> 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<String, SVNLogEntryPath> 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; | ||||
| } | ||||
| @@ -0,0 +1,81 @@ | ||||
| /** | ||||
|  * 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; | ||||
| } | ||||
| @@ -0,0 +1,290 @@ | ||||
| /** | ||||
|  * 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<SVNDirEntry> entries = | ||||
|         svnRepository.getDir(Util.nonNull(path), revisionNumber, null, | ||||
|                              (Collection) null); | ||||
|       List<FileObject> children = new ArrayList<FileObject>(); | ||||
|       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; | ||||
| } | ||||
| @@ -0,0 +1,227 @@ | ||||
| /** | ||||
|  * 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<SvnConfig> | ||||
| { | ||||
|  | ||||
|   /** 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<SvnConfig> getConfigClass() | ||||
|   { | ||||
|     return SvnConfig.class; | ||||
|   } | ||||
| } | ||||
| @@ -0,0 +1,240 @@ | ||||
| /** | ||||
|  * 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; | ||||
| } | ||||
| @@ -0,0 +1,89 @@ | ||||
| /** | ||||
|  * 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; | ||||
| } | ||||
| @@ -0,0 +1,114 @@ | ||||
| /** | ||||
|  * 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<String> WRITEMETHOD_SET = | ||||
|     new HashSet<String>(Arrays.asList("MKACTIVITY", "PROPPATCH", "PUT", | ||||
|       "CHECKOUT", "MKCOL", "MOVE", "COPY", "DELETE", "LOCK", "UNLOCK", | ||||
|       "MERGE")); | ||||
|  | ||||
|   //~--- constructors --------------------------------------------------------- | ||||
|  | ||||
|   /** | ||||
|    * Constructs ... | ||||
|    * | ||||
|    * | ||||
|    * | ||||
|    * @param securityContextProvider | ||||
|    * @param repositoryManager | ||||
|    */ | ||||
|   @Inject | ||||
|   public SvnPermissionFilter( | ||||
|           Provider<WebSecurityContext> 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()); | ||||
|   } | ||||
| } | ||||
| @@ -0,0 +1,80 @@ | ||||
| /** | ||||
|  * 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<String, String> parameters = new HashMap<String, String>(); | ||||
|  | ||||
|     parameters.put(PARAMETER_SVN_PARENTPATH, | ||||
|                    System.getProperty("java.io.tmpdir")); | ||||
|     serve(PATTERN_SVN).with(SvnDAVServlet.class, parameters); | ||||
|   } | ||||
| } | ||||
| @@ -0,0 +1,63 @@ | ||||
| <?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||||
| <!-- | ||||
|  | ||||
|     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 | ||||
|  | ||||
|  | ||||
| --> | ||||
|  | ||||
| <!-- | ||||
|     Document   : plugin.xml | ||||
|     Created on : October 12, 2010, 8:29 AM | ||||
|     Author     : sdorra | ||||
|     Description: | ||||
|         Purpose of the document follows. | ||||
| --> | ||||
|  | ||||
| <plugin> | ||||
|  | ||||
|   <information> | ||||
|     <groupId>${project.groupId}</groupId> | ||||
|     <artifactId>${project.artifactId}</artifactId> | ||||
|     <version>${project.version}</version> | ||||
|     <name>${project.name}</name> | ||||
|     <description>${project.description}</description> | ||||
|     <author>Sebastian Sdorra</author> | ||||
|     <url>${project.url}</url> | ||||
|   </information> | ||||
|  | ||||
|   <conditions> | ||||
|     <min-version>1.1</min-version> | ||||
|   </conditions> | ||||
|    | ||||
|   <resources> | ||||
|     <script>/sonia/scm/svn.config.js</script> | ||||
|   </resources> | ||||
|  | ||||
| </plugin> | ||||
| @@ -0,0 +1,124 @@ | ||||
| /* | ||||
|  * 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 <a href="{0}" target="_blank">{0}</a>', | ||||
|     xtype: 'repositoryExtendedInfoPanel' | ||||
|   }); | ||||
| }); | ||||
|  | ||||
| // register panel | ||||
|  | ||||
| registerConfigPanel({ | ||||
|   xtype : 'svnConfigPanel' | ||||
| }); | ||||
| @@ -0,0 +1,99 @@ | ||||
| /** | ||||
|  * 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; | ||||
|   } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user