Work on commands
parent
c066f528ef
commit
952ad59c1f
|
@ -117,6 +117,14 @@ namespace OpenSim.Services.IntegrationService
|
||||||
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
||||||
"show info", "show info \"plugin name\"","Show detailed information for plugin",
|
"show info", "show info \"plugin name\"","Show detailed information for plugin",
|
||||||
HandleConsoleShowAddinInfo);
|
HandleConsoleShowAddinInfo);
|
||||||
|
|
||||||
|
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
||||||
|
"disable plugin", "disable plugin \"plugin name\"","disable the plugin",
|
||||||
|
HandleConsoleDisablePlugin);
|
||||||
|
|
||||||
|
MainConsole.Instance.Commands.AddCommand("Integration", true,
|
||||||
|
"enable plugin", "enable plugin \"plugin name\"","enable the plugin",
|
||||||
|
HandleConsoleEnablePlugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region console handlers
|
#region console handlers
|
||||||
|
@ -197,6 +205,7 @@ namespace OpenSim.Services.IntegrationService
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable repository
|
||||||
private void HandleConsoleDisableRepo(string module, string[] cmd)
|
private void HandleConsoleDisableRepo(string module, string[] cmd)
|
||||||
{
|
{
|
||||||
m_PluginManager.DisableRepository(cmd);
|
m_PluginManager.DisableRepository(cmd);
|
||||||
|
@ -213,6 +222,7 @@ namespace OpenSim.Services.IntegrationService
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show description information
|
||||||
private void HandleConsoleShowAddinInfo(string module, string[] cmd)
|
private void HandleConsoleShowAddinInfo(string module, string[] cmd)
|
||||||
{
|
{
|
||||||
if ( cmd.Length >= 3 )
|
if ( cmd.Length >= 3 )
|
||||||
|
@ -221,6 +231,20 @@ namespace OpenSim.Services.IntegrationService
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable plugin
|
||||||
|
private void HandleConsoleDisablePlugin(string module, string[] cmd)
|
||||||
|
{
|
||||||
|
m_PluginManager.DisablePlugin(cmd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable plugin
|
||||||
|
private void HandleConsoleEnablePlugin(string module, string[] cmd)
|
||||||
|
{
|
||||||
|
m_PluginManager.EnablePlugin(cmd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region web handlers
|
#region web handlers
|
||||||
|
|
|
@ -87,7 +87,7 @@ namespace OpenSim.Services.IntegrationService
|
||||||
|
|
||||||
AddinManager.AddinLoaded += on_addinloaded_;
|
AddinManager.AddinLoaded += on_addinloaded_;
|
||||||
AddinManager.AddinLoadError += on_addinloaderror_;
|
AddinManager.AddinLoadError += on_addinloaderror_;
|
||||||
|
AddinManager.AddinUnloaded += HandleAddinManagerAddinUnloaded;
|
||||||
m_Server = server;
|
m_Server = server;
|
||||||
|
|
||||||
m_IntegrationServerConfig = config.Configs["IntegrationService"];
|
m_IntegrationServerConfig = config.Configs["IntegrationService"];
|
||||||
|
@ -107,6 +107,9 @@ namespace OpenSim.Services.IntegrationService
|
||||||
string ConfigPath = String.Format("{0}/(1)", m_IntegrationConfigLoc,cmd.ConfigName);
|
string ConfigPath = String.Format("{0}/(1)", m_IntegrationConfigLoc,cmd.ConfigName);
|
||||||
IConfigSource PlugConfig = Ux.GetConfigSource(m_IntegrationConfigLoc, cmd.ConfigName);
|
IConfigSource PlugConfig = Ux.GetConfigSource(m_IntegrationConfigLoc, cmd.ConfigName);
|
||||||
|
|
||||||
|
// We maintain a configuration per-plugin to enhance modularity
|
||||||
|
// If ConfigSource is null, we will get the default from the repo
|
||||||
|
// and write it to our directory
|
||||||
// Fetch the starter ini
|
// Fetch the starter ini
|
||||||
if (PlugConfig == null)
|
if (PlugConfig == null)
|
||||||
{
|
{
|
||||||
|
@ -137,9 +140,8 @@ namespace OpenSim.Services.IntegrationService
|
||||||
PlugConfig = source;
|
PlugConfig = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We maintain a configuration per-plugin to enhance modularity
|
// Initialise and bring up the plugin
|
||||||
// If ConfigSource is null, we will get the default from the repo
|
// Need to take down the plugin when disabling it.
|
||||||
// and write it to our directory
|
|
||||||
cmd.Init (PlugConfig);
|
cmd.Init (PlugConfig);
|
||||||
server.AddStreamHandler((IRequestHandler)cmd);
|
server.AddStreamHandler((IRequestHandler)cmd);
|
||||||
m_log.InfoFormat("[INTEGRATION SERVICE]: Loading IntegrationService plugin {0}", cmd.Name);
|
m_log.InfoFormat("[INTEGRATION SERVICE]: Loading IntegrationService plugin {0}", cmd.Name);
|
||||||
|
@ -151,6 +153,11 @@ namespace OpenSim.Services.IntegrationService
|
||||||
return new IniConfigSource();
|
return new IniConfigSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HandleAddinManagerAddinUnloaded (object sender, AddinEventArgs args)
|
||||||
|
{
|
||||||
|
MainConsole.Instance.Output("Plugin Unloaded");
|
||||||
|
}
|
||||||
|
|
||||||
private void on_addinloaderror_(object sender, AddinErrorEventArgs args)
|
private void on_addinloaderror_(object sender, AddinErrorEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.Exception == null)
|
if (args.Exception == null)
|
||||||
|
|
|
@ -99,13 +99,17 @@ namespace OpenSim.Services.IntegrationService
|
||||||
// List instaled addins
|
// List instaled addins
|
||||||
public void ListInstalledAddins()
|
public void ListInstalledAddins()
|
||||||
{
|
{
|
||||||
|
int count = 0;
|
||||||
ArrayList list = new ArrayList();
|
ArrayList list = new ArrayList();
|
||||||
list.AddRange(m_Registry.GetAddins());
|
list.AddRange(m_Registry.GetAddins());
|
||||||
MainConsole.Instance.Output("Installed Plugins");
|
MainConsole.Instance.Output("Installed Plugins");
|
||||||
foreach (Addin addin in list)
|
foreach (Addin addin in list)
|
||||||
{
|
{
|
||||||
if(addin.Description.Category == "IntegrationPlugin")
|
if(addin.Description.Category == "IntegrationPlugin")
|
||||||
MainConsole.Instance.OutputFormat("* {0} rev. {1}", addin.Name, addin.Version);
|
MainConsole.Instance.OutputFormat("{0}) {1} {2} rev. {3}", count.ToString(),
|
||||||
|
addin.Enabled == false ? "[X]" : "[ ]",
|
||||||
|
addin.Name, addin.Version );
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -246,16 +250,7 @@ namespace OpenSim.Services.IntegrationService
|
||||||
int n = 0;
|
int n = 0;
|
||||||
foreach (AddinRepository rep in reps)
|
foreach (AddinRepository rep in reps)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
list.Add(String.Format("{0}) {1} {2} {3}",n.ToString(), rep.Enabled == true ? "[ ]" : "[X]", rep.Name, rep.Url));
|
||||||
|
|
||||||
sb.AppendFormat("{0})", n.ToString());
|
|
||||||
if (!rep.Enabled)
|
|
||||||
sb.AppendFormat(" (Disabled)");
|
|
||||||
sb.AppendFormat(" {0}", rep.Title);
|
|
||||||
if (rep.Title != rep.Url)
|
|
||||||
sb.AppendFormat(" {0}", rep.Url);
|
|
||||||
|
|
||||||
list.Add(sb.ToString());
|
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
@ -277,5 +272,39 @@ namespace OpenSim.Services.IntegrationService
|
||||||
|
|
||||||
return "AddinInfo";
|
return "AddinInfo";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable a plugin
|
||||||
|
public void DisablePlugin(string[] args)
|
||||||
|
{
|
||||||
|
|
||||||
|
// AddinRepository[] reps = Repositories.GetRepositories();
|
||||||
|
// Array.Sort (reps, (r1,r2) => r1.Title.CompareTo(r2.Title));
|
||||||
|
// if (reps.Length == 0)
|
||||||
|
// {
|
||||||
|
// MainConsole.Instance.Output("No repositories have been registered.");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// int n = Convert.ToInt16(args[2]);
|
||||||
|
// if (n > (reps.Length -1))
|
||||||
|
// {
|
||||||
|
// MainConsole.Instance.Output("Selection out of range");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
Addin addin = m_Registry.GetAddin(args[2]);
|
||||||
|
AddinManager.Registry.DisableAddin(addin.Id);
|
||||||
|
addin.Enabled = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable plugin
|
||||||
|
public void EnablePlugin(string[] args)
|
||||||
|
{
|
||||||
|
Addin addin = m_Registry.GetAddin(args[2]);
|
||||||
|
AddinManager.Registry.EnableAddin(addin.Id);
|
||||||
|
addin.Enabled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue