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