mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-25 07:50:52 +01:00
merge default
This commit is contained in:
@@ -6,13 +6,13 @@
|
||||
<parent>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm.maven</groupId>
|
||||
<artifactId>scm-maven-plugins</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>scm-maven-plugins</name>
|
||||
|
||||
<modules>
|
||||
@@ -24,7 +24,7 @@
|
||||
<dependency>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-core</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
<parent>
|
||||
<artifactId>scm-maven-plugins</artifactId>
|
||||
<groupId>sonia.scm.maven</groupId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm.maven</groupId>
|
||||
<artifactId>scm-plugin-archetype</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>scm-plugin-archetype</name>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<artifactId>scm-plugins</artifactId>
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>${groupId}</groupId>
|
||||
@@ -31,7 +31,7 @@
|
||||
<dependency>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-test</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
<parent>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<artifactId>scm-plugins</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>scm-plugins</name>
|
||||
|
||||
<modules>
|
||||
@@ -31,7 +31,7 @@
|
||||
<dependency>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-core</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
<parent>
|
||||
<artifactId>scm-plugins</artifactId>
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<artifactId>scm-activedirectory-auth-plugin</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>scm-activedirectory-auth-plugin</name>
|
||||
<url>https://bitbucket.org/sdorra/scm-manager</url>
|
||||
<description>
|
||||
@@ -32,7 +32,7 @@
|
||||
<dependency>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-core</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
<parent>
|
||||
<artifactId>scm-plugins</artifactId>
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<artifactId>scm-auth-ldap-plugin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>${project.artifactId}</name>
|
||||
<description>plugin description</description>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<dependency>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-test</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
<parent>
|
||||
<artifactId>scm-plugins</artifactId>
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<artifactId>scm-bzr-plugin</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>scm-bzr-plugin</name>
|
||||
<url>https://bitbucket.org/sdorra/scm-manager</url>
|
||||
<description>Plugin for the version control system Bazaar</description>
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.google.inject.Singleton;
|
||||
|
||||
import sonia.scm.Type;
|
||||
import sonia.scm.io.ExtendedCommand;
|
||||
import sonia.scm.io.FileSystem;
|
||||
import sonia.scm.plugin.ext.Extension;
|
||||
import sonia.scm.store.StoreFactory;
|
||||
import sonia.scm.util.SecurityUtil;
|
||||
@@ -79,14 +80,15 @@ public class BzrRepositoryHandler
|
||||
*
|
||||
*
|
||||
* @param storeFactory
|
||||
* @param fileSystem
|
||||
* @param securityContextProvider
|
||||
*/
|
||||
@Inject
|
||||
public BzrRepositoryHandler(
|
||||
StoreFactory storeFactory,
|
||||
StoreFactory storeFactory, FileSystem fileSystem,
|
||||
Provider<WebSecurityContext> securityContextProvider)
|
||||
{
|
||||
super(storeFactory);
|
||||
super(storeFactory, fileSystem);
|
||||
this.securityContextProvider = securityContextProvider;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
<parent>
|
||||
<artifactId>scm-plugins</artifactId>
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<artifactId>scm-git-plugin</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>scm-git-plugin</name>
|
||||
<url>https://bitbucket.org/sdorra/scm-manager</url>
|
||||
<description>Plugin for the version control system Git</description>
|
||||
@@ -50,7 +50,7 @@
|
||||
<dependency>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-test</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.google.inject.Singleton;
|
||||
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
|
||||
|
||||
import sonia.scm.Type;
|
||||
import sonia.scm.io.FileSystem;
|
||||
import sonia.scm.plugin.ext.Extension;
|
||||
import sonia.scm.store.StoreFactory;
|
||||
|
||||
@@ -75,11 +76,12 @@ public class GitRepositoryHandler
|
||||
*
|
||||
*
|
||||
* @param storeFactory
|
||||
* @param fileSystem
|
||||
*/
|
||||
@Inject
|
||||
public GitRepositoryHandler(StoreFactory storeFactory)
|
||||
public GitRepositoryHandler(StoreFactory storeFactory, FileSystem fileSystem)
|
||||
{
|
||||
super(storeFactory);
|
||||
super(storeFactory, fileSystem);
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
@@ -35,6 +35,7 @@ package sonia.scm.repository;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.io.DefaultFileSystem;
|
||||
import sonia.scm.store.StoreFactory;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
@@ -88,7 +89,8 @@ public class GitRepositoryHandlerTest extends SimpleRepositoryHandlerTestBase
|
||||
protected RepositoryHandler createRepositoryHandler(StoreFactory factory,
|
||||
File directory)
|
||||
{
|
||||
GitRepositoryHandler repositoryHandler = new GitRepositoryHandler(factory);
|
||||
GitRepositoryHandler repositoryHandler = new GitRepositoryHandler(factory,
|
||||
new DefaultFileSystem());
|
||||
|
||||
repositoryHandler.init(contextProvider);
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
<parent>
|
||||
<artifactId>scm-plugins</artifactId>
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<artifactId>scm-graph-plugin</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>scm-graph-plugin</name>
|
||||
<description>Creates an Google Guice injection graph</description>
|
||||
<url>https://bitbucket.org/sdorra/scm-manager</url>
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
<parent>
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<artifactId>scm-plugins</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<artifactId>scm-hg-plugin</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>scm-hg-plugin</name>
|
||||
<url>https://bitbucket.org/sdorra/scm-manager</url>
|
||||
<description>Plugin for the version control system Mercurial</description>
|
||||
@@ -37,7 +37,7 @@
|
||||
<dependency>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-test</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ import sonia.scm.web.HgWebConfigWriter;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import sonia.scm.io.FileSystem;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -90,9 +91,9 @@ public class HgRepositoryHandler
|
||||
* @param storeFactory
|
||||
*/
|
||||
@Inject
|
||||
public HgRepositoryHandler(StoreFactory storeFactory)
|
||||
public HgRepositoryHandler(StoreFactory storeFactory, FileSystem fileSystem)
|
||||
{
|
||||
super(storeFactory);
|
||||
super(storeFactory, fileSystem);
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
@@ -35,6 +35,7 @@ package sonia.scm.repository;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.io.DefaultFileSystem;
|
||||
import sonia.scm.store.StoreFactory;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
@@ -86,7 +87,8 @@ public class HgRepositoryHandlerTest extends SimpleRepositoryHandlerTestBase
|
||||
protected RepositoryHandler createRepositoryHandler(StoreFactory factory,
|
||||
File directory)
|
||||
{
|
||||
HgRepositoryHandler handler = new HgRepositoryHandler(factory);
|
||||
HgRepositoryHandler handler = new HgRepositoryHandler(factory,
|
||||
new DefaultFileSystem());
|
||||
|
||||
handler.init(contextProvider);
|
||||
handler.getConfig().setRepositoryDirectory(directory);
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
<parent>
|
||||
<artifactId>scm-plugins</artifactId>
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<artifactId>scm-pam-plugin</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>scm-pam-plugin</name>
|
||||
<url>https://bitbucket.org/sdorra/scm-manager</url>
|
||||
<description>Using pam as an authentication handler.</description>
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
<parent>
|
||||
<artifactId>scm-plugins</artifactId>
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<artifactId>scm-svn-plugin</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>scm-svn-plugin</name>
|
||||
<url>https://bitbucket.org/sdorra/scm-manager</url>
|
||||
<description>Plugin for the version control system Subversion</description>
|
||||
@@ -47,7 +47,7 @@
|
||||
<dependency>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-test</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ import org.tmatesoft.svn.core.SVNException;
|
||||
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;
|
||||
|
||||
@@ -76,11 +77,12 @@ public class SvnRepositoryHandler
|
||||
*
|
||||
*
|
||||
* @param storeFactory
|
||||
* @param fileSystem
|
||||
*/
|
||||
@Inject
|
||||
public SvnRepositoryHandler(StoreFactory storeFactory)
|
||||
public SvnRepositoryHandler(StoreFactory storeFactory, FileSystem fileSystem)
|
||||
{
|
||||
super(storeFactory);
|
||||
super(storeFactory, fileSystem);
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
@@ -35,6 +35,7 @@ package sonia.scm.repository;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.io.DefaultFileSystem;
|
||||
import sonia.scm.store.StoreFactory;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
@@ -83,7 +84,8 @@ public class SvnRepositoryHandlerTest extends SimpleRepositoryHandlerTestBase
|
||||
protected RepositoryHandler createRepositoryHandler(StoreFactory factory,
|
||||
File directory)
|
||||
{
|
||||
SvnRepositoryHandler handler = new SvnRepositoryHandler(factory);
|
||||
SvnRepositoryHandler handler = new SvnRepositoryHandler(factory,
|
||||
new DefaultFileSystem());
|
||||
|
||||
handler.init(contextProvider);
|
||||
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -6,7 +6,7 @@
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<description>
|
||||
The easiest way to share your Git, Mercurial
|
||||
and Subversion repositories over http.
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
<parent>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm.samples</groupId>
|
||||
<artifactId>scm-samples</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>scm-samples</name>
|
||||
|
||||
<modules>
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
<parent>
|
||||
<artifactId>scm-samples</artifactId>
|
||||
<groupId>sonia.scm.samples</groupId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm.sample</groupId>
|
||||
<artifactId>scm-sample-auth</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>scm-sample-auth</name>
|
||||
<description>Sample Authentication Plugin</description>
|
||||
<url>https://bitbucket.org/sdorra/scm-manager</url>
|
||||
@@ -29,7 +29,7 @@
|
||||
<dependency>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-core</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
<parent>
|
||||
<artifactId>scm-samples</artifactId>
|
||||
<groupId>sonia.scm.samples</groupId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm.sample</groupId>
|
||||
<artifactId>scm-sample-hello</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>scm-sample-hello</name>
|
||||
<description>A simple hello world plugin</description>
|
||||
<url>https://bitbucket.org/sdorra/scm-manager</url>
|
||||
@@ -29,7 +29,7 @@
|
||||
<dependency>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-core</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
<parent>
|
||||
<artifactId>scm</artifactId>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-core</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>scm-core</name>
|
||||
|
||||
<dependencies>
|
||||
|
||||
98
scm-core/src/main/java/sonia/scm/io/DefaultFileSystem.java
Normal file
98
scm-core/src/main/java/sonia/scm/io/DefaultFileSystem.java
Normal file
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* 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.io;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.util.IOUtil;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class DefaultFileSystem implements FileSystem
|
||||
{
|
||||
|
||||
/** the logger for DefaultFileSystem */
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(DefaultFileSystem.class);
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param directory
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
@Override
|
||||
public void create(File directory) throws IOException
|
||||
{
|
||||
if (logger.isInfoEnabled())
|
||||
{
|
||||
logger.info("create directory {}", directory.getPath());
|
||||
}
|
||||
|
||||
IOUtil.mkdirs(directory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param directory
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
@Override
|
||||
public void destroy(File directory) throws IOException
|
||||
{
|
||||
if (logger.isInfoEnabled())
|
||||
{
|
||||
logger.info("destroy directory {}", directory.getPath());
|
||||
}
|
||||
|
||||
IOUtil.delete(directory);
|
||||
}
|
||||
}
|
||||
74
scm-core/src/main/java/sonia/scm/io/FileSystem.java
Normal file
74
scm-core/src/main/java/sonia/scm/io/FileSystem.java
Normal file
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* 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.io;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.plugin.ExtensionPoint;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@ExtensionPoint
|
||||
public interface FileSystem
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param directory
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public void create(File directory) throws IOException;
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param directory
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public void destroy(File directory) throws IOException;
|
||||
}
|
||||
@@ -176,6 +176,97 @@ public class PluginVersion implements Comparable<PluginVersion>
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param obj
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final PluginVersion other = (PluginVersion) obj;
|
||||
|
||||
if (this.maintenance != other.maintenance)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.major != other.major)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.minor != other.minor)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((this.parsedVersion == null)
|
||||
? (other.parsedVersion != null)
|
||||
: !this.parsedVersion.equals(other.parsedVersion))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.snapshot != other.snapshot)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.type != other.type)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.typeVersion != other.typeVersion)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int hash = 5;
|
||||
|
||||
hash = 61 * hash + this.maintenance;
|
||||
hash = 61 * hash + this.major;
|
||||
hash = 61 * hash + this.minor;
|
||||
hash = 61 * hash + ((this.parsedVersion != null)
|
||||
? this.parsedVersion.hashCode()
|
||||
: 0);
|
||||
hash = 61 * hash + (this.snapshot
|
||||
? 1
|
||||
: 0);
|
||||
hash = 61 * hash + ((this.type != null)
|
||||
? this.type.hashCode()
|
||||
: 0);
|
||||
hash = 61 * hash + this.typeVersion;
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
@@ -39,9 +39,9 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.ConfigurationException;
|
||||
import sonia.scm.SCMContextProvider;
|
||||
import sonia.scm.io.CommandResult;
|
||||
import sonia.scm.io.ExtendedCommand;
|
||||
import sonia.scm.io.FileSystem;
|
||||
import sonia.scm.store.StoreFactory;
|
||||
import sonia.scm.util.IOUtil;
|
||||
|
||||
@@ -75,10 +75,13 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
|
||||
*
|
||||
*
|
||||
* @param storeFactory
|
||||
* @param fileSystem
|
||||
*/
|
||||
public AbstractSimpleRepositoryHandler(StoreFactory storeFactory)
|
||||
public AbstractSimpleRepositoryHandler(StoreFactory storeFactory,
|
||||
FileSystem fileSystem)
|
||||
{
|
||||
super(storeFactory);
|
||||
this.fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
@@ -103,6 +106,7 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
|
||||
throw new RepositoryAllreadyExistExeption();
|
||||
}
|
||||
|
||||
fileSystem.create(directory);
|
||||
create(repository, directory);
|
||||
postCreate(repository, directory);
|
||||
}
|
||||
@@ -142,7 +146,7 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
|
||||
|
||||
if (directory.exists())
|
||||
{
|
||||
IOUtil.delete(directory);
|
||||
fileSystem.destroy(directory);
|
||||
}
|
||||
else if (logger.isWarnEnabled())
|
||||
{
|
||||
@@ -150,18 +154,6 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
@Override
|
||||
public void init(SCMContextProvider context)
|
||||
{
|
||||
super.init(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -305,4 +297,9 @@ public abstract class AbstractSimpleRepositoryHandler<C extends SimpleRepository
|
||||
*/
|
||||
protected void postCreate(Repository repository, File directory)
|
||||
throws IOException, RepositoryException {}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private FileSystem fileSystem;
|
||||
}
|
||||
|
||||
@@ -163,15 +163,13 @@ public class PermissionUtil
|
||||
{
|
||||
String name = p.getName();
|
||||
|
||||
if ((name != null) && (p.getType().getValue() >= pt.getValue()))
|
||||
if (((name != null) && (p.getType().getValue() >= pt.getValue()))
|
||||
&& (name.equals(username)
|
||||
|| (p.isGroupPermission() && groups.contains(p.getName()))))
|
||||
{
|
||||
if (name.equals(username)
|
||||
|| (p.isGroupPermission() && groups.contains(p.getName())))
|
||||
{
|
||||
result = true;
|
||||
result = true;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,15 +39,23 @@ import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class ResourceHandlerComparator implements Comparator<ResourceHandler>
|
||||
public class ResourceHandlerComparator
|
||||
implements Comparator<ResourceHandler>, Serializable
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
private static final long serialVersionUID = -1760229246326556762L;
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
@@ -66,10 +66,10 @@ public class IOUtil
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String DEFAULT_CHECKPARAMETER = "--version";
|
||||
private static final String DEFAULT_CHECKPARAMETER = "--version";
|
||||
|
||||
/** Field description */
|
||||
public static final String[] DEFAULT_PATH = new String[]
|
||||
private static final String[] DEFAULT_PATH = new String[]
|
||||
{
|
||||
|
||||
// default path
|
||||
@@ -336,7 +336,13 @@ public class IOUtil
|
||||
cmdPath = cmd;
|
||||
}
|
||||
}
|
||||
catch (IOException ex) {}
|
||||
catch (IOException ex)
|
||||
{
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace("could not execute command", ex);
|
||||
}
|
||||
}
|
||||
|
||||
if (cmdPath == null)
|
||||
{
|
||||
|
||||
@@ -47,9 +47,7 @@ import sonia.scm.util.Util;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
|
||||
import java.util.Enumeration;
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
<parent>
|
||||
<artifactId>scm</artifactId>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-server-api</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>scm-server-api</name>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
<parent>
|
||||
<artifactId>scm</artifactId>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-server-jetty</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>scm-server-jetty</name>
|
||||
|
||||
<dependencies>
|
||||
@@ -20,7 +20,7 @@
|
||||
<dependency>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-server-api</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
<parent>
|
||||
<artifactId>scm</artifactId>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-server</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>scm-server</name>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
<dependency>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-server-api</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-server-jetty</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
<parent>
|
||||
<artifactId>scm</artifactId>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-test</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>scm-test</name>
|
||||
|
||||
<dependencies>
|
||||
@@ -26,7 +26,7 @@
|
||||
<dependency>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-core</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -36,6 +36,7 @@ package sonia.scm.repository;
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.Type;
|
||||
import sonia.scm.io.DefaultFileSystem;
|
||||
import sonia.scm.store.StoreFactory;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
@@ -70,7 +71,7 @@ public class DummyRepositoryHandler
|
||||
*/
|
||||
public DummyRepositoryHandler(StoreFactory storeFactory)
|
||||
{
|
||||
super(storeFactory);
|
||||
super(storeFactory, new DefaultFileSystem());
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
<parent>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-webapp</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>scm-webapp</name>
|
||||
|
||||
<dependencies>
|
||||
@@ -28,25 +28,25 @@
|
||||
<dependency>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-core</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<artifactId>scm-hg-plugin</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<artifactId>scm-svn-plugin</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<artifactId>scm-git-plugin</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -86,7 +86,7 @@
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>0.9.27</version>
|
||||
<version>0.9.28</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -164,7 +164,7 @@
|
||||
<dependency>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-test</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@@ -287,43 +287,43 @@
|
||||
<dependency>
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<artifactId>scm-graph-plugin</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>sonia.scm.sample</groupId>
|
||||
<artifactId>scm-sample-auth</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>sonia.scm.sample</groupId>
|
||||
<artifactId>scm-sample-hello</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<artifactId>scm-activedirectory-auth-plugin</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<artifactId>scm-pam-plugin</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<artifactId>scm-bzr-plugin</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
<artifactId>scm-auth-ldap-plugin</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.group.GroupListener;
|
||||
import sonia.scm.io.FileSystem;
|
||||
import sonia.scm.plugin.ext.Extension;
|
||||
import sonia.scm.plugin.ext.ExtensionProcessor;
|
||||
import sonia.scm.repository.RepositoryHandler;
|
||||
@@ -188,6 +189,15 @@ public class BindingExtensionProcessor implements ExtensionProcessor
|
||||
|
||||
resourceHandler.addBinding().to(extensionClass);
|
||||
}
|
||||
else if (FileSystem.class.isAssignableFrom(extensionClass))
|
||||
{
|
||||
if (logger.isInfoEnabled())
|
||||
{
|
||||
logger.info("bind FileSystem {}", extensionClass.getName());
|
||||
}
|
||||
|
||||
fileSystemClass = extensionClass;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logger.isInfoEnabled())
|
||||
@@ -198,7 +208,11 @@ public class BindingExtensionProcessor implements ExtensionProcessor
|
||||
binder.bind(extensionClass);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (IllegalAccessException ex)
|
||||
{
|
||||
logger.error(ex.getMessage(), ex);
|
||||
}
|
||||
catch (InstantiationException ex)
|
||||
{
|
||||
logger.error(ex.getMessage(), ex);
|
||||
}
|
||||
@@ -243,6 +257,17 @@ public class BindingExtensionProcessor implements ExtensionProcessor
|
||||
return authenticationListeners;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Class<? extends FileSystem> getFileSystemClass()
|
||||
{
|
||||
return fileSystemClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -337,6 +362,9 @@ public class BindingExtensionProcessor implements ExtensionProcessor
|
||||
/** Field description */
|
||||
private Set<Class<?>> extensions;
|
||||
|
||||
/** Field description */
|
||||
private Class<? extends FileSystem> fileSystemClass;
|
||||
|
||||
/** Field description */
|
||||
private Set<Module> moduleSet;
|
||||
|
||||
|
||||
@@ -49,6 +49,8 @@ import sonia.scm.filter.SSLFilter;
|
||||
import sonia.scm.filter.SecurityFilter;
|
||||
import sonia.scm.group.GroupManager;
|
||||
import sonia.scm.group.xml.XmlGroupManager;
|
||||
import sonia.scm.io.DefaultFileSystem;
|
||||
import sonia.scm.io.FileSystem;
|
||||
import sonia.scm.plugin.DefaultPluginManager;
|
||||
import sonia.scm.plugin.Plugin;
|
||||
import sonia.scm.plugin.PluginLoader;
|
||||
@@ -175,6 +177,16 @@ public class ScmServletModule extends ServletModule
|
||||
bind(EncryptionHandler.class).to(MessageDigestEncryptionHandler.class);
|
||||
bindExtProcessor.bindExtensions(binder());
|
||||
|
||||
Class<? extends FileSystem> fileSystem =
|
||||
bindExtProcessor.getFileSystemClass();
|
||||
|
||||
if (fileSystem == null)
|
||||
{
|
||||
fileSystem = DefaultFileSystem.class;
|
||||
}
|
||||
|
||||
bind(FileSystem.class).to(fileSystem);
|
||||
|
||||
// bind security stuff
|
||||
bind(AuthenticationManager.class).to(ChainAuthenticatonManager.class);
|
||||
bind(SecurityContext.class).to(BasicSecurityContext.class);
|
||||
|
||||
@@ -43,7 +43,6 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.SCMContext;
|
||||
import sonia.scm.ScmState;
|
||||
import sonia.scm.Type;
|
||||
import sonia.scm.repository.RepositoryManager;
|
||||
import sonia.scm.user.User;
|
||||
import sonia.scm.web.security.WebSecurityContext;
|
||||
|
||||
@@ -41,7 +41,6 @@ import com.google.inject.Singleton;
|
||||
import sonia.scm.plugin.DefaultPluginManager;
|
||||
import sonia.scm.plugin.OverviewPluginFilter;
|
||||
import sonia.scm.plugin.PluginInformation;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -36,24 +36,29 @@ package sonia.scm.api.rest.resources;
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import sonia.scm.config.ScmConfiguration;
|
||||
import sonia.scm.repository.Permission;
|
||||
import sonia.scm.repository.PermissionType;
|
||||
import sonia.scm.repository.PermissionUtil;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
import sonia.scm.repository.RepositoryHandler;
|
||||
import sonia.scm.repository.RepositoryManager;
|
||||
import sonia.scm.web.security.WebSecurityContext;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.core.Context;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -75,13 +80,19 @@ public class RepositoryResource extends AbstractResource<Repository>
|
||||
*
|
||||
* @param configuration
|
||||
* @param repositoryManager
|
||||
* @param securityContextProvider
|
||||
* @param requestProvider
|
||||
*/
|
||||
@Inject
|
||||
public RepositoryResource(ScmConfiguration configuration,
|
||||
RepositoryManager repositoryManager)
|
||||
public RepositoryResource(
|
||||
ScmConfiguration configuration, RepositoryManager repositoryManager,
|
||||
Provider<WebSecurityContext> securityContextProvider,
|
||||
Provider<HttpServletRequest> requestProvider)
|
||||
{
|
||||
this.configuration = configuration;
|
||||
this.repositoryManager = repositoryManager;
|
||||
this.securityContextProvider = securityContextProvider;
|
||||
this.requestProvider = requestProvider;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
@@ -151,6 +162,7 @@ public class RepositoryResource extends AbstractResource<Repository>
|
||||
for (Repository repository : repositories)
|
||||
{
|
||||
appendUrl(repository);
|
||||
prepareRepository(repository);
|
||||
}
|
||||
|
||||
return repositories;
|
||||
@@ -185,6 +197,7 @@ public class RepositoryResource extends AbstractResource<Repository>
|
||||
Repository repository = repositoryManager.get(id);
|
||||
|
||||
appendUrl(repository);
|
||||
prepareRepository(repository);
|
||||
|
||||
return repository;
|
||||
}
|
||||
@@ -216,6 +229,7 @@ public class RepositoryResource extends AbstractResource<Repository>
|
||||
|
||||
if (handler != null)
|
||||
{
|
||||
HttpServletRequest request = requestProvider.get();
|
||||
StringBuilder url = new StringBuilder(request.getScheme());
|
||||
|
||||
url.append("://").append(configuration.getServername());
|
||||
@@ -234,6 +248,43 @@ public class RepositoryResource extends AbstractResource<Repository>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param repository
|
||||
*/
|
||||
private void prepareRepository(Repository repository)
|
||||
{
|
||||
if (isOwner(repository))
|
||||
{
|
||||
if (repository.getPermissions() == null)
|
||||
{
|
||||
repository.setPermissions(new ArrayList<Permission>());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
repository.setPermissions(null);
|
||||
}
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param repository
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean isOwner(Repository repository)
|
||||
{
|
||||
return PermissionUtil.hasPermission(repository, securityContextProvider,
|
||||
PermissionType.OWNER);
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@@ -242,7 +293,9 @@ public class RepositoryResource extends AbstractResource<Repository>
|
||||
/** Field description */
|
||||
private RepositoryManager repositoryManager;
|
||||
|
||||
/** TODO path request direct to method */
|
||||
@Context
|
||||
private HttpServletRequest request;
|
||||
/** Field description */
|
||||
private Provider<HttpServletRequest> requestProvider;
|
||||
|
||||
/** Field description */
|
||||
private Provider<WebSecurityContext> securityContextProvider;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,10 @@ public class GZipResponseWrapper extends HttpServletResponseWrapper
|
||||
@Override
|
||||
public void flushBuffer() throws IOException
|
||||
{
|
||||
stream.flush();
|
||||
if (stream != null)
|
||||
{
|
||||
stream.flush();
|
||||
}
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
@@ -60,7 +60,6 @@ import java.io.IOException;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -167,8 +167,6 @@ public class AetherPluginHandler
|
||||
List<Dependency> dependencies = getInstalledDependencies(null);
|
||||
|
||||
collectDependencies(dependency, dependencies);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -364,13 +362,10 @@ public class AetherPluginHandler
|
||||
{
|
||||
String id = plugin.getId();
|
||||
|
||||
if ((skipId == null) ||!id.equals(skipId))
|
||||
if (Util.isNotEmpty(id) && ((skipId == null) ||!id.equals(skipId)))
|
||||
{
|
||||
if (Util.isNotEmpty(id))
|
||||
{
|
||||
dependencies.add(new Dependency(new DefaultArtifact(id),
|
||||
PLUGIN_SCOPE));
|
||||
}
|
||||
dependencies.add(new Dependency(new DefaultArtifact(id),
|
||||
PLUGIN_SCOPE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,8 @@ public class OverviewPluginFilter implements PluginFilter
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static OverviewPluginFilter INSTANCE = new OverviewPluginFilter();
|
||||
public static final OverviewPluginFilter INSTANCE =
|
||||
new OverviewPluginFilter();
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -44,11 +44,9 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.ConfigurationException;
|
||||
import sonia.scm.HandlerEvent;
|
||||
import sonia.scm.SCMContext;
|
||||
import sonia.scm.SCMContextProvider;
|
||||
import sonia.scm.Type;
|
||||
import sonia.scm.repository.AbstractRepositoryManager;
|
||||
import sonia.scm.repository.Permission;
|
||||
import sonia.scm.repository.PermissionType;
|
||||
import sonia.scm.repository.PermissionUtil;
|
||||
import sonia.scm.repository.Repository;
|
||||
@@ -69,7 +67,6 @@ import sonia.scm.web.security.WebSecurityContext;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -100,12 +97,15 @@ public class XmlRepositoryManager extends AbstractRepositoryManager
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param contextProvider
|
||||
* @param securityContextProvider
|
||||
* @param storeFactory
|
||||
* @param handlerSet
|
||||
*/
|
||||
@Inject
|
||||
public XmlRepositoryManager(
|
||||
SCMContextProvider contextProvider,
|
||||
Provider<WebSecurityContext> securityContextProvider,
|
||||
StoreFactory storeFactory, Set<RepositoryHandler> handlerSet)
|
||||
{
|
||||
@@ -116,7 +116,7 @@ public class XmlRepositoryManager extends AbstractRepositoryManager
|
||||
|
||||
for (RepositoryHandler handler : handlerSet)
|
||||
{
|
||||
addHandler(handler);
|
||||
addHandler(contextProvider, handler);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,7 +332,6 @@ public class XmlRepositoryManager extends AbstractRepositoryManager
|
||||
{
|
||||
assertIsReader(repository);
|
||||
repository = repository.clone();
|
||||
prepareRepository(repository);
|
||||
}
|
||||
|
||||
return repository;
|
||||
@@ -360,7 +359,6 @@ public class XmlRepositoryManager extends AbstractRepositoryManager
|
||||
if (isReader(repository))
|
||||
{
|
||||
repository = repository.clone();
|
||||
prepareRepository(repository);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -388,7 +386,6 @@ public class XmlRepositoryManager extends AbstractRepositoryManager
|
||||
{
|
||||
Repository r = repository.clone();
|
||||
|
||||
prepareRepository(r);
|
||||
repositories.add(r);
|
||||
}
|
||||
}
|
||||
@@ -428,9 +425,12 @@ public class XmlRepositoryManager extends AbstractRepositoryManager
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param contextProvider
|
||||
* @param handler
|
||||
*/
|
||||
private void addHandler(RepositoryHandler handler)
|
||||
private void addHandler(SCMContextProvider contextProvider,
|
||||
RepositoryHandler handler)
|
||||
{
|
||||
AssertUtil.assertIsNotNull(handler);
|
||||
|
||||
@@ -451,7 +451,7 @@ public class XmlRepositoryManager extends AbstractRepositoryManager
|
||||
}
|
||||
|
||||
handlerMap.put(type.getName(), handler);
|
||||
handler.init(SCMContext.getContext());
|
||||
handler.init(contextProvider);
|
||||
types.add(type);
|
||||
}
|
||||
|
||||
@@ -493,27 +493,6 @@ public class XmlRepositoryManager extends AbstractRepositoryManager
|
||||
PermissionType.READ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param repository
|
||||
*/
|
||||
private void prepareRepository(Repository repository)
|
||||
{
|
||||
if (isOwner(repository))
|
||||
{
|
||||
if (repository.getPermissions() == null)
|
||||
{
|
||||
repository.setPermissions(new ArrayList<Permission>());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
repository.setPermissions(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -574,20 +553,6 @@ public class XmlRepositoryManager extends AbstractRepositoryManager
|
||||
return handler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param repository
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private boolean isOwner(Repository repository)
|
||||
{
|
||||
return PermissionUtil.hasPermission(repository, securityContextProvider,
|
||||
PermissionType.OWNER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
@@ -36,10 +36,10 @@ package sonia.scm.repository;
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.Manager;
|
||||
import sonia.scm.util.MockUtil;
|
||||
import sonia.scm.repository.xml.XmlRepositoryManager;
|
||||
import sonia.scm.store.JAXBStoreFactory;
|
||||
import sonia.scm.store.StoreFactory;
|
||||
import sonia.scm.util.MockUtil;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
@@ -68,7 +68,8 @@ public class XmlRepositoryManagerTest extends RepositoryManagerTestBase
|
||||
factory.init(contextProvider);
|
||||
handlerSet.add(new DummyRepositoryHandler(factory));
|
||||
|
||||
return new XmlRepositoryManager(MockUtil.getAdminSecurityContextProvider(),
|
||||
return new XmlRepositoryManager(contextProvider,
|
||||
MockUtil.getAdminSecurityContextProvider(),
|
||||
factory, handlerSet);
|
||||
}
|
||||
}
|
||||
|
||||
4
third-party/pom.xml
vendored
4
third-party/pom.xml
vendored
@@ -6,13 +6,13 @@
|
||||
<parent>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm.third-party</groupId>
|
||||
<artifactId>sonia.scm.third-party</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>third-party</name>
|
||||
|
||||
<modules>
|
||||
|
||||
4
third-party/shared-libs/pom.xml
vendored
4
third-party/shared-libs/pom.xml
vendored
@@ -6,13 +6,13 @@
|
||||
<parent>
|
||||
<groupId>sonia.scm.third-party</groupId>
|
||||
<artifactId>sonia.scm.third-party</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm.third-party</groupId>
|
||||
<artifactId>shared-libs</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
<name>shared-libs</name>
|
||||
|
||||
<build>
|
||||
|
||||
2
third-party/svnkit-dav/pom.xml
vendored
2
third-party/svnkit-dav/pom.xml
vendored
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>sonia.scm.third-party</groupId>
|
||||
<artifactId>sonia.scm.third-party</artifactId>
|
||||
<version>1.0-M7-SNAPSHOT</version>
|
||||
<version>1.0-RC1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.tmatesoft.svnkit</groupId>
|
||||
|
||||
Reference in New Issue
Block a user