make plugin repository url configurable

This commit is contained in:
Sebastian Sdorra
2010-12-18 14:18:14 +01:00
parent 8646be6733
commit 09fb26f63d
5 changed files with 44 additions and 14 deletions

View File

@@ -44,6 +44,12 @@ import java.util.Collection;
public interface PluginManager
{
/**
* Method description
*
*/
public void clearCache();
/**
* Method description
*

View File

@@ -41,6 +41,7 @@ import com.google.inject.Singleton;
import sonia.scm.SCMContext;
import sonia.scm.config.ScmConfiguration;
import sonia.scm.plugin.PluginManager;
import sonia.scm.util.IOUtil;
import sonia.scm.util.SecurityUtil;
import sonia.scm.web.security.WebSecurityContext;
@@ -76,14 +77,16 @@ public class ConfigurationResource
*
* @param configuration
* @param securityContextProvider
* @param pluginManager
*/
@Inject
public ConfigurationResource(
ScmConfiguration configuration,
Provider<WebSecurityContext> securityContextProvider)
Provider<WebSecurityContext> securityContextProvider,
ScmConfiguration configuration, PluginManager pluginManager)
{
this.configuration = configuration;
this.securityContextProvider = securityContextProvider;
this.configuration = configuration;
this.pluginManager = pluginManager;
}
//~--- get methods ----------------------------------------------------------
@@ -118,6 +121,12 @@ public class ConfigurationResource
ScmConfiguration newConfig)
{
SecurityUtil.assertIsAdmin(securityContextProvider);
if (!configuration.getPluginUrl().equals(newConfig.getPluginUrl()))
{
pluginManager.clearCache();
}
configuration.load(newConfig);
synchronized (ScmConfiguration.class)
@@ -141,6 +150,9 @@ public class ConfigurationResource
/** Field description */
public ScmConfiguration configuration;
/** Field description */
private PluginManager pluginManager;
/** Field description */
private Provider<WebSecurityContext> securityContextProvider;
}

View File

@@ -75,6 +75,7 @@ public class ScmConfiguration
public void load(ScmConfiguration other)
{
this.servername = other.servername;
this.pluginUrl = other.pluginUrl;
}
//~--- get methods ----------------------------------------------------------

View File

@@ -132,6 +132,16 @@ public class DefaultPluginManager implements PluginManager
//~--- methods --------------------------------------------------------------
/**
* Method description
*
*/
@Override
public void clearCache()
{
cache.clear();
}
/**
* Method description
*
@@ -247,11 +257,6 @@ public class DefaultPluginManager implements PluginManager
infoSet.addAll(installedPlugins.values());
infoSet.addAll(getPluginCenter().getPlugins());
for ( PluginInformation pi : infoSet )
{
System.out.println( pi.getName() + ": " + pi.hashCode() );
}
return infoSet;
}

View File

@@ -92,12 +92,18 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
var config = {
panels: [{
xtype: 'configForm',
title : 'General Settings',
items : [{
xtype : 'textfield',
fieldLabel : 'Servername',
name : 'servername',
allowBlank : false
title: 'General Settings',
items: [{
xtype: 'textfield',
fieldLabel: 'Servername',
name: 'servername',
allowBlank: false
},{
xtype: 'textfield',
fieldLabel: 'Plugin repository',
name: 'plugin-url',
vtype: 'url',
allowBlank: false
}],
onSubmit: function(values){