added SvnDAVServlet to scm-svn-plugin

This commit is contained in:
Sebastian Sdorra
2010-11-14 13:51:33 +01:00
parent 85c8cff734
commit da793d4481
101 changed files with 16896 additions and 0 deletions

View File

@@ -23,6 +23,12 @@
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.tmatesoft.svnkit</groupId>
<artifactId>svnkit-dav</artifactId>
<version>1.3.4</version>
</dependency>
</dependencies>
</project>

View File

@@ -35,6 +35,8 @@ package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.inject.Singleton;
import sonia.scm.Type;
import sonia.scm.io.ExtendedCommand;
@@ -46,6 +48,7 @@ import java.io.File;
*
* @author Sebastian Sdorra
*/
@Singleton
public class SvnRepositoryHandler
extends AbstractSimpleRepositoryHandler<SvnConfig>
{

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -0,0 +1,68 @@
/**
* 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;
/**
*
* @author Sebastian Sdorra
*/
public class SvnServletModule extends ServletModule
{
/**
* Method description
*
*/
@Override
protected void configureServlets()
{
filter("/svn/*").through(BasicAuthenticationFilter.class);
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("SVNParentPath", System.getProperty("java.io.tmpdir"));
serve("/svn/*").with(SvnDAVServlet.class, parameters);
}
}

View File

@@ -29,6 +29,8 @@
*
*/
package sonia.scm.web;
//~--- non-JDK imports --------------------------------------------------------
@@ -72,5 +74,6 @@ public class SvnWebPlugin implements ScmWebPlugin
public void contextInitialized(ScmWebPluginContext context)
{
context.addScriptResource(new ClasspathWebResource(SCRIPT));
context.addInjectModule(new SvnServletModule());
}
}