Skip to content

Commit

Permalink
Cutover dependencies for the MoneyServer and Robust to IConfiguration…
Browse files Browse the repository at this point in the history
… and ILogger and prep to use DI for instantiation of classes. Working through the rest of the Robust support and some of the RegionServer Modules remains
  • Loading branch information
mdickson committed Jan 26, 2024
1 parent 9719790 commit a72cf27
Show file tree
Hide file tree
Showing 409 changed files with 3,254 additions and 4,267 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ bld/
[Ll]og/
[Ll]ogs/

# VS Code
.vscode/

# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
Expand Down
38 changes: 37 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,41 @@
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": []
"configurations": [
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
},
{
"name": "C#: OpenSim.Server.MoneyServer Debug",
"type": "coreclr",
"request": "launch",
"program": "${workspaceFolder}/Source/OpenSim.Server.MoneyServer/bin/Debug/net6.0/OpenSim.Server.MoneyServer.dll",
"args": ["--console","local","--inifile","${workspaceFolder}/../../Config/MoneyServer.ini"],
"cwd": "${workspaceFolder}",
"stopAtEntry": true,
"console": "integratedTerminal"
},
{
"name": "C#: OpenSim.Server.RobustServer Debug",
"type": "coreclr",
"request": "launch",
"program": "${workspaceFolder}/Source/OpenSim.Server.RobustServer/bin/Debug/net6.0/OpenSim.Server.RobustServer.dll",
"args": ["--console","local","--inifile","${workspaceFolder}/../../Config/Robust.Grid.ini"],
"cwd": "${workspaceFolder}",
"stopAtEntry": true,
"console": "integratedTerminal"
},
{
"name": "C#: OpenSim.Server.RegionServer Debug",
"type": "coreclr",
"request": "launch",
"program": "${workspaceFolder}/Source/OpenSim.Server.RegionServer/bin/Debug/net6.0/OpenSim.Server.RegionServer.dll",
"args": ["--console","local","--inifile","${workspaceFolder}/../../Config/OpenSim.ini.ini"],
"cwd": "${workspaceFolder}",
"stopAtEntry": true,
"console": "integratedTerminal"
},
]
}
2 changes: 1 addition & 1 deletion OpenSim/Addons/Groups/GroupsMessagingModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public class GroupsMessagingModule : ISharedRegionModule, IGroupsMessagingModule

#region Region Module interfaceBase Members

