Work on loading new addins
parent
a798b98f85
commit
679533f632
|
@ -89,7 +89,10 @@ namespace OpenSim.Services.IntegrationService
|
||||||
".");
|
".");
|
||||||
|
|
||||||
AddinRegistry registry = new AddinRegistry(RegistryLocation, ".");
|
AddinRegistry registry = new AddinRegistry(RegistryLocation, ".");
|
||||||
|
|
||||||
|
suppress_console_output_(true);
|
||||||
m_PluginManager = new PluginManager(registry);
|
m_PluginManager = new PluginManager(registry);
|
||||||
|
suppress_console_output_(false);
|
||||||
|
|
||||||
// Deal with files only for now - will add url/environment later
|
// Deal with files only for now - will add url/environment later
|
||||||
m_IntegrationConfigLoc = serverConfig.GetString("IntegrationConfig", String.Empty);
|
m_IntegrationConfigLoc = serverConfig.GetString("IntegrationConfig", String.Empty);
|
||||||
|
@ -104,64 +107,16 @@ namespace OpenSim.Services.IntegrationService
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AddinManager.Initialize (RegistryLocation);
|
AddinManager.Initialize (RegistryLocation);
|
||||||
|
AddinManager.Registry.Update ();
|
||||||
suppress_console_output_(true);
|
|
||||||
|
|
||||||
|
|
||||||
AddinManager.AddinLoaded += on_addinloaded_;
|
AddinManager.AddinLoaded += on_addinloaded_;
|
||||||
AddinManager.AddinLoadError += on_addinloaderror_;
|
AddinManager.AddinLoadError += on_addinloaderror_;
|
||||||
AddinManager.AddinUnloaded += HandleAddinManagerAddinUnloaded;
|
AddinManager.AddinUnloaded += HandleAddinManagerAddinUnloaded;
|
||||||
AddinManager.AddinEngine.ExtensionChanged += HandleAddinManagerAddinEngineExtensionChanged;
|
AddinManager.AddinEngine.ExtensionChanged += HandleAddinManagerAddinEngineExtensionChanged;
|
||||||
|
|
||||||
AddinManager.Registry.Update ();
|
|
||||||
|
|
||||||
suppress_console_output_(false);
|
|
||||||
|
|
||||||
|
|
||||||
AddinManager.AddExtensionNodeHandler ("/OpenSim/IntegrationService", OnExtensionChanged);
|
AddinManager.AddExtensionNodeHandler ("/OpenSim/IntegrationService", OnExtensionChanged);
|
||||||
|
|
||||||
// **** Moving this
|
|
||||||
// foreach (IntegrationPlugin cmd in AddinManager.GetExtensionObjects("/OpenSim/IntegrationService"))
|
|
||||||
// {
|
|
||||||
// string ConfigPath = String.Format("{0}/(1)", 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
|
|
||||||
// if (PlugConfig == null)
|
|
||||||
// {
|
|
||||||
//
|
|
||||||
// m_log.InfoFormat("[INTEGRATION SERVICE]: Fetching starter config for {0} from {1}", cmd.Name, cmd.DefaultConfig);
|
|
||||||
//
|
|
||||||
// // Send the default data service
|
|
||||||
// IConfig DataService = m_ConfigSource.Configs["DatabaseService"];
|
|
||||||
// m_log.InfoFormat("[INTEGRATION SERVICE]: Writing initial config to {0}", cmd.ConfigName);
|
|
||||||
//
|
|
||||||
// IniConfigSource source = new IniConfigSource();
|
|
||||||
// IConfig Init = source.AddConfig("DatabaseService");
|
|
||||||
// Init.Set("StorageProvider",(string)DataService.GetString("StorageProvider"));
|
|
||||||
// Init.Set("ConnectionString", (string)DataService.GetString("ConnectionString"));
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// PlugConfig = Ux.LoadInitialConfig(cmd.DefaultConfig);
|
|
||||||
//
|
|
||||||
// source.Merge(PlugConfig);
|
|
||||||
//
|
|
||||||
// source.Save(Path.Combine(m_IntegrationConfigLoc, cmd.ConfigName));
|
|
||||||
//
|
|
||||||
// PlugConfig = source;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // Initialise and bring up the plugin
|
|
||||||
// // Need to take down the plugin when disabling it.
|
|
||||||
// cmd.Init (PlugConfig);
|
|
||||||
// server.AddStreamHandler((IRequestHandler)cmd);
|
|
||||||
// m_log.InfoFormat("[INTEGRATION SERVICE]: Loading IntegrationService plugin {0}", cmd.Name);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleAddinManagerAddinEngineExtensionChanged (object sender, ExtensionEventArgs args)
|
void HandleAddinManagerAddinEngineExtensionChanged (object sender, ExtensionEventArgs args)
|
||||||
|
@ -268,13 +223,13 @@ namespace OpenSim.Services.IntegrationService
|
||||||
PlugConfig = source;
|
PlugConfig = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.InfoFormat("[INTEGRATION SERVICE]: In Loading Plugin {0}", plugin.Name);
|
m_log.InfoFormat("[INTEGRATION SERVICE]: ****** In Loading Plugin {0}", plugin.Name);
|
||||||
plugin.Init(PlugConfig, m_Server);
|
plugin.Init(PlugConfig, m_Server);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UnLoadingPlugin(IntegrationPlugin plugin)
|
private void UnLoadingPlugin(IntegrationPlugin plugin)
|
||||||
{
|
{
|
||||||
|
plugin.Unload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace OpenSim.Services.IntegrationService
|
||||||
{
|
{
|
||||||
Addin[] addins = GetSortedAddinList("IntegrationPlugin");
|
Addin[] addins = GetSortedAddinList("IntegrationPlugin");
|
||||||
|
|
||||||
int n = Convert.ToInt16(args[2]);
|
int n = Convert.ToInt16(args[1]);
|
||||||
if (n > (addins.Length -1))
|
if (n > (addins.Length -1))
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output("Selection out of range");
|
MainConsole.Instance.Output("Selection out of range");
|
||||||
|
@ -94,9 +94,12 @@ namespace OpenSim.Services.IntegrationService
|
||||||
}
|
}
|
||||||
|
|
||||||
Addin addin = addins[n];
|
Addin addin = addins[n];
|
||||||
|
MainConsole.Instance.OutputFormat("Uninstalling plugin {0}", addin.Id);
|
||||||
|
AddinManager.Registry.DisableAddin(addin.Id);
|
||||||
|
addin.Enabled = false;
|
||||||
IProgressStatus ps = new ConsoleProgressStatus(true);
|
IProgressStatus ps = new ConsoleProgressStatus(true);
|
||||||
Uninstall(ps, addin.Id);
|
Uninstall(ps, addin.Id);
|
||||||
m_Registry.Rebuild(null);
|
// m_Registry.Rebuild(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,10 +324,24 @@ namespace OpenSim.Services.IntegrationService
|
||||||
}
|
}
|
||||||
|
|
||||||
Addin addin = addins[n];
|
Addin addin = addins[n];
|
||||||
|
|
||||||
addin.Enabled = true;
|
addin.Enabled = true;
|
||||||
AddinManager.Registry.EnableAddin(addin.Id);
|
AddinManager.Registry.EnableAddin(addin.Id);
|
||||||
AddinManager.Registry.Update();
|
// AddinManager.Registry.Update();
|
||||||
AddinManager.AddinEngine.LoadAddin(null, addin.Id);
|
if(m_Registry.IsAddinEnabled(addin.Id))
|
||||||
|
{
|
||||||
|
ConsoleProgressStatus ps = new ConsoleProgressStatus(true);
|
||||||
|
if (!AddinManager.AddinEngine.IsAddinLoaded(addin.Id))
|
||||||
|
{
|
||||||
|
AddinManager.Registry.Rebuild(ps);
|
||||||
|
AddinManager.AddinEngine.LoadAddin(ps, addin.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainConsole.Instance.OutputFormat("Not Enabled in this domain {0}", addin.Name);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue