mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-17 18:51:10 +01:00
implement plugin update method
This commit is contained in:
@@ -199,7 +199,7 @@ public class AetherPluginHandler
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
throw new PluginLoadException(ex);
|
throw new PluginException(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,7 +245,7 @@ public class AetherPluginHandler
|
|||||||
}
|
}
|
||||||
catch (JAXBException ex)
|
catch (JAXBException ex)
|
||||||
{
|
{
|
||||||
throw new PluginLoadException(ex);
|
throw new PluginException(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ public class DefaultPluginManager implements PluginManager
|
|||||||
|
|
||||||
if (plugin == null)
|
if (plugin == null)
|
||||||
{
|
{
|
||||||
throw new PluginLoadException(id.concat(" is not install"));
|
throw new PluginNotInstalledException(id.concat(" is not install"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pluginHandler == null)
|
if (pluginHandler == null)
|
||||||
@@ -199,7 +199,38 @@ public class DefaultPluginManager implements PluginManager
|
|||||||
{
|
{
|
||||||
SecurityUtil.assertIsAdmin(securityContextProvicer);
|
SecurityUtil.assertIsAdmin(securityContextProvicer);
|
||||||
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
String[] idParts = id.split(":");
|
||||||
|
String groupId = idParts[0];
|
||||||
|
String artefactId = idParts[1];
|
||||||
|
PluginInformation installed = null;
|
||||||
|
|
||||||
|
for (PluginInformation info : getInstalled())
|
||||||
|
{
|
||||||
|
if (groupId.equals(info.getGroupId())
|
||||||
|
&& artefactId.equals(info.getArtifactId()))
|
||||||
|
{
|
||||||
|
installed = info;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (installed == null)
|
||||||
|
{
|
||||||
|
StringBuilder msg = new StringBuilder(groupId);
|
||||||
|
|
||||||
|
msg.append(":").append(groupId).append(" is not install");
|
||||||
|
|
||||||
|
throw new PluginNotInstalledException(msg.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pluginHandler == null)
|
||||||
|
{
|
||||||
|
getPluginCenter();
|
||||||
|
}
|
||||||
|
|
||||||
|
pluginHandler.uninstall(installed.getId());
|
||||||
|
pluginHandler.install(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
@@ -370,12 +401,14 @@ public class DefaultPluginManager implements PluginManager
|
|||||||
{
|
{
|
||||||
if (installed.getVersion().equals(available.getVersion()))
|
if (installed.getVersion().equals(available.getVersion()))
|
||||||
{
|
{
|
||||||
available.setState(PluginState.INSTALLED);
|
state = PluginState.INSTALLED;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
available.setState(PluginState.UPDATE_AVAILABLE);
|
state = PluginState.UPDATE_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -135,8 +135,39 @@ Sonia.plugin.uninstallPlugin = function(pluginId){
|
|||||||
|
|
||||||
Sonia.plugin.updatePlugin = function(pluginId){
|
Sonia.plugin.updatePlugin = function(pluginId){
|
||||||
if ( debug ){
|
if ( debug ){
|
||||||
console.debug('not implemented');
|
console.debug( 'update plugin to ' + pluginId );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var loadingBox = Ext.MessageBox.show({
|
||||||
|
title: 'Please wait',
|
||||||
|
msg: 'Update Plugin.',
|
||||||
|
width: 300,
|
||||||
|
wait: true,
|
||||||
|
animate: true,
|
||||||
|
progress: true,
|
||||||
|
closable: false
|
||||||
|
});
|
||||||
|
|
||||||
|
Ext.Ajax.request({
|
||||||
|
url: restUrl + 'plugins/update/' + pluginId + '.json',
|
||||||
|
method: 'POST',
|
||||||
|
scope: this,
|
||||||
|
success: function(){
|
||||||
|
if ( debug ){
|
||||||
|
console.debug('plugin successfully updated');
|
||||||
|
}
|
||||||
|
loadingBox.hide();
|
||||||
|
Ext.MessageBox.alert('Plugin successfully updated',
|
||||||
|
'Restart the applicationserver to activate the changes.');
|
||||||
|
},
|
||||||
|
failure: function(){
|
||||||
|
if ( debug ){
|
||||||
|
console.debug('plugin updated failed');
|
||||||
|
}
|
||||||
|
alert( 'failure' );
|
||||||
|
loadingBox.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// plugin grid
|
// plugin grid
|
||||||
|
|||||||
Reference in New Issue
Block a user