public void Initialise(IConfigSource config)
public void Initialise(IConfiguration config)
{
IConfig groupsConfig = config.Configs["Groups"];

Expand Down
2 changes: 1 addition & 1 deletion OpenSim/Addons/Groups/GroupsModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class GroupsModule : ISharedRegionModule, IGroupsModule

#region Region Module interfaceBase Members

public void Initialise(IConfigSource config)
public void Initialise(IConfiguration config)
{
IConfig groupsConfig = config.Configs["Groups"];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ public class GroupsServiceHGConnectorModule : ISharedRegionModule, IGroupsServic
private List<Scene> m_Scenes;
private ForeignImporter m_ForeignImporter;
private string m_ServiceLocation;
private IConfigSource m_Config;
private IConfiguration m_Config;

private Dictionary<string, GroupsServiceHGConnector> m_NetworkConnectors = new Dictionary<string, GroupsServiceHGConnector>();
private RemoteConnectorCacheWrapper m_CacheWrapper; // for caching info of external group services

#region ISharedRegionModule

public void Initialise(IConfigSource config)
public void Initialise(IConfiguration config)
{
IConfig groupsConfig = config.Configs["Groups"];
if (groupsConfig == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ public class HGGroupsServiceRobustConnector : ServiceConnector
private string m_ConfigName = "Groups";

// Called by Robust shell
public HGGroupsServiceRobustConnector(IConfigSource config, IHttpServer server, string configName) :
public HGGroupsServiceRobustConnector(IConfiguration config, IHttpServer server, string configName) :
this(config, server, configName, null, null)
{
}

// Called by the sim-bound module
public HGGroupsServiceRobustConnector(IConfigSource config, IHttpServer server, string configName, IOfflineIMService im, IUserAccountService users) :
public HGGroupsServiceRobustConnector(IConfiguration config, IHttpServer server, string configName, IOfflineIMService im, IUserAccountService users) :
base(config, server, configName)
{
if (configName != String.Empty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,23 @@ public GroupsServiceLocalConnectorModule()
{
}

public GroupsServiceLocalConnectorModule(IConfigSource config, IUserManagement uman)
public GroupsServiceLocalConnectorModule(IConfiguration config, IUserManagement uman)
{
Init(config);
m_UserManagement = uman;
m_ForeignImporter = new ForeignImporter(uman);
}
#endregion

private void Init(IConfigSource config)
private void Init(IConfiguration config)
{
m_GroupsService = new GroupsService(config);
m_Scenes = new List<Scene>();
}

#region ISharedRegionModule

public void Initialise(IConfigSource config)
public void Initialise(IConfiguration config)
{
IConfig groupsConfig = config.Configs["Groups"];
if (groupsConfig == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class GroupsServiceRemoteConnector
private IServiceAuth m_Auth;
private object m_Lock = new object();

public GroupsServiceRemoteConnector(IConfigSource config)
public GroupsServiceRemoteConnector(IConfiguration config)
{
IConfig groupsConfig = config.Configs["Groups"];
string url = groupsConfig.GetString("GroupsServerURI", string.Empty);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public GroupsServiceRemoteConnectorModule()
{
}

public GroupsServiceRemoteConnectorModule(IConfigSource config, IUserManagement uman)
public GroupsServiceRemoteConnectorModule(IConfiguration config, IUserManagement uman)
{
Init(config);
m_UserManagement = uman;
Expand All @@ -62,7 +62,7 @@ public GroupsServiceRemoteConnectorModule(IConfigSource config, IUserManagement
}
#endregion

private void Init(IConfigSource config)
private void Init(IConfiguration config)
{
m_GroupsService = new GroupsServiceRemoteConnector(config);
m_Scenes = new List<Scene>();
Expand All @@ -71,7 +71,7 @@ private void Init(IConfigSource config)

#region ISharedRegionModule

public void Initialise(IConfigSource config)
public void Initialise(IConfiguration config)
{
IConfig groupsConfig = config.Configs["Groups"];
if (groupsConfig == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class GroupsServiceRobustConnector : ServiceConnector
private GroupsService m_GroupsService;
private string m_ConfigName = "Groups";

public GroupsServiceRobustConnector(IConfigSource config, IHttpServer server, string configName) :
public GroupsServiceRobustConnector(IConfiguration config, IHttpServer server, string configName) :
base(config, server, configName)
{
string key = string.Empty;
Expand Down
4 changes: 2 additions & 2 deletions OpenSim/Addons/Groups/Service/GroupsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ public class GroupsService : GroupsServiceBase

private System.Timers.Timer m_CleanupTimer;

public GroupsService(IConfigSource config, string configName)
public GroupsService(IConfiguration config, string configName)
: base(config, configName)
{
}

public GroupsService(IConfigSource config)
public GroupsService(IConfiguration config)
: this(config, string.Empty)
{
// Once a day
Expand Down
2 changes: 1 addition & 1 deletion OpenSim/Addons/Groups/Service/GroupsServiceBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class GroupsServiceBase : ServiceBase
protected IGroupsData m_Database = null;
protected IGridUserData m_GridUserService = null;

public GroupsServiceBase(IConfigSource config, string cName)
public GroupsServiceBase(IConfiguration config, string cName)
: base(config)
{
string dllName = String.Empty;
Expand Down
2 changes: 1 addition & 1 deletion OpenSim/Addons/Groups/Service/HGGroupsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class HGGroupsService : GroupsService
private IUserAccountService m_UserAccounts;
private string m_HomeURI;

public HGGroupsService(IConfigSource config, IOfflineIMService im, IUserAccountService users, string homeURI)
public HGGroupsService(IConfiguration config, IOfflineIMService im, IUserAccountService users, string homeURI)
: base(config, string.Empty)
{
m_OfflineIM = im;
Expand Down
2 changes: 1 addition & 1 deletion OpenSim/Addons/OfflineIM/OfflineIMRegionModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class OfflineIMRegionModule : ISharedRegionModule, IOfflineIMService

private IOfflineIMService m_OfflineIMService;

public void Initialise(IConfigSource config)
public void Initialise(IConfiguration config)
{
IConfig cnf = config.Configs["Messaging"];
if (cnf == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

using OpenSim.Framework;
using OpenSim.Framework.ServiceAuth;
Expand All @@ -38,7 +34,8 @@

using OpenMetaverse;
using log4net;
using Nini.Config;

using Microsoft.Extensions.Configuration;

namespace OpenSim.OfflineIM
{
Expand All @@ -56,16 +53,16 @@ public OfflineIMServiceRemoteConnector(string url)
m_log.DebugFormat("[OfflineIM.V2.RemoteConnector]: Offline IM server at {0}", m_ServerURI);
}

public OfflineIMServiceRemoteConnector(IConfigSource config)
public OfflineIMServiceRemoteConnector(IConfiguration config)
{
IConfig cnf = config.Configs["Messaging"];
if (cnf == null)
var cnf = config.GetSection("Messaging");
if (cnf.Exists() is false)
{
m_log.WarnFormat("[OfflineIM.V2.RemoteConnector]: Missing Messaging configuration");
return;
}

m_ServerURI = cnf.GetString("OfflineMessageURL", string.Empty);
m_ServerURI = cnf.GetValue("OfflineMessageURL", string.Empty);

/// This is from BaseServiceConnector
string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", "Messaging" }, "None");
Expand All @@ -76,6 +73,7 @@ public OfflineIMServiceRemoteConnector(IConfigSource config)
m_Auth = new BasicHttpAuthentication(config, "Messaging");
break;
}

///
m_log.DebugFormat("[OfflineIM.V2.RemoteConnector]: Offline IM server at {0} with auth {1}",
m_ServerURI, (m_Auth == null ? "None" : m_Auth.GetType().ToString()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class OfflineIMServiceRobustConnector : ServiceConnector
private IOfflineIMService m_OfflineIMService;
private string m_ConfigName = "Messaging";

public OfflineIMServiceRobustConnector(IConfigSource config, IHttpServer server, string configName) :
public OfflineIMServiceRobustConnector(IConfiguration config, IHttpServer server, string configName) :
base(config, server, configName)
{
if (configName != String.Empty)
Expand Down
2 changes: 1 addition & 1 deletion OpenSim/Addons/OfflineIM/Service/OfflineIMService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class OfflineIMService : OfflineIMServiceBase, IOfflineIMService
private XmlSerializer m_serializer;
private static bool m_Initialized = false;

public OfflineIMService(IConfigSource config)
public OfflineIMService(IConfiguration config)
: base(config)
{
m_serializer = new XmlSerializer(typeof(GridInstantMessage));
Expand Down
2 changes: 1 addition & 1 deletion OpenSim/Addons/OfflineIM/Service/OfflineIMServiceBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class OfflineIMServiceBase : ServiceBase
{
protected IOfflineIMData m_Database = null;

public OfflineIMServiceBase(IConfigSource config)
public OfflineIMServiceBase(IConfiguration config)
: base(config)
{
string dllName = String.Empty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class EstateLoaderFileSystem : IEstateLoader
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

private IConfigSource m_configSource;
private IConfiguration m_configSource;

private IOpenSimBase m_application;

Expand All @@ -47,7 +47,7 @@ public EstateLoaderFileSystem(IOpenSimBase openSim)
m_application = openSim;
}

public void SetIniConfigSource(IConfigSource configSource)
public void SetIniConfigSource(IConfiguration configSource)
{
m_configSource = configSource;
}
Expand Down Expand Up @@ -92,7 +92,7 @@ public void LoadEstates()
{
m_log.InfoFormat("[ESTATE LOADER FILE SYSTEM]: Loading config file {0}", file);

IConfigSource source = null;
IConfiguration source = null;
try
{
source = new IniConfigSource(file);
Expand Down
2 changes: 1 addition & 1 deletion OpenSim/ApplicationPlugins/LoadRegions/IEstateLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
{
public interface IEstateLoader
{
void SetIniConfigSource(IConfigSource configSource);
void SetIniConfigSource(IConfiguration configSource);
void LoadEstates();
}
}
2 changes: 1 addition & 1 deletion OpenSim/ApplicationPlugins/LoadRegions/IRegionLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
{
public interface IRegionLoader
{
void SetIniConfigSource(IConfigSource configSource);
void SetIniConfigSource(IConfiguration configSource);
RegionInfo[] LoadRegions();
}
}
4 changes: 2 additions & 2 deletions OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class LoadRegionsPlugin : IApplicationPlugin, IRegionCreator
private string m_name = "LoadRegionsPlugin";
private string m_version = "0.0";

private IConfigSource _configuration;
private IConfiguration _configuration;
private ILogger<LoadRegionsPlugin> _logger;

public string Version
Expand All @@ -59,7 +59,7 @@ public string Name
protected IOpenSimBase m_openSim;

public LoadRegionsPlugin(
IConfigSource configuration,
IConfiguration configuration,
ILogger<LoadRegionsPlugin> logger)
{
_configuration = configuration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public class RegionLoaderFileSystem : IRegionLoader
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

private IConfigSource m_configSource;
private IConfiguration m_configSource;

public void SetIniConfigSource(IConfigSource configSource)
public void SetIniConfigSource(IConfiguration configSource)
{
m_configSource = configSource;
}
Expand Down Expand Up @@ -86,7 +86,7 @@ public RegionInfo[] LoadRegions()
{
m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file);

IConfigSource source = new IniConfigSource(file);
IConfiguration source = new IniConfigSource(file);

foreach (IConfig config in source.Configs)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public class RegionLoaderWebServer : IRegionLoader
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

private IConfigSource m_configSource;
private IConfiguration m_configSource;

public void SetIniConfigSource(IConfigSource configSource)
public void SetIniConfigSource(IConfiguration configSource)
{
m_configSource = configSource;
}
Expand Down
Loading

0 comments on commit a72cf27

Please sign in to comment.