2010-10-31 19:22:53 +01:00
|
|
|
/**
|
|
|
|
|
* 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
|
|
|
|
|
*
|
2010-09-16 21:50:30 +02:00
|
|
|
*/
|
|
|
|
|
|
2010-11-06 16:39:10 +01:00
|
|
|
|
|
|
|
|
|
2010-09-16 21:50:30 +02:00
|
|
|
package sonia.scm;
|
|
|
|
|
|
|
|
|
|
//~--- non-JDK imports --------------------------------------------------------
|
|
|
|
|
|
2011-07-30 11:25:57 +02:00
|
|
|
import com.google.inject.name.Names;
|
2010-09-16 21:50:30 +02:00
|
|
|
import com.google.inject.servlet.ServletModule;
|
|
|
|
|
|
2010-10-16 11:03:54 +02:00
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
2010-09-16 21:50:30 +02:00
|
|
|
import sonia.scm.api.rest.UriExtensionsConfig;
|
2010-10-14 07:58:51 +02:00
|
|
|
import sonia.scm.cache.CacheManager;
|
|
|
|
|
import sonia.scm.cache.EhCacheManager;
|
2010-11-19 18:50:42 +01:00
|
|
|
import sonia.scm.config.ScmConfiguration;
|
2011-02-22 15:06:20 +01:00
|
|
|
import sonia.scm.filter.AdminSecurityFilter;
|
2011-06-23 18:20:09 +02:00
|
|
|
import sonia.scm.filter.BaseUrlFilter;
|
2010-12-29 14:32:55 +01:00
|
|
|
import sonia.scm.filter.GZipFilter;
|
2010-10-15 17:58:16 +02:00
|
|
|
import sonia.scm.filter.SecurityFilter;
|
2010-12-31 16:28:55 +01:00
|
|
|
import sonia.scm.group.GroupManager;
|
|
|
|
|
import sonia.scm.group.xml.XmlGroupManager;
|
2011-01-30 13:48:07 +01:00
|
|
|
import sonia.scm.io.DefaultFileSystem;
|
|
|
|
|
import sonia.scm.io.FileSystem;
|
2011-05-09 12:12:20 +02:00
|
|
|
import sonia.scm.net.HttpClient;
|
|
|
|
|
import sonia.scm.net.URLHttpClient;
|
2010-12-13 18:59:00 +01:00
|
|
|
import sonia.scm.plugin.DefaultPluginManager;
|
2010-12-01 15:15:09 +01:00
|
|
|
import sonia.scm.plugin.Plugin;
|
2010-12-13 18:59:00 +01:00
|
|
|
import sonia.scm.plugin.PluginLoader;
|
2010-12-01 14:26:29 +01:00
|
|
|
import sonia.scm.plugin.PluginManager;
|
2010-09-16 21:50:30 +02:00
|
|
|
import sonia.scm.plugin.ScriptResourceServlet;
|
2011-07-24 14:14:20 +02:00
|
|
|
import sonia.scm.repository.ChangesetViewerUtil;
|
2011-08-03 15:27:05 +02:00
|
|
|
import sonia.scm.repository.RepositoryBrowserUtil;
|
2010-09-16 21:50:30 +02:00
|
|
|
import sonia.scm.repository.RepositoryManager;
|
2010-11-26 17:16:26 +01:00
|
|
|
import sonia.scm.repository.xml.XmlRepositoryManager;
|
2011-09-03 16:52:09 +02:00
|
|
|
import sonia.scm.security.CipherHandler;
|
|
|
|
|
import sonia.scm.security.DefaultCipherHandler;
|
2010-10-31 11:47:16 +01:00
|
|
|
import sonia.scm.security.EncryptionHandler;
|
2011-09-03 16:52:09 +02:00
|
|
|
import sonia.scm.security.KeyGenerator;
|
2010-10-31 11:47:16 +01:00
|
|
|
import sonia.scm.security.MessageDigestEncryptionHandler;
|
2010-12-01 14:26:29 +01:00
|
|
|
import sonia.scm.security.SecurityContext;
|
2011-09-03 16:52:09 +02:00
|
|
|
import sonia.scm.security.UUIDKeyGenerator;
|
2010-12-05 19:26:38 +01:00
|
|
|
import sonia.scm.store.JAXBStoreFactory;
|
|
|
|
|
import sonia.scm.store.StoreFactory;
|
2011-03-27 13:47:47 +02:00
|
|
|
import sonia.scm.template.FreemarkerTemplateHandler;
|
|
|
|
|
import sonia.scm.template.TemplateHandler;
|
|
|
|
|
import sonia.scm.template.TemplateServlet;
|
2010-11-06 16:39:10 +01:00
|
|
|
import sonia.scm.user.UserManager;
|
2010-11-26 17:16:26 +01:00
|
|
|
import sonia.scm.user.xml.XmlUserManager;
|
2010-10-15 17:58:16 +02:00
|
|
|
import sonia.scm.util.DebugServlet;
|
2011-04-20 17:32:29 +02:00
|
|
|
import sonia.scm.util.ScmConfigurationUtil;
|
2011-04-14 18:43:13 +02:00
|
|
|
import sonia.scm.web.cgi.CGIExecutorFactory;
|
|
|
|
|
import sonia.scm.web.cgi.DefaultCGIExecutorFactory;
|
2011-07-30 11:25:57 +02:00
|
|
|
import sonia.scm.web.security.AdministrationContext;
|
2010-12-02 20:44:13 +01:00
|
|
|
import sonia.scm.web.security.AuthenticationManager;
|
2010-10-15 17:58:16 +02:00
|
|
|
import sonia.scm.web.security.BasicSecurityContext;
|
2010-12-02 20:44:13 +01:00
|
|
|
import sonia.scm.web.security.ChainAuthenticatonManager;
|
2011-07-30 11:25:57 +02:00
|
|
|
import sonia.scm.web.security.DefaultAdministrationContext;
|
|
|
|
|
import sonia.scm.web.security.LocalSecurityContextHolder;
|
|
|
|
|
import sonia.scm.web.security.SecurityContextProvider;
|
2010-11-26 17:57:05 +01:00
|
|
|
import sonia.scm.web.security.WebSecurityContext;
|
2010-09-16 21:50:30 +02:00
|
|
|
|
|
|
|
|
//~--- JDK imports ------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
import com.sun.jersey.api.core.PackagesResourceConfig;
|
|
|
|
|
import com.sun.jersey.api.core.ResourceConfig;
|
2010-12-27 16:58:52 +01:00
|
|
|
import com.sun.jersey.api.json.JSONConfiguration;
|
2010-09-16 21:50:30 +02:00
|
|
|
import com.sun.jersey.guice.spi.container.servlet.GuiceContainer;
|
|
|
|
|
import com.sun.jersey.spi.container.servlet.ServletContainer;
|
|
|
|
|
|
2010-12-01 15:15:09 +01:00
|
|
|
import java.util.Collection;
|
2010-09-16 21:50:30 +02:00
|
|
|
import java.util.HashMap;
|
2010-12-01 15:15:09 +01:00
|
|
|
import java.util.HashSet;
|
|
|
|
|
import java.util.Iterator;
|
2010-09-16 21:50:30 +02:00
|
|
|
import java.util.Map;
|
2010-12-01 15:15:09 +01:00
|
|
|
import java.util.Set;
|
2010-09-16 21:50:30 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @author Sebastian Sdorra
|
|
|
|
|
*/
|
|
|
|
|
public class ScmServletModule extends ServletModule
|
|
|
|
|
{
|
|
|
|
|
|
2011-02-22 15:06:20 +01:00
|
|
|
/** Field description */
|
|
|
|
|
public static final String[] PATTERN_ADMIN = new String[] {
|
|
|
|
|
"/api/rest/groups*",
|
|
|
|
|
"/api/rest/users*", "/api/rest/plguins*" };
|
|
|
|
|
|
2010-12-29 14:32:55 +01:00
|
|
|
/** Field description */
|
|
|
|
|
public static final String PATTERN_ALL = "/*";
|
|
|
|
|
|
2011-02-22 15:06:20 +01:00
|
|
|
/** Field description */
|
|
|
|
|
public static final String PATTERN_CONFIG = "/api/rest/config*";
|
|
|
|
|
|
2010-10-15 17:58:16 +02:00
|
|
|
/** Field description */
|
|
|
|
|
public static final String PATTERN_DEBUG = "/debug.html";
|
|
|
|
|
|
2011-03-27 13:47:47 +02:00
|
|
|
/** Field description */
|
|
|
|
|
public static final String PATTERN_INDEX = "/index.html";
|
|
|
|
|
|
2010-09-16 21:50:30 +02:00
|
|
|
/** Field description */
|
|
|
|
|
public static final String PATTERN_PAGE = "*.html";
|
|
|
|
|
|
|
|
|
|
/** Field description */
|
|
|
|
|
public static final String PATTERN_PLUGIN_SCRIPT = "/plugins/sonia.plugin.js";
|
|
|
|
|
|
|
|
|
|
/** Field description */
|
|
|
|
|
public static final String PATTERN_RESTAPI = "/api/rest/*";
|
|
|
|
|
|
|
|
|
|
/** Field description */
|
|
|
|
|
public static final String PATTERN_SCRIPT = "*.js";
|
|
|
|
|
|
|
|
|
|
/** Field description */
|
|
|
|
|
public static final String PATTERN_STYLESHEET = "*.css";
|
|
|
|
|
|
2011-01-15 15:22:04 +01:00
|
|
|
/** Field description */
|
|
|
|
|
public static final String RESOURCE_REGEX =
|
|
|
|
|
"^/(?:resources|api|plugins|index)[\\./].*(?:html|\\.css|\\.js|\\.xml|\\.json|\\.txt)";
|
|
|
|
|
|
2010-09-16 21:50:30 +02:00
|
|
|
/** Field description */
|
|
|
|
|
public static final String REST_PACKAGE = "sonia.scm.api.rest";
|
|
|
|
|
|
|
|
|
|
/** Field description */
|
|
|
|
|
public static final String[] PATTERN_STATIC_RESOURCES = new String[] {
|
|
|
|
|
PATTERN_SCRIPT,
|
|
|
|
|
PATTERN_STYLESHEET, "*.jpg", "*.gif", "*.png" };
|
|
|
|
|
|
|
|
|
|
/** Field description */
|
|
|
|
|
public static final String[] PATTERN_COMPRESSABLE = new String[] {
|
|
|
|
|
PATTERN_SCRIPT,
|
|
|
|
|
PATTERN_STYLESHEET, "*.json", "*.xml", "*.txt" };
|
|
|
|
|
|
2010-10-16 11:03:54 +02:00
|
|
|
/** Field description */
|
|
|
|
|
private static Logger logger =
|
|
|
|
|
LoggerFactory.getLogger(ScmServletModule.class);
|
|
|
|
|
|
2010-09-16 21:50:30 +02:00
|
|
|
//~--- constructors ---------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs ...
|
|
|
|
|
*
|
|
|
|
|
*
|
2010-12-13 18:59:00 +01:00
|
|
|
* @param pluginLoader
|
2010-12-01 14:26:29 +01:00
|
|
|
* @param bindExtProcessor
|
2010-09-16 21:50:30 +02:00
|
|
|
*/
|
2010-12-13 18:59:00 +01:00
|
|
|
ScmServletModule(PluginLoader pluginLoader,
|
2010-12-01 14:26:29 +01:00
|
|
|
BindingExtensionProcessor bindExtProcessor)
|
2010-09-16 21:50:30 +02:00
|
|
|
{
|
2010-12-13 18:59:00 +01:00
|
|
|
this.pluginLoader = pluginLoader;
|
2010-12-01 14:26:29 +01:00
|
|
|
this.bindExtProcessor = bindExtProcessor;
|
2010-09-16 21:50:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//~--- methods --------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Method description
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
protected void configureServlets()
|
|
|
|
|
{
|
|
|
|
|
SCMContextProvider context = SCMContext.getContext();
|
|
|
|
|
|
|
|
|
|
bind(SCMContextProvider.class).toInstance(context);
|
2010-10-31 13:20:53 +01:00
|
|
|
|
2010-11-19 18:50:42 +01:00
|
|
|
ScmConfiguration config = getScmConfiguration(context);
|
|
|
|
|
|
2010-12-05 19:26:38 +01:00
|
|
|
bind(StoreFactory.class).to(JAXBStoreFactory.class);
|
2010-11-19 18:50:42 +01:00
|
|
|
bind(ScmConfiguration.class).toInstance(config);
|
2010-12-13 18:59:00 +01:00
|
|
|
bind(PluginLoader.class).toInstance(pluginLoader);
|
|
|
|
|
bind(PluginManager.class).to(DefaultPluginManager.class);
|
2011-09-03 16:52:09 +02:00
|
|
|
bind(KeyGenerator.class).to(UUIDKeyGenerator.class);
|
2010-12-01 14:26:29 +01:00
|
|
|
bind(EncryptionHandler.class).to(MessageDigestEncryptionHandler.class);
|
2011-09-03 16:52:09 +02:00
|
|
|
bind(CipherHandler.class).to(DefaultCipherHandler.class);
|
2010-12-02 20:44:13 +01:00
|
|
|
bindExtProcessor.bindExtensions(binder());
|
|
|
|
|
|
2011-01-30 13:48:07 +01:00
|
|
|
Class<? extends FileSystem> fileSystem =
|
|
|
|
|
bindExtProcessor.getFileSystemClass();
|
|
|
|
|
|
|
|
|
|
if (fileSystem == null)
|
|
|
|
|
{
|
|
|
|
|
fileSystem = DefaultFileSystem.class;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bind(FileSystem.class).to(fileSystem);
|
|
|
|
|
|
2010-12-02 20:44:13 +01:00
|
|
|
// bind security stuff
|
|
|
|
|
bind(AuthenticationManager.class).to(ChainAuthenticatonManager.class);
|
2011-07-30 11:25:57 +02:00
|
|
|
bind(LocalSecurityContextHolder.class);
|
|
|
|
|
bind(WebSecurityContext.class).annotatedWith(Names.named("userSession")).to(
|
|
|
|
|
BasicSecurityContext.class);
|
|
|
|
|
bind(SecurityContext.class).toProvider(SecurityContextProvider.class);
|
|
|
|
|
bind(WebSecurityContext.class).toProvider(SecurityContextProvider.class);
|
|
|
|
|
bind(AdministrationContext.class).to(DefaultAdministrationContext.class);
|
2010-12-02 20:44:13 +01:00
|
|
|
|
|
|
|
|
// bind security cache
|
2010-10-14 07:58:51 +02:00
|
|
|
bind(CacheManager.class).to(EhCacheManager.class);
|
2010-11-26 17:16:26 +01:00
|
|
|
|
|
|
|
|
// bind(RepositoryManager.class).annotatedWith(Undecorated.class).to(
|
|
|
|
|
// BasicRepositoryManager.class);
|
2010-11-25 21:56:06 +01:00
|
|
|
bind(RepositoryManager.class).to(XmlRepositoryManager.class);
|
2010-11-26 15:37:35 +01:00
|
|
|
bind(UserManager.class).to(XmlUserManager.class);
|
2010-12-31 16:28:55 +01:00
|
|
|
bind(GroupManager.class).to(XmlGroupManager.class);
|
2011-04-14 18:43:13 +02:00
|
|
|
bind(CGIExecutorFactory.class).to(DefaultCGIExecutorFactory.class);
|
2011-07-24 14:14:20 +02:00
|
|
|
bind(ChangesetViewerUtil.class);
|
2011-08-03 15:27:05 +02:00
|
|
|
bind(RepositoryBrowserUtil.class);
|
2010-11-19 18:50:42 +01:00
|
|
|
|
2011-05-09 12:12:20 +02:00
|
|
|
// bind httpclient
|
|
|
|
|
bind(HttpClient.class).to(URLHttpClient.class);
|
|
|
|
|
|
2010-09-29 09:10:41 +02:00
|
|
|
/*
|
|
|
|
|
* filter(PATTERN_PAGE,
|
|
|
|
|
* PATTERN_STATIC_RESOURCES).through(StaticResourceFilter.class);
|
|
|
|
|
*/
|
2011-06-23 18:20:09 +02:00
|
|
|
filter(PATTERN_ALL).through(BaseUrlFilter.class);
|
2011-01-15 15:22:04 +01:00
|
|
|
filterRegex(RESOURCE_REGEX).through(GZipFilter.class);
|
2010-10-15 17:58:16 +02:00
|
|
|
filter(PATTERN_RESTAPI, PATTERN_DEBUG).through(SecurityFilter.class);
|
2011-02-22 15:06:20 +01:00
|
|
|
filter(PATTERN_CONFIG, PATTERN_ADMIN).through(AdminSecurityFilter.class);
|
2010-10-15 17:58:16 +02:00
|
|
|
|
|
|
|
|
// debug servlet
|
|
|
|
|
serve(PATTERN_DEBUG).with(DebugServlet.class);
|
2010-09-16 21:50:30 +02:00
|
|
|
|
|
|
|
|
// plugin resources
|
|
|
|
|
serve(PATTERN_PLUGIN_SCRIPT).with(ScriptResourceServlet.class);
|
|
|
|
|
|
2011-03-27 13:47:47 +02:00
|
|
|
// template
|
|
|
|
|
bind(TemplateHandler.class).to(FreemarkerTemplateHandler.class);
|
|
|
|
|
serve(PATTERN_INDEX, "/").with(TemplateServlet.class);
|
|
|
|
|
|
2010-09-16 21:50:30 +02:00
|
|
|
// jersey
|
|
|
|
|
Map<String, String> params = new HashMap<String, String>();
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* params.put("com.sun.jersey.spi.container.ContainerRequestFilters",
|
|
|
|
|
* "com.sun.jersey.api.container.filter.LoggingFilter");
|
|
|
|
|
* params.put("com.sun.jersey.spi.container.ContainerResponseFilters",
|
|
|
|
|
* "com.sun.jersey.api.container.filter.LoggingFilter");
|
|
|
|
|
* params.put("com.sun.jersey.config.feature.Trace", "true");
|
|
|
|
|
* params.put("com.sun.jersey.config.feature.TracePerRequest", "true");
|
|
|
|
|
*/
|
2010-12-27 17:41:58 +01:00
|
|
|
params.put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE.toString());
|
2010-09-16 21:50:30 +02:00
|
|
|
params.put(ResourceConfig.FEATURE_REDIRECT, Boolean.TRUE.toString());
|
|
|
|
|
params.put(ServletContainer.RESOURCE_CONFIG_CLASS,
|
|
|
|
|
UriExtensionsConfig.class.getName());
|
2010-12-01 15:15:09 +01:00
|
|
|
|
|
|
|
|
String restPath = getRestPackages();
|
|
|
|
|
|
|
|
|
|
if (logger.isInfoEnabled())
|
|
|
|
|
{
|
|
|
|
|
logger.info("configure jersey with package path: {}", restPath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
params.put(PackagesResourceConfig.PROPERTY_PACKAGES, restPath);
|
2010-09-16 21:50:30 +02:00
|
|
|
serve(PATTERN_RESTAPI).with(GuiceContainer.class, params);
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-01 15:15:09 +01:00
|
|
|
/**
|
|
|
|
|
* Method description
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @param packageSet
|
|
|
|
|
* @param plugin
|
|
|
|
|
*/
|
|
|
|
|
private void appendPluginPackages(Set<String> packageSet, Plugin plugin)
|
|
|
|
|
{
|
|
|
|
|
Set<String> pluginPackageSet = plugin.getPackageSet();
|
|
|
|
|
|
|
|
|
|
if (pluginPackageSet != null)
|
|
|
|
|
{
|
|
|
|
|
for (String pluginPkg : pluginPackageSet)
|
|
|
|
|
{
|
|
|
|
|
boolean append = true;
|
|
|
|
|
|
|
|
|
|
for (String pkg : packageSet)
|
|
|
|
|
{
|
|
|
|
|
if (pluginPkg.startsWith(pkg))
|
|
|
|
|
{
|
|
|
|
|
append = false;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (append)
|
|
|
|
|
{
|
|
|
|
|
if (logger.isDebugEnabled())
|
|
|
|
|
{
|
|
|
|
|
String name = "unknown";
|
|
|
|
|
|
|
|
|
|
if (plugin.getInformation() != null)
|
|
|
|
|
{
|
|
|
|
|
name = plugin.getInformation().getName();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.debug("plugin {} added rest path {}", name, pluginPkg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
packageSet.add(pluginPkg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-19 18:50:42 +01:00
|
|
|
//~--- get methods ----------------------------------------------------------
|
|
|
|
|
|
2010-12-01 15:15:09 +01:00
|
|
|
/**
|
|
|
|
|
* Method description
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private String getRestPackages()
|
|
|
|
|
{
|
|
|
|
|
Set<String> packageSet = new HashSet<String>();
|
|
|
|
|
|
|
|
|
|
packageSet.add(SCMContext.DEFAULT_PACKAGE);
|
|
|
|
|
|
2010-12-13 18:59:00 +01:00
|
|
|
Collection<Plugin> plugins = pluginLoader.getInstalledPlugins();
|
2010-12-01 15:15:09 +01:00
|
|
|
|
|
|
|
|
if (plugins != null)
|
|
|
|
|
{
|
|
|
|
|
for (Plugin plugin : plugins)
|
|
|
|
|
{
|
|
|
|
|
appendPluginPackages(packageSet, plugin);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StringBuilder buffer = new StringBuilder();
|
|
|
|
|
Iterator<String> pkgIterator = packageSet.iterator();
|
|
|
|
|
|
|
|
|
|
while (pkgIterator.hasNext())
|
|
|
|
|
{
|
|
|
|
|
buffer.append(pkgIterator.next());
|
|
|
|
|
|
|
|
|
|
if (pkgIterator.hasNext())
|
|
|
|
|
{
|
|
|
|
|
buffer.append(";");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return buffer.toString();
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-19 18:50:42 +01:00
|
|
|
/**
|
2011-04-20 16:50:54 +02:00
|
|
|
* Load ScmConfiguration with JAXB
|
2010-11-19 18:50:42 +01:00
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @param context
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private ScmConfiguration getScmConfiguration(SCMContextProvider context)
|
|
|
|
|
{
|
2011-04-20 17:32:29 +02:00
|
|
|
ScmConfiguration configuration = new ScmConfiguration();
|
2010-11-19 18:50:42 +01:00
|
|
|
|
2011-04-20 17:32:29 +02:00
|
|
|
ScmConfigurationUtil.getInstance().load(configuration);
|
2010-11-19 18:50:42 +01:00
|
|
|
|
2011-04-20 17:32:29 +02:00
|
|
|
return configuration;
|
2010-11-19 18:50:42 +01:00
|
|
|
}
|
|
|
|
|
|
2010-09-16 21:50:30 +02:00
|
|
|
//~--- fields ---------------------------------------------------------------
|
|
|
|
|
|
2010-10-31 13:13:58 +01:00
|
|
|
/** Field description */
|
2010-12-01 14:26:29 +01:00
|
|
|
private BindingExtensionProcessor bindExtProcessor;
|
2010-10-31 13:13:58 +01:00
|
|
|
|
2010-09-16 21:50:30 +02:00
|
|
|
/** Field description */
|
2010-12-13 18:59:00 +01:00
|
|
|
private PluginLoader pluginLoader;
|
2010-09-16 21:50:30 +02:00
|
|
|
}
|