Skip to content

Commit

Permalink
Temporarily remove some projects and get the rest of the Grid service…
Browse files Browse the repository at this point in the history
…s dependencies converted to dotnet core framework services.
  • Loading branch information
mdickson committed Feb 29, 2024
1 parent 6129804 commit 915f04e
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 257 deletions.
3 changes: 1 addition & 2 deletions OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;

using OpenMetaverse;

using Microsoft.Extensions.Configuration;
Expand Down Expand Up @@ -240,8 +241,6 @@ public virtual void Stop()
/// </summary>
public class LLUDPServer : OpenSimUDPBase
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

/// <summary>Maximum transmission unit, or UDP packet size, for the LLUDP protocol</summary>
public const int MTU = 1400;
public const int MAXPAYLOAD = 1200;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,50 +25,64 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

using System;
using Nini.Config;
using OpenSim.Server.Base;
using OpenSim.Server.Handlers.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Framework;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Base;

using OpenMetaverse;
using OpenMetaverse.StructuredData;

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

using Autofac;


namespace OpenSim.Capabilities.Handlers
{
public class FetchInvDescServerConnector : ServiceConnector
public class FetchInvDescServerConnector : IServiceConnector
{
private IInventoryService m_InventoryService;
private ILibraryService m_LibraryService;
private string m_ConfigName = "CapsService";
private const string _ConfigName = "CapsService";

protected readonly IConfiguration m_configuration;
protected readonly ILogger<FetchInvDescServerConnector> m_logger;
protected readonly IComponentContext m_context;

public FetchInvDescServerConnector(
IConfiguration config,
ILogger<FetchInvDescServerConnector> logger,
IComponentContext componentContext)
{
m_configuration = config;
m_logger = logger;
m_context = componentContext;
}

public string ConfigName { get; } = _ConfigName;

public FetchInvDescServerConnector(IConfiguration config, IHttpServer server, string configName) :
base(config, server, configName)
public IHttpServer HttpServer { get; private set; }

public void Initialize(IHttpServer httpServer)
{
if (configName != String.Empty)
m_ConfigName = configName;
HttpServer = httpServer;

IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
var serverConfig = m_configuration.GetSection(ConfigName);
if (serverConfig.Exists() is false)
throw new Exception($"No section '{ConfigName}' in config file");

string invService = serverConfig.GetString("InventoryService", String.Empty);
string invService = serverConfig.GetValue("InventoryService", String.Empty);

if (invService.Length == 0)
if (string.IsNullOrEmpty(invService))
throw new Exception("No InventoryService in config file");

Object[] args = new Object[] { config };
m_InventoryService =
ServerUtils.LoadPlugin<IInventoryService>(invService, args);

m_InventoryService = m_context.ResolveNamed<IInventoryService>(invService);
if (m_InventoryService == null)
throw new Exception(String.Format("Failed to load InventoryService from {0}; config is {1}", invService, m_ConfigName));
throw new Exception($"Failed to load InventoryService from {invService}; config is {ConfigName}");

string libService = serverConfig.GetString("LibraryService", String.Empty);
m_LibraryService =
ServerUtils.LoadPlugin<ILibraryService>(libService, args);
string libService = serverConfig.GetValue("LibraryService", String.Empty);
m_LibraryService = m_context.ResolveNamed<ILibraryService>(libService);

ExpiringKey<UUID> m_badRequests = new ExpiringKey<UUID>(30000);

Expand All @@ -79,7 +93,7 @@ ISimpleStreamHandler reqHandler
webFetchHandler.FetchInventoryDescendentsRequest(httpRequest, httpResponse, m_badRequests);
});

server.AddSimpleStreamHandler(reqHandler);
HttpServer.AddSimpleStreamHandler(reqHandler);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,47 +25,63 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

using System;
using Nini.Config;
using OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Base;

using OpenMetaverse;

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

using Autofac;

namespace OpenSim.Capabilities.Handlers
{
public class FetchInventory2ServerConnector : ServiceConnector
public class FetchInventory2ServerConnector : IServiceConnector
{
private IInventoryService m_InventoryService;
private string m_ConfigName = "CapsService";
private const string _ConfigName = "CapsService";

public FetchInventory2ServerConnector(IConfiguration config, IHttpServer server, string configName)
: base(config, server, configName)
protected readonly IConfiguration m_configuration;
protected readonly ILogger<FetchInvDescServerConnector> m_logger;
protected readonly IComponentContext m_context;

public FetchInventory2ServerConnector(
IConfiguration config,
ILogger<FetchInvDescServerConnector> logger,
IComponentContext componentContext)
{
if (configName != String.Empty)
m_ConfigName = configName;
m_configuration = config;
m_logger = logger;
m_context = componentContext;
}

IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
public string ConfigName { get; } = _ConfigName;
public IHttpServer HttpServer { get; private set; }

string invService = serverConfig.GetString("InventoryService", String.Empty);
public void Initialize(IHttpServer httpServer)
{
HttpServer = httpServer;

if (invService.Length == 0)
throw new Exception("No InventoryService in config file");
var serverConfig = m_configuration.GetSection(ConfigName);
if (serverConfig.Exists() is false)
throw new Exception($"No section '{ConfigName}' in config file");

Object[] args = new Object[] { config };
m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args);
string invService = serverConfig.GetValue("InventoryService", String.Empty);
if (string.IsNullOrEmpty(invService))
throw new Exception("No InventoryService in config file");

m_InventoryService = m_context.ResolveNamed<IInventoryService>(invService);
if (m_InventoryService == null)
throw new Exception(String.Format("Failed to load InventoryService from {0}; config is {1}", invService, m_ConfigName));
throw new Exception($"Failed to load InventoryService from {invService}; config is {ConfigName}");

FetchInventory2Handler fiHandler = new FetchInventory2Handler(m_InventoryService, UUID.Zero);
IRequestHandler reqHandler
= new RestStreamHandler(
"POST", "/CAPS/FetchInventory/", fiHandler.FetchInventoryRequest, "FetchInventory", null);
server.AddStreamHandler(reqHandler);

HttpServer.AddStreamHandler(reqHandler);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,44 +25,58 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

using Nini.Config;
using OpenMetaverse;

using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Base;
using OpenSim.Server.Handlers.Base;
using OpenSim.Services.Interfaces;
using System;

using Autofac;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

namespace OpenSim.Capabilities.Handlers
{
public class GetMeshServerConnector : ServiceConnector
public class GetMeshServerConnector : IServiceConnector
{
private IAssetService m_AssetService;
private string m_ConfigName = "CapsService";
private const string _ConfigName = "CapsService";

public GetMeshServerConnector(IConfiguration config, IHttpServer server, string configName) :
base(config, server, configName)
protected readonly IConfiguration m_configuration;
protected readonly ILogger<GetMeshServerConnector> m_logger;
protected readonly IComponentContext m_context;

public GetMeshServerConnector(
IConfiguration config,
ILogger<GetMeshServerConnector> logger,
IComponentContext componentContext
)
{
if (configName != String.Empty)
m_ConfigName = configName;
m_configuration = config;
m_logger = logger;
m_context = componentContext;
}

IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
public string ConfigName { get; } = _ConfigName;

string assetService = serverConfig.GetString("AssetService", String.Empty);
public IHttpServer HttpServer { get; private set; }

if (assetService.Length == 0)
throw new Exception("No AssetService in config file");
public void Initialize(IHttpServer httpServer)
{
var serverConfig = m_configuration.GetSection(ConfigName);
if (serverConfig.Exists() is false)
throw new Exception($"No section '{ConfigName}' in config file");

Object[] args = new Object[] { config };
m_AssetService =
ServerUtils.LoadPlugin<IAssetService>(assetService, args);
string assetService = serverConfig.GetValue("AssetService", string.Empty);
if (string.IsNullOrEmpty(assetService))
throw new Exception("No AssetService in config file");

m_AssetService = m_context.ResolveNamed<IAssetService>(assetService);
if (m_AssetService == null)
throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
throw new Exception($"Failed to load AssetService from {assetService}; config is {ConfigName}");

string rurl = serverConfig.GetString("GetMeshRedirectURL");
string rurl = serverConfig.GetValue("GetMeshRedirectURL", string.Empty);

GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService);
IRequestHandler reqHandler
Expand All @@ -72,7 +86,8 @@ IRequestHandler reqHandler
httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null),
"GetMesh",
null);
server.AddStreamHandler(reqHandler);

HttpServer.AddStreamHandler(reqHandler);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,49 +25,65 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

using System;
using Nini.Config;
using OpenSim.Server.Base;
using OpenSim.Server.Handlers.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Base;
using OpenMetaverse;

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Autofac;



namespace OpenSim.Capabilities.Handlers
{
public class GetTextureServerConnector : ServiceConnector
public class GetTextureServerConnector : IServiceConnector
{
private IAssetService m_AssetService;
private string m_ConfigName = "CapsService";
private const string _ConfigName = "CapsService";

protected readonly IConfiguration m_configuration;
protected readonly ILogger<GetTextureServerConnector> m_logger;
protected readonly IComponentContext m_context;

public GetTextureServerConnector(IConfiguration config, IHttpServer server, string configName) :
base(config, server, configName)
public GetTextureServerConnector(
IConfiguration config,
ILogger<GetTextureServerConnector> logger,
IComponentContext componentContext
)
{
if (configName != String.Empty)
m_ConfigName = configName;
m_configuration = config;
m_logger = logger;
m_context = componentContext;
}

IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
public string ConfigName { get; } = _ConfigName;
public IHttpServer HttpServer { get; private set; }

string assetService = serverConfig.GetString("AssetService", String.Empty);
public void Initialize(IHttpServer httpServer)
{
HttpServer = httpServer;

if (assetService.Length == 0)
throw new Exception("No AssetService in config file");
var serverConfig = m_configuration.GetSection(ConfigName);
if (serverConfig.Exists() is false)
throw new Exception($"No section '{ConfigName}' in config file");

Object[] args = new Object[] { config };
m_AssetService =
ServerUtils.LoadPlugin<IAssetService>(assetService, args);
string assetService = serverConfig.GetValue("AssetService", String.Empty);
if (string.IsNullOrEmpty(assetService))
throw new Exception("No AssetService in config file");

m_AssetService = m_context.ResolveNamed<IAssetService>(assetService);
if (m_AssetService == null)
throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName));
throw new Exception($"Failed to load AssetService from {assetService}; config is {ConfigName}");

string rurl = serverConfig.GetString("GetTextureRedirectURL");
string rurl = serverConfig.GetValue("GetTextureRedirectURL", string.Empty);

server.AddStreamHandler(
HttpServer.AddStreamHandler(
new GetTextureRobustHandler("/CAPS/GetTexture", m_AssetService, "GetTexture", null, rurl));
}



}
}

2 changes: 1 addition & 1 deletion Source/OpenSim.Data.Null/NullAuthenticationData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class NullAuthenticationData : IAuthenticationData
private static Dictionary<UUID, AuthenticationData> m_DataByUUID = new Dictionary<UUID, AuthenticationData>();
private static Dictionary<UUID, string> m_Tokens = new Dictionary<UUID, string>();

public NullAuthenticationData(string connectionString, string realm)
public void Initialize(string connectionString, string realm)
{
}

Expand Down
2 changes: 1 addition & 1 deletion Source/OpenSim.Data.Null/NullAvatarData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class NullAvatarData : IAvatarData
{
private static Dictionary<UUID, AvatarBaseData> m_DataByUUID = new Dictionary<UUID, AvatarBaseData>();

public NullAvatarData(string connectionString, string realm)
public void Initialize(string connectionString, string realm)
{
}

Expand Down
Loading

0 comments on commit 915f04e

Please sign in to comment.