diff --git a/pom.xml b/pom.xml
index 2bdb8ff60e..2283807bd2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,6 +56,7 @@
samples
scm-webapp
scm-server
+ scm-plugin-backend
diff --git a/scm-plugin-backend/pom.xml b/scm-plugin-backend/pom.xml
new file mode 100644
index 0000000000..a07f09751d
--- /dev/null
+++ b/scm-plugin-backend/pom.xml
@@ -0,0 +1,46 @@
+
+
+
+ 4.0.0
+
+
+ scm
+ sonia.scm
+ 1.1-SNAPSHOT
+
+
+ sonia.scm
+ scm-plugin-backend
+ war
+ 1.0-SNAPSHOT
+ ${project.artifactId}
+
+
+
+
+ javax.servlet
+ servlet-api
+ ${servlet.version}
+ provided
+
+
+
+ sonia.scm
+ scm-core
+ 1.1-SNAPSHOT
+
+
+
+ ch.qos.logback
+ logback-classic
+ 0.9.28
+
+
+
+
+
+ scm-plugin-backend
+
+
+
+
diff --git a/scm-plugin-backend/src/main/java/sonia/scm/plugin/BackendConfiguration.java b/scm-plugin-backend/src/main/java/sonia/scm/plugin/BackendConfiguration.java
new file mode 100644
index 0000000000..a3e463f15c
--- /dev/null
+++ b/scm-plugin-backend/src/main/java/sonia/scm/plugin/BackendConfiguration.java
@@ -0,0 +1,162 @@
+/**
+ * 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.plugin;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.File;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+@XmlRootElement(name = "configuration")
+public class BackendConfiguration
+{
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ public List getDirectories()
+ {
+ return directories;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ public List getRepositories()
+ {
+ return repositories;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ public long getScannInterval()
+ {
+ return scannInterval;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ public boolean isMultithreaded()
+ {
+ return multithreaded;
+ }
+
+ //~--- set methods ----------------------------------------------------------
+
+ /**
+ * Method description
+ *
+ *
+ * @param directories
+ */
+ public void setDirectories(List directories)
+ {
+ this.directories = directories;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @param multithreaded
+ */
+ public void setMultithreaded(boolean multithreaded)
+ {
+ this.multithreaded = multithreaded;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @param repositories
+ */
+ public void setRepositories(List repositories)
+ {
+ this.repositories = repositories;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @param scannInterval
+ */
+ public void setScannInterval(long scannInterval)
+ {
+ this.scannInterval = scannInterval;
+ }
+
+ //~--- fields ---------------------------------------------------------------
+
+ /** Field description */
+ @XmlElement(name = "directory")
+ @XmlElementWrapper(name = "directories")
+ private List directories;
+
+ /** Field description */
+ private boolean multithreaded = true;
+
+ /** Field description */
+ @XmlElement(name = "repository")
+ @XmlElementWrapper(name = "repositories")
+ private List repositories;
+
+ /** Field description */
+ @XmlElement(name = "scann-interval")
+ private long scannInterval;
+}
diff --git a/scm-plugin-backend/src/main/java/sonia/scm/plugin/BackendContextListener.java b/scm-plugin-backend/src/main/java/sonia/scm/plugin/BackendContextListener.java
new file mode 100644
index 0000000000..05672e3380
--- /dev/null
+++ b/scm-plugin-backend/src/main/java/sonia/scm/plugin/BackendContextListener.java
@@ -0,0 +1,105 @@
+/**
+ * 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.plugin;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.servlet.GuiceServletContextListener;
+
+import sonia.scm.plugin.scanner.PluginScannerScheduler;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import javax.servlet.ServletContextEvent;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+public class BackendContextListener extends GuiceServletContextListener
+{
+
+ /**
+ * Method description
+ *
+ *
+ * @param servletContextEvent
+ */
+ @Override
+ public void contextDestroyed(ServletContextEvent servletContextEvent)
+ {
+ scheduler.shutdown();
+ super.contextDestroyed(servletContextEvent);
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @param servletContextEvent
+ */
+ @Override
+ public void contextInitialized(ServletContextEvent servletContextEvent)
+ {
+ super.contextInitialized(servletContextEvent);
+ scheduler = injector.getInstance(PluginScannerScheduler.class);
+ scheduler.start();
+ }
+
+ //~--- get methods ----------------------------------------------------------
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ @Override
+ protected Injector getInjector()
+ {
+ injector = Guice.createInjector(new ScmBackendModule());
+
+ return injector;
+ }
+
+ //~--- fields ---------------------------------------------------------------
+
+ /** Field description */
+ private Injector injector;
+
+ /** Field description */
+ private PluginScannerScheduler scheduler;
+}
diff --git a/scm-plugin-backend/src/main/java/sonia/scm/plugin/DefaultPluginBackend.java b/scm-plugin-backend/src/main/java/sonia/scm/plugin/DefaultPluginBackend.java
new file mode 100644
index 0000000000..455ab16409
--- /dev/null
+++ b/scm-plugin-backend/src/main/java/sonia/scm/plugin/DefaultPluginBackend.java
@@ -0,0 +1,124 @@
+/**
+ * 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.plugin;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+public class DefaultPluginBackend implements PluginBackend
+{
+
+ /**
+ * Constructs ...
+ *
+ */
+ public DefaultPluginBackend() {}
+
+ //~--- methods --------------------------------------------------------------
+
+ /**
+ * Method description
+ *
+ *
+ * @param plugin
+ */
+ @Override
+ public void addPlugin(PluginInformation plugin)
+ {
+ plugins.add(plugin);
+ }
+
+ //~--- get methods ----------------------------------------------------------
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ @Override
+ public List getPlugins()
+ {
+ return plugins;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @param filter
+ *
+ * @return
+ */
+ @Override
+ public List getPlugins(PluginFilter filter)
+ {
+ List filteredPlugins =
+ new ArrayList();
+
+ for (PluginInformation plugin : plugins)
+ {
+ if (filter.accept(plugin))
+ {
+ filteredPlugins.add(plugin);
+ }
+ }
+
+ return filteredPlugins;
+ }
+
+ //~--- set methods ----------------------------------------------------------
+
+ /**
+ * Method description
+ *
+ *
+ * @param plugins
+ */
+ public void setPlugins(List plugins)
+ {
+ this.plugins = plugins;
+ }
+
+ //~--- fields ---------------------------------------------------------------
+
+ /** Field description */
+ private List plugins = new ArrayList();
+}
diff --git a/scm-plugin-backend/src/main/java/sonia/scm/plugin/PluginBackend.java b/scm-plugin-backend/src/main/java/sonia/scm/plugin/PluginBackend.java
new file mode 100644
index 0000000000..e664b6c122
--- /dev/null
+++ b/scm-plugin-backend/src/main/java/sonia/scm/plugin/PluginBackend.java
@@ -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.plugin;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.util.List;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+public interface PluginBackend
+{
+
+ /**
+ * Method description
+ *
+ *
+ * @param plugin
+ */
+ public void addPlugin(PluginInformation plugin);
+
+ //~--- get methods ----------------------------------------------------------
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ public List getPlugins();
+
+ /**
+ * Method description
+ *
+ *
+ * @param filter
+ *
+ * @return
+ */
+ public List getPlugins(PluginFilter filter);
+}
diff --git a/scm-plugin-backend/src/main/java/sonia/scm/plugin/ScmBackendModule.java b/scm-plugin-backend/src/main/java/sonia/scm/plugin/ScmBackendModule.java
new file mode 100644
index 0000000000..ba5400e583
--- /dev/null
+++ b/scm-plugin-backend/src/main/java/sonia/scm/plugin/ScmBackendModule.java
@@ -0,0 +1,63 @@
+/**
+ * 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.plugin;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import com.google.inject.servlet.ServletModule;
+
+import sonia.scm.plugin.scanner.DefaultPluginScannerFactory;
+import sonia.scm.plugin.scanner.PluginScannerFactory;
+import sonia.scm.plugin.scanner.PluginScannerScheduler;
+import sonia.scm.plugin.scanner.TimerPluginScannerScheduler;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+public class ScmBackendModule extends ServletModule
+{
+
+ /**
+ * Method description
+ *
+ */
+ @Override
+ protected void configureServlets()
+ {
+ bind(PluginBackend.class).to(DefaultPluginBackend.class);
+ bind(PluginScannerFactory.class).to(DefaultPluginScannerFactory.class);
+ bind(PluginScannerScheduler.class).to(TimerPluginScannerScheduler.class);
+ }
+}
diff --git a/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/DefaultPluginScanner.java b/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/DefaultPluginScanner.java
new file mode 100644
index 0000000000..982d493de9
--- /dev/null
+++ b/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/DefaultPluginScanner.java
@@ -0,0 +1,174 @@
+/**
+ * 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.plugin.scanner;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import sonia.scm.plugin.Plugin;
+import sonia.scm.plugin.PluginBackend;
+import sonia.scm.plugin.PluginException;
+import sonia.scm.util.IOUtil;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.File;
+import java.io.FileInputStream;
+
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+public class DefaultPluginScanner implements PluginScanner
+{
+
+ /** Field description */
+ public static final String PLUGIN_DESCRIPTOR = "/META-INF/scm/plugin.xml";
+
+ /** Field description */
+ public static final String PLUGIN_EXTENSION = ".jar";
+
+ /** the logger for DefaultPluginScanner */
+ private static final Logger logger =
+ LoggerFactory.getLogger(DefaultPluginScanner.class);
+
+ //~--- constructors ---------------------------------------------------------
+
+ /**
+ * Constructs ...
+ *
+ */
+ public DefaultPluginScanner()
+ {
+ try
+ {
+ pluginContext = JAXBContext.newInstance(Plugin.class);
+ }
+ catch (JAXBException ex)
+ {
+ throw new PluginException(ex);
+ }
+ }
+
+ //~--- methods --------------------------------------------------------------
+
+ /**
+ * Method description
+ *
+ *
+ * @param backend
+ * @param directory
+ */
+ @Override
+ public void scannDirectory(PluginBackend backend, File directory)
+ {
+ File[] files = directory.listFiles();
+
+ for (File file : files)
+ {
+ if (file.isDirectory())
+ {
+ scannDirectory(backend, directory);
+ }
+ else if (file.getName().endsWith(PLUGIN_EXTENSION))
+ {
+ scannFile(backend, file);
+ }
+ }
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @param backend
+ * @param file
+ */
+ private void scannFile(PluginBackend backend, File file)
+ {
+ JarInputStream inputStream = null;
+
+ try
+ {
+ inputStream = new JarInputStream(new FileInputStream(file));
+
+ JarEntry entry = inputStream.getNextJarEntry();
+
+ while (entry != null)
+ {
+ if (PLUGIN_DESCRIPTOR.equals(entry.getName()))
+ {
+ Plugin plugin =
+ (Plugin) pluginContext.createUnmarshaller().unmarshal(inputStream);
+
+ if (plugin != null)
+ {
+ if ( logger.isInfoEnabled() )
+ {
+ logger.info( "add plugin {} to backend", file.getPath() );
+ }
+
+ backend.addPlugin(plugin.getInformation());
+ }
+
+ break;
+ }
+
+ inputStream.closeEntry();
+ }
+ }
+ catch (Exception ex)
+ {
+ logger.error("could not read plugin descriptor ".concat(file.getPath()),
+ ex);
+ }
+ finally
+ {
+ IOUtil.close(inputStream);
+ }
+ }
+
+ //~--- fields ---------------------------------------------------------------
+
+ /** Field description */
+ private JAXBContext pluginContext;
+}
diff --git a/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/DefaultPluginScannerFactory.java b/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/DefaultPluginScannerFactory.java
new file mode 100644
index 0000000000..b54ae9566c
--- /dev/null
+++ b/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/DefaultPluginScannerFactory.java
@@ -0,0 +1,54 @@
+/**
+ * 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.plugin.scanner;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+public class DefaultPluginScannerFactory implements PluginScannerFactory
+{
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ @Override
+ public PluginScanner createScanner()
+ {
+ return new DefaultPluginScanner();
+ }
+}
diff --git a/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/PluginScanner.java b/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/PluginScanner.java
new file mode 100644
index 0000000000..94b76888a5
--- /dev/null
+++ b/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/PluginScanner.java
@@ -0,0 +1,57 @@
+/**
+ * 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.plugin.scanner;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.File;
+import sonia.scm.plugin.PluginBackend;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+public interface PluginScanner
+{
+
+ /**
+ * Method description
+ *
+ *
+ *
+ * @param backend
+ * @param directory
+ */
+ public void scannDirectory(PluginBackend backend, File directory);
+}
diff --git a/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/PluginScannerFactory.java b/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/PluginScannerFactory.java
new file mode 100644
index 0000000000..c5de3a14d2
--- /dev/null
+++ b/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/PluginScannerFactory.java
@@ -0,0 +1,50 @@
+/**
+ * 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.plugin.scanner;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+public interface PluginScannerFactory
+{
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ public PluginScanner createScanner();
+}
diff --git a/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/PluginScannerRunnable.java b/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/PluginScannerRunnable.java
new file mode 100644
index 0000000000..cbefb8e71f
--- /dev/null
+++ b/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/PluginScannerRunnable.java
@@ -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.plugin.scanner;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import sonia.scm.plugin.PluginBackend;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.File;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+public class PluginScannerRunnable implements Runnable
+{
+
+ /**
+ * Constructs ...
+ *
+ *
+ * @param backend
+ * @param pluginScanner
+ * @param directory
+ */
+ public PluginScannerRunnable(PluginBackend backend,
+ PluginScanner pluginScanner, File directory)
+ {
+ this.backend = backend;
+ this.pluginScanner = pluginScanner;
+ this.directory = directory;
+ }
+
+ //~--- methods --------------------------------------------------------------
+
+ /**
+ * Method description
+ *
+ */
+ @Override
+ public void run()
+ {
+ pluginScanner.scannDirectory(backend, directory);
+ }
+
+ //~--- fields ---------------------------------------------------------------
+
+ /** Field description */
+ private PluginBackend backend;
+
+ /** Field description */
+ private File directory;
+
+ /** Field description */
+ private PluginScanner pluginScanner;
+}
diff --git a/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/PluginScannerScheduler.java b/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/PluginScannerScheduler.java
new file mode 100644
index 0000000000..86cc59b7a1
--- /dev/null
+++ b/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/PluginScannerScheduler.java
@@ -0,0 +1,54 @@
+/**
+ * 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.plugin.scanner;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+public interface PluginScannerScheduler
+{
+
+ /**
+ * Method description
+ *
+ */
+ public void shutdown();
+
+ /**
+ * Method description
+ *
+ */
+ public void start();
+}
diff --git a/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/PluginScannerTimerTask.java b/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/PluginScannerTimerTask.java
new file mode 100644
index 0000000000..3ce6f0c852
--- /dev/null
+++ b/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/PluginScannerTimerTask.java
@@ -0,0 +1,105 @@
+/**
+ * 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.plugin.scanner;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import sonia.scm.plugin.BackendConfiguration;
+import sonia.scm.plugin.PluginBackend;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.File;
+
+import java.util.TimerTask;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+public class PluginScannerTimerTask extends TimerTask
+{
+
+ /**
+ * Constructs ...
+ *
+ *
+ * @param backend
+ * @param configuration
+ * @param scannerFactory
+ */
+ public PluginScannerTimerTask(PluginBackend backend,
+ BackendConfiguration configuration,
+ PluginScannerFactory scannerFactory)
+ {
+ this.backend = backend;
+ this.scannerFactory = scannerFactory;
+ }
+
+ //~--- methods --------------------------------------------------------------
+
+ /**
+ * Method description
+ *
+ */
+ @Override
+ public void run()
+ {
+ for (File directory : configuration.getDirectories())
+ {
+ PluginScanner scanner = scannerFactory.createScanner();
+
+ if (configuration.isMultithreaded())
+ {
+ new Thread(new PluginScannerRunnable(backend, scanner,
+ directory)).start();
+ }
+ else
+ {
+ scanner.scannDirectory(backend, directory);
+ }
+ }
+ }
+
+ //~--- fields ---------------------------------------------------------------
+
+ /** Field description */
+ private PluginBackend backend;
+
+ /** Field description */
+ private BackendConfiguration configuration;
+
+ /** Field description */
+ private PluginScannerFactory scannerFactory;
+}
diff --git a/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/TimerPluginScannerScheduler.java b/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/TimerPluginScannerScheduler.java
new file mode 100644
index 0000000000..42b7449a24
--- /dev/null
+++ b/scm-plugin-backend/src/main/java/sonia/scm/plugin/scanner/TimerPluginScannerScheduler.java
@@ -0,0 +1,112 @@
+/**
+ * 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.plugin.scanner;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import com.google.inject.Inject;
+
+import sonia.scm.plugin.BackendConfiguration;
+import sonia.scm.plugin.PluginBackend;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.util.Timer;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ */
+public class TimerPluginScannerScheduler implements PluginScannerScheduler
+{
+
+ /** Field description */
+ public static final String TIMER_NAME = "ScmPluginScanner";
+
+ //~--- constructors ---------------------------------------------------------
+
+ /**
+ * Constructs ...
+ *
+ *
+ * @param backend
+ * @param configuration
+ * @param scannerFactory
+ */
+ @Inject
+ public TimerPluginScannerScheduler(PluginBackend backend,
+ BackendConfiguration configuration,
+ PluginScannerFactory scannerFactory)
+ {
+ this.configuration = configuration;
+ timer = new Timer(TIMER_NAME);
+ }
+
+ //~--- methods --------------------------------------------------------------
+
+ /**
+ * Method description
+ *
+ */
+ @Override
+ public void shutdown()
+ {
+ timer.cancel();
+ }
+
+ /**
+ * Method description
+ *
+ */
+ @Override
+ public void start()
+ {
+ PluginScannerTimerTask task = new PluginScannerTimerTask(backend, configuration, scannerFactory);
+ timer.schedule(task, configuration.getScannInterval());
+ }
+
+ //~--- fields ---------------------------------------------------------------
+
+ /** Field description */
+ private PluginBackend backend;
+
+ /** Field description */
+ private BackendConfiguration configuration;
+
+ /** Field description */
+ private PluginScannerFactory scannerFactory;
+
+ /** Field description */
+ private Timer timer;
+}
diff --git a/scm-plugin-backend/src/main/webapp/WEB-INF/web.xml b/scm-plugin-backend/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..535d015510
--- /dev/null
+++ b/scm-plugin-backend/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,52 @@
+
+
+
+
+ sonia.scm.plugin.BackendContextListener
+
+
+ guiceFilter
+ com.google.inject.servlet.GuiceFilter
+
+
+ guiceFilter
+ /*
+
+
+ index.html
+
+
+ 30
+
+