mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
improve ScmWebPlugin api
This commit is contained in:
@@ -7,14 +7,6 @@
|
||||
|
||||
package sonia.scm.web;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.Module;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -22,7 +14,19 @@ import java.io.InputStream;
|
||||
public interface ScmWebPlugin
|
||||
{
|
||||
|
||||
public void contextInitialized( ScmWebPluginContext context );
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public void contextDestroyed(ScmWebPluginContext context);
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public void contextInitialized(ScmWebPluginContext context);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -24,6 +26,19 @@ import java.util.Set;
|
||||
public class ScmWebPluginContext
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param servletContext
|
||||
*/
|
||||
public ScmWebPluginContext(ServletContext servletContext)
|
||||
{
|
||||
this.servletContext = servletContext;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -92,6 +107,17 @@ public class ScmWebPluginContext
|
||||
return scriptResources;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ServletContext getServletContext()
|
||||
{
|
||||
return servletContext;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@@ -99,4 +125,7 @@ public class ScmWebPluginContext
|
||||
|
||||
/** Field description */
|
||||
private Set<Module> injectModules = new HashSet<Module>();
|
||||
|
||||
/** Field description */
|
||||
private ServletContext servletContext;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,8 @@ public class ContextListener extends GuiceServletContextListener
|
||||
@Override
|
||||
public void contextInitialized(ServletContextEvent servletContextEvent)
|
||||
{
|
||||
webPluginContext = new ScmWebPluginContext();
|
||||
webPluginContext =
|
||||
new ScmWebPluginContext(servletContextEvent.getServletContext());
|
||||
|
||||
List<ScmWebPlugin> plugins = ServiceUtil.getServices(ScmWebPlugin.class);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user