mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 16:35:45 +01:00
rebuild plugin system
This commit is contained in:
@@ -40,6 +40,7 @@ import com.google.inject.Singleton;
|
||||
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
|
||||
|
||||
import sonia.scm.Type;
|
||||
import sonia.scm.plugin.ext.Extension;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
@@ -51,6 +52,7 @@ import java.io.IOException;
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Singleton
|
||||
@Extension
|
||||
public class GitRepositoryHandler
|
||||
extends AbstractSimpleRepositoryHandler<GitConfig>
|
||||
{
|
||||
|
||||
@@ -36,59 +36,32 @@ package sonia.scm.web;
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.servlet.ServletModule;
|
||||
import sonia.scm.plugin.ext.Extension;
|
||||
|
||||
import sonia.scm.web.filter.BasicAuthenticationFilter;
|
||||
import sonia.scm.web.plugin.ClasspathWebResource;
|
||||
import sonia.scm.web.plugin.ScmWebPlugin;
|
||||
import sonia.scm.web.plugin.ScmWebPluginContext;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitWebPlugin implements ScmWebPlugin
|
||||
@Extension
|
||||
public class GitServletModule extends ServletModule
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String PATTERN_GIT = "/git/*";
|
||||
|
||||
/** Field description */
|
||||
public static final String SCRIPT = "/sonia/scm/git.config.js";
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
@Override
|
||||
public void contextDestroyed(ScmWebPluginContext context)
|
||||
protected void configureServlets()
|
||||
{
|
||||
|
||||
// do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
@Override
|
||||
public void contextInitialized(ScmWebPluginContext context)
|
||||
{
|
||||
context.addScriptResource(new ClasspathWebResource(SCRIPT));
|
||||
context.addInjectModule(new ServletModule()
|
||||
{
|
||||
@Override
|
||||
protected void configureServlets()
|
||||
{
|
||||
filter(PATTERN_GIT).through(BasicAuthenticationFilter.class);
|
||||
filter(PATTERN_GIT).through(GitPermissionFilter.class);
|
||||
serve(PATTERN_GIT).with(ScmGitServlet.class);
|
||||
}
|
||||
});
|
||||
filter(PATTERN_GIT).through(BasicAuthenticationFilter.class);
|
||||
filter(PATTERN_GIT).through(GitPermissionFilter.class);
|
||||
serve(PATTERN_GIT).with(ScmGitServlet.class);
|
||||
}
|
||||
}
|
||||
@@ -40,12 +40,18 @@
|
||||
Purpose of the document follows.
|
||||
-->
|
||||
|
||||
<plugin-config>
|
||||
<plugin>
|
||||
|
||||
<web-plugin>sonia.scm.web.GitWebPlugin</web-plugin>
|
||||
<information>
|
||||
<name>${project.name}</name>
|
||||
<description>${project.description}</description>
|
||||
<author>Sebastian Sdorra</author>
|
||||
<version>${project.version}</version>
|
||||
<url>http://bitbucket.org/sdorra/scm-manager</url>
|
||||
</information>
|
||||
|
||||
<repository-handlers>
|
||||
<repository-handler>sonia.scm.repository.GitRepositoryHandler</repository-handler>
|
||||
</repository-handlers>
|
||||
|
||||
</plugin-config>
|
||||
<resources>
|
||||
<script>/sonia/scm/git.config.js</script>
|
||||
</resources>
|
||||
|
||||
</plugin>
|
||||
|
||||
Reference in New Issue
Block a user