mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
make plugin repository url configurable
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ public class ScmConfiguration
|
||||
public void load(ScmConfiguration other)
|
||||
{
|
||||
this.servername = other.servername;
|
||||
this.pluginUrl = other.pluginUrl;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user