mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 07:55:47 +01:00
make plugin repository url configurable
This commit is contained in:
@@ -44,6 +44,12 @@ import java.util.Collection;
|
|||||||
public interface PluginManager
|
public interface PluginManager
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void clearCache();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import com.google.inject.Singleton;
|
|||||||
|
|
||||||
import sonia.scm.SCMContext;
|
import sonia.scm.SCMContext;
|
||||||
import sonia.scm.config.ScmConfiguration;
|
import sonia.scm.config.ScmConfiguration;
|
||||||
|
import sonia.scm.plugin.PluginManager;
|
||||||
import sonia.scm.util.IOUtil;
|
import sonia.scm.util.IOUtil;
|
||||||
import sonia.scm.util.SecurityUtil;
|
import sonia.scm.util.SecurityUtil;
|
||||||
import sonia.scm.web.security.WebSecurityContext;
|
import sonia.scm.web.security.WebSecurityContext;
|
||||||
@@ -76,14 +77,16 @@ public class ConfigurationResource
|
|||||||
*
|
*
|
||||||
* @param configuration
|
* @param configuration
|
||||||
* @param securityContextProvider
|
* @param securityContextProvider
|
||||||
|
* @param pluginManager
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
public ConfigurationResource(
|
public ConfigurationResource(
|
||||||
ScmConfiguration configuration,
|
Provider<WebSecurityContext> securityContextProvider,
|
||||||
Provider<WebSecurityContext> securityContextProvider)
|
ScmConfiguration configuration, PluginManager pluginManager)
|
||||||
{
|
{
|
||||||
this.configuration = configuration;
|
|
||||||
this.securityContextProvider = securityContextProvider;
|
this.securityContextProvider = securityContextProvider;
|
||||||
|
this.configuration = configuration;
|
||||||
|
this.pluginManager = pluginManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
@@ -118,6 +121,12 @@ public class ConfigurationResource
|
|||||||
ScmConfiguration newConfig)
|
ScmConfiguration newConfig)
|
||||||
{
|
{
|
||||||
SecurityUtil.assertIsAdmin(securityContextProvider);
|
SecurityUtil.assertIsAdmin(securityContextProvider);
|
||||||
|
|
||||||
|
if (!configuration.getPluginUrl().equals(newConfig.getPluginUrl()))
|
||||||
|
{
|
||||||
|
pluginManager.clearCache();
|
||||||
|
}
|
||||||
|
|
||||||
configuration.load(newConfig);
|
configuration.load(newConfig);
|
||||||
|
|
||||||
synchronized (ScmConfiguration.class)
|
synchronized (ScmConfiguration.class)
|
||||||
@@ -141,6 +150,9 @@ public class ConfigurationResource
|
|||||||
/** Field description */
|
/** Field description */
|
||||||
public ScmConfiguration configuration;
|
public ScmConfiguration configuration;
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private PluginManager pluginManager;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private Provider<WebSecurityContext> securityContextProvider;
|
private Provider<WebSecurityContext> securityContextProvider;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ public class ScmConfiguration
|
|||||||
public void load(ScmConfiguration other)
|
public void load(ScmConfiguration other)
|
||||||
{
|
{
|
||||||
this.servername = other.servername;
|
this.servername = other.servername;
|
||||||
|
this.pluginUrl = other.pluginUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
|
|||||||
@@ -132,6 +132,16 @@ public class DefaultPluginManager implements PluginManager
|
|||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void clearCache()
|
||||||
|
{
|
||||||
|
cache.clear();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
@@ -247,11 +257,6 @@ public class DefaultPluginManager implements PluginManager
|
|||||||
infoSet.addAll(installedPlugins.values());
|
infoSet.addAll(installedPlugins.values());
|
||||||
infoSet.addAll(getPluginCenter().getPlugins());
|
infoSet.addAll(getPluginCenter().getPlugins());
|
||||||
|
|
||||||
for ( PluginInformation pi : infoSet )
|
|
||||||
{
|
|
||||||
System.out.println( pi.getName() + ": " + pi.hashCode() );
|
|
||||||
}
|
|
||||||
|
|
||||||
return infoSet;
|
return infoSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,12 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
|
|||||||
fieldLabel: 'Servername',
|
fieldLabel: 'Servername',
|
||||||
name: 'servername',
|
name: 'servername',
|
||||||
allowBlank: false
|
allowBlank: false
|
||||||
|
},{
|
||||||
|
xtype: 'textfield',
|
||||||
|
fieldLabel: 'Plugin repository',
|
||||||
|
name: 'plugin-url',
|
||||||
|
vtype: 'url',
|
||||||
|
allowBlank: false
|
||||||
}],
|
}],
|
||||||
|
|
||||||
onSubmit: function(values){
|
onSubmit: function(values){
|
||||||
|
|||||||
Reference in New Issue
Block a user