From 0b96019c5ec9227201ecb6a7fa3300d7ab809e5e Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sun, 22 Jul 2012 09:39:48 -0400 Subject: [PATCH] Some annotations for refactoring --- .../IntegrationService/IntegrationService.cs | 18 ++++++-- .../IntegrationServiceBase.cs | 42 +++++++++++++++++-- .../IntegrationService/IntegrationUtils.cs | 6 ++- .../IntegrationService/PluginManager.cs | 10 +++++ 4 files changed, 68 insertions(+), 8 deletions(-) diff --git a/OpenSim/Services/IntegrationService/IntegrationService.cs b/OpenSim/Services/IntegrationService/IntegrationService.cs index ade554a0f1..80367beba9 100644 --- a/OpenSim/Services/IntegrationService/IntegrationService.cs +++ b/OpenSim/Services/IntegrationService/IntegrationService.cs @@ -43,7 +43,9 @@ using log4net; using Mono.Addins; using Ux = OpenSim.Services.IntegrationService.IntegrationUtils; - +// ****[ Robust ] Keep the core services here and rebrand it as a more generic +// ****[ Robust ] service for use in buthe OpenSim.exe and Robust.exe +// namespace OpenSim.Services.IntegrationService { public class IntegrationService : IntegrationServiceBase, IIntegrationService @@ -61,7 +63,13 @@ namespace OpenSim.Services.IntegrationService AddConsoleCommands(); } } - + + // ****[ Robust ] We have console commands to manage the repositories and modules. + // ****[ Robust ] We can add/remove/enable/disable repositories and modules + // ****[ Robust ] We can query repositories for available modules and updates + // ****[ Robust ] The manager needs to be moved to OpenSim.Framework so we can + // ****[ Robust ] use it to complete the region module loader + // // Our console commands private void AddConsoleCommands() { @@ -347,7 +355,11 @@ namespace OpenSim.Services.IntegrationService return; } #endregion - + + // ****[ Robust ] These are handlers that relate to the console commands, but + // ****[ Robust ] are connecting to remote applications. It would be ok to do + // ****[ Robust ] this later in a separate module + // #region IIntegrationService implementation // Will hold back on implementing things here that can actually make changes // Need to secure it first diff --git a/OpenSim/Services/IntegrationService/IntegrationServiceBase.cs b/OpenSim/Services/IntegrationService/IntegrationServiceBase.cs index 4da881d1cf..62ef60abc3 100644 --- a/OpenSim/Services/IntegrationService/IntegrationServiceBase.cs +++ b/OpenSim/Services/IntegrationService/IntegrationServiceBase.cs @@ -39,9 +39,18 @@ using Mono.Addins; using log4net; using Ux = OpenSim.Services.IntegrationService.IntegrationUtils; + +// ****[ Robust ] Re-factor to use in both OpenSim.exe and Robust.exe +// ****[ Robust ] ** Loading can be done in modules that overide a base +// ****[ Robust ] ** class that provides the base services for the +// ****[ Robust ] ** discovery, loading and event queing of the modules + + +// ****[ Robust ] We need to define our root to graft our modules into [assembly:AddinRoot("IntegrationService", "2.1")] namespace OpenSim.Services.IntegrationService { + // ****[ Robust ] The name our modules look for as a dependency [TypeExtensionPoint(Path="/OpenSim/IntegrationService", Name="IntegrationService")] public interface IntegrationPlugin { @@ -83,7 +92,12 @@ namespace OpenSim.Services.IntegrationService m_IntegrationConfigLoc = serverConfig.GetString("IntegrationConfig", String.Empty); AddinRegistry registry ; bool DEVELOPMENT = serverConfig.GetBoolean("DevelopmentMode", false); - + + // ****[ Robust ] Would be able to load as a local Robust module, + // ****[ Robust ] during development, by adding the info to the + // ****[ Robust ] ServiceConnectors. Also allows modules to be + // ****[ Robust ] loaded locally under normal operations + // // Are we developing plugins? We will load them now. // This will allow debugging of the modules and will // use the runtime directory for the registry. Will not @@ -119,6 +133,12 @@ namespace OpenSim.Services.IntegrationService } } } + // ****[ Robust ] Place this in a loader that getsd called from + // Robust after the main server is running + // + // ****[ Robust ] Make generic version of this to be overridden + // ****[ Robust ] by OpenSim.exe and Robust.exe + // else { // defaults to the ./bin directory @@ -176,7 +196,10 @@ namespace OpenSim.Services.IntegrationService + args.Exception.Message + "\n" + args.Exception.StackTrace); } - + + // ****[ Robust ] This is where we get control of the plugin during + // ****[ Robust ] the loading and unloading + // // This is our init // We can do build-up and tear-down of our plugin void OnExtensionChanged(object s, ExtensionNodeEventArgs args) @@ -207,7 +230,15 @@ namespace OpenSim.Services.IntegrationService m_log.Info("[INTEGRATION SERVICE]: Plugin Loaded: " + args.AddinId); } #endregion addin-event handlers - + + // ****[ Robust ] We are taking the module from the event handler and + // ****[ Robust ] taking it through the initialization process + // ****[ Robust ] This is using a mixture of the user's existing ini + // ****[ Robust ] and the developer supplied initial configuration + // ****[ Robust ] + // ****[ Robust ] We should first check the user's ini for existing entries + // ****[ Robust ] in case they have configured the module ahead of time. + // private void LoadingPlugin(IntegrationPlugin plugin) { string ConfigPath = String.Format("{0}/(1)", m_IntegrationConfigLoc,plugin.ConfigName); @@ -239,7 +270,10 @@ namespace OpenSim.Services.IntegrationService m_log.DebugFormat("[INTEGRATION SERVICE]: ****** In Loading Plugin {0}", plugin.PluginName); plugin.Init(m_ConfigSource, PlugConfig, m_Server, this); } - + + // ****[ Robust ] We are taking the plugin from the event handler to unload it + // ****[ Robust ] and we need to tear down to release all objects. + // private void UnLoadingPlugin(IntegrationPlugin plugin) { try diff --git a/OpenSim/Services/IntegrationService/IntegrationUtils.cs b/OpenSim/Services/IntegrationService/IntegrationUtils.cs index 41332c3681..d9bc35902f 100644 --- a/OpenSim/Services/IntegrationService/IntegrationUtils.cs +++ b/OpenSim/Services/IntegrationService/IntegrationUtils.cs @@ -41,7 +41,11 @@ namespace OpenSim.Services.IntegrationService public static class IntegrationUtils { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + + // ****[ Robust ] Only a couple of these are needed in the core management system + // ****[ Robust ] These could be moved to the implementation instead of being in + // ****[ Robust ] a separate file + // #region web utils public static bool ParseStringToOSDMap(string input, out OSDMap json) { diff --git a/OpenSim/Services/IntegrationService/PluginManager.cs b/OpenSim/Services/IntegrationService/PluginManager.cs index d84fa67305..a67d5edfaf 100644 --- a/OpenSim/Services/IntegrationService/PluginManager.cs +++ b/OpenSim/Services/IntegrationService/PluginManager.cs @@ -39,6 +39,16 @@ using Ux = OpenSim.Services.IntegrationService.IntegrationUtils; namespace OpenSim.Services.IntegrationService { + // ****[ Robust ] These are the functions that connect our console + // ****[ Robust ] commands to the addin management. This needs to + // ****[ Robust ] be maintained in a file separately from the main + // ****[ Robust ] implementation in the same namespace. Any generaly + // ****[ Robust ] usefull methods can be located in one of the existing + // ****[ Robust ] places + // ****[ Robust ] + // ****[ Robust ] This needs to be in OpenSim.Framework so it can be + // ****[ Robust ] used to complete the region module management + // // This will maintain the plugin repositories and plugins public class PluginManager : SetupService {