Compare commits
13 Commits
master
...
GenericGri
Author | SHA1 | Date |
---|---|---|
MW | 66dc459a06 | |
MW | 78f4f49965 | |
MW | 70f283e089 | |
MW | c7151a5a2b | |
MW | da2cbb75b6 | |
MW | aa5b4b6437 | |
MW | 9b9456c985 | |
MW | ce0e98ad30 | |
MW | bb1823a7ad | |
MW | 21e9ad6150 | |
MW | 4fc37a4abd | |
MW | 1e015a4cb8 | |
MW | 29c4eef1fe |
|
@ -200,6 +200,7 @@ namespace OpenSim.Framework
|
||||||
m_librariesXMLFile = value;
|
m_librariesXMLFile = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected string m_assetSetsXMLFile;
|
protected string m_assetSetsXMLFile;
|
||||||
public string AssetSetsXMLFile
|
public string AssetSetsXMLFile
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using Nini.Config;
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
|
@ -49,6 +50,11 @@ namespace OpenSim.Framework
|
||||||
public string UserRecvKey = String.Empty;
|
public string UserRecvKey = String.Empty;
|
||||||
public string UserSendKey = String.Empty;
|
public string UserSendKey = String.Empty;
|
||||||
|
|
||||||
|
public GridConfig()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public GridConfig(string description, string filename)
|
public GridConfig(string description, string filename)
|
||||||
{
|
{
|
||||||
configMember =
|
configMember =
|
||||||
|
@ -56,6 +62,15 @@ namespace OpenSim.Framework
|
||||||
configMember.performConfigurationRetrieve();
|
configMember.performConfigurationRetrieve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LoadConfigurationFromNini(IConfigSource configSource)
|
||||||
|
{
|
||||||
|
IConfig config = configSource.Configs["GridServerConfig"];
|
||||||
|
if (config != null)
|
||||||
|
{
|
||||||
|
Util.ReadSettingsFromIniFile<GridConfig>(config, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void loadConfigurationOptions()
|
public void loadConfigurationOptions()
|
||||||
{
|
{
|
||||||
configMember.addConfigurationOption("default_asset_server",
|
configMember.addConfigurationOption("default_asset_server",
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Nini.Config;
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
|
@ -91,6 +92,15 @@ namespace OpenSim.Framework
|
||||||
configMember.performConfigurationRetrieve();
|
configMember.performConfigurationRetrieve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LoadConfigurationFromNini(IConfigSource configSource)
|
||||||
|
{
|
||||||
|
IConfig config = configSource.Configs["UserServerConfig"];
|
||||||
|
if (config != null)
|
||||||
|
{
|
||||||
|
Util.ReadSettingsFromIniFile<UserConfig>(config, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void loadConfigurationOptions()
|
public void loadConfigurationOptions()
|
||||||
{
|
{
|
||||||
configMember.addConfigurationOption("default_startup_message",
|
configMember.addConfigurationOption("default_startup_message",
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -931,5 +932,76 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
return displayConnectionString;
|
return displayConnectionString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static T ReadSettingsFromIniFile<T>(IConfig config, T settingsClass)
|
||||||
|
{
|
||||||
|
Type settingsType = settingsClass.GetType();
|
||||||
|
|
||||||
|
FieldInfo[] fieldInfos = settingsType.GetFields();
|
||||||
|
foreach (FieldInfo fieldInfo in fieldInfos)
|
||||||
|
{
|
||||||
|
if (!fieldInfo.IsStatic)
|
||||||
|
{
|
||||||
|
if (fieldInfo.FieldType == typeof(System.String))
|
||||||
|
{
|
||||||
|
fieldInfo.SetValue(settingsClass, config.Get(fieldInfo.Name, (string)fieldInfo.GetValue(settingsClass)));
|
||||||
|
}
|
||||||
|
else if (fieldInfo.FieldType == typeof(System.Boolean))
|
||||||
|
{
|
||||||
|
fieldInfo.SetValue(settingsClass, config.GetBoolean(fieldInfo.Name, (bool)fieldInfo.GetValue(settingsClass)));
|
||||||
|
}
|
||||||
|
else if (fieldInfo.FieldType == typeof(System.Int32))
|
||||||
|
{
|
||||||
|
fieldInfo.SetValue(settingsClass, config.GetInt(fieldInfo.Name, (int)fieldInfo.GetValue(settingsClass)));
|
||||||
|
}
|
||||||
|
else if (fieldInfo.FieldType == typeof(System.Single))
|
||||||
|
{
|
||||||
|
fieldInfo.SetValue(settingsClass, config.GetFloat(fieldInfo.Name, (float)fieldInfo.GetValue(settingsClass)));
|
||||||
|
}
|
||||||
|
else if (fieldInfo.FieldType == typeof(System.UInt32))
|
||||||
|
{
|
||||||
|
fieldInfo.SetValue(settingsClass, System.Convert.ToUInt32(config.Get(fieldInfo.Name, ((uint)fieldInfo.GetValue(settingsClass)).ToString())));
|
||||||
|
}
|
||||||
|
else if (fieldInfo.FieldType == typeof(System.Uri))
|
||||||
|
{
|
||||||
|
fieldInfo.SetValue(settingsClass, new Uri(config.Get(fieldInfo.Name, (string)fieldInfo.GetValue(settingsClass))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyInfo[] propertyInfos = settingsType.GetProperties();
|
||||||
|
foreach (PropertyInfo propInfo in propertyInfos)
|
||||||
|
{
|
||||||
|
if ((propInfo.CanRead) && (propInfo.CanWrite))
|
||||||
|
{
|
||||||
|
if (propInfo.PropertyType == typeof(System.String))
|
||||||
|
{
|
||||||
|
propInfo.SetValue(settingsClass, config.Get(propInfo.Name, (string)propInfo.GetValue(settingsClass, null)), null);
|
||||||
|
}
|
||||||
|
else if (propInfo.PropertyType == typeof(System.Boolean))
|
||||||
|
{
|
||||||
|
propInfo.SetValue(settingsClass, config.GetBoolean(propInfo.Name, (bool)propInfo.GetValue(settingsClass, null)), null);
|
||||||
|
}
|
||||||
|
else if (propInfo.PropertyType == typeof(System.Int32))
|
||||||
|
{
|
||||||
|
propInfo.SetValue(settingsClass, config.GetInt(propInfo.Name, (int)propInfo.GetValue(settingsClass, null)), null);
|
||||||
|
}
|
||||||
|
else if (propInfo.PropertyType == typeof(System.Single))
|
||||||
|
{
|
||||||
|
propInfo.SetValue(settingsClass, config.GetFloat(propInfo.Name, (float)propInfo.GetValue(settingsClass, null)), null);
|
||||||
|
}
|
||||||
|
else if (propInfo.PropertyType == typeof(System.UInt32))
|
||||||
|
{
|
||||||
|
propInfo.SetValue(settingsClass, System.Convert.ToUInt32(config.Get(propInfo.Name, ((uint)propInfo.GetValue(settingsClass, null)).ToString())), null);
|
||||||
|
}
|
||||||
|
else if (propInfo.PropertyType == typeof(System.Uri))
|
||||||
|
{
|
||||||
|
propInfo.SetValue(settingsClass, new Uri(config.Get(propInfo.Name, (string)propInfo.GetValue(settingsClass, null))), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return settingsClass;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,5 +9,6 @@ namespace OpenSim.Grid.Framework
|
||||||
void Initialise(IGridServiceCore core);
|
void Initialise(IGridServiceCore core);
|
||||||
void PostInitialise();
|
void PostInitialise();
|
||||||
void RegisterHandlers(BaseHttpServer httpServer);
|
void RegisterHandlers(BaseHttpServer httpServer);
|
||||||
|
string Name { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using OpenSim.Grid.Framework;
|
||||||
|
using log4net;
|
||||||
|
using System.Reflection;
|
||||||
|
using OpenSim.Framework.Servers;
|
||||||
|
|
||||||
|
namespace OpenSim.Grid.GridServer.ModuleLoader
|
||||||
|
{
|
||||||
|
public class GridModuleLoaderPlugin : IGridPlugin
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
protected List<IGridServiceModule> m_modules;
|
||||||
|
protected GridServerBase m_core;
|
||||||
|
|
||||||
|
#region IGridPlugin Members
|
||||||
|
|
||||||
|
public void Initialise(GridServerBase gridServer)
|
||||||
|
{
|
||||||
|
m_core = gridServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PostInitialise()
|
||||||
|
{
|
||||||
|
GridModuleLoader<IGridServiceModule> moduleLoader = new GridModuleLoader<IGridServiceModule>();
|
||||||
|
|
||||||
|
m_modules = moduleLoader.PickupModules(".");
|
||||||
|
|
||||||
|
InitializeModules();
|
||||||
|
PostInitializeModules();
|
||||||
|
RegisterModuleHandlers();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
protected void InitializeModules()
|
||||||
|
{
|
||||||
|
foreach (IGridServiceModule m in m_modules)
|
||||||
|
{
|
||||||
|
m_log.InfoFormat("[MODULES]: Initialising Grid Service Module {0}", m.Name);
|
||||||
|
m.Initialise(m_core);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void PostInitializeModules()
|
||||||
|
{
|
||||||
|
foreach (IGridServiceModule m in m_modules)
|
||||||
|
{
|
||||||
|
//m_log.InfoFormat("[MODULES]: Initialising Grid Service Module {0}", m.Name);
|
||||||
|
m.PostInitialise();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void RegisterModuleHandlers()
|
||||||
|
{
|
||||||
|
BaseHttpServer httpServer;
|
||||||
|
if (m_core.TryGet<BaseHttpServer>(out httpServer))
|
||||||
|
{
|
||||||
|
foreach (IGridServiceModule m in m_modules)
|
||||||
|
{
|
||||||
|
//m_log.InfoFormat("[MODULES]: Initialising Grid Service Module {0}", m.Name);
|
||||||
|
m.RegisterHandlers(httpServer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IPlugin Members
|
||||||
|
|
||||||
|
public string Version
|
||||||
|
{
|
||||||
|
get { return "0.1"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "GridModuleLoaderPlugin"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialise()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IDisposable Members
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
|
@ -39,9 +39,9 @@ using OpenSim.Grid.Framework;
|
||||||
|
|
||||||
namespace OpenSim.Grid.GridServer.Modules
|
namespace OpenSim.Grid.GridServer.Modules
|
||||||
{
|
{
|
||||||
public class GridMessagingModule : IMessagingServerDiscovery
|
public class GridMessagingModule : IMessagingServerDiscovery, IGridServiceModule
|
||||||
{
|
{
|
||||||
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
protected IRegionProfileService m_gridDBService;
|
protected IRegionProfileService m_gridDBService;
|
||||||
protected IGridServiceCore m_gridCore;
|
protected IGridServiceCore m_gridCore;
|
||||||
|
@ -62,27 +62,28 @@ namespace OpenSim.Grid.GridServer.Modules
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(string opensimVersion, IRegionProfileService gridDBService, IGridServiceCore gridCore, GridConfig config)
|
public void Initialise(IGridServiceCore core)
|
||||||
{
|
{
|
||||||
//m_opensimVersion = opensimVersion;
|
m_gridCore = core;
|
||||||
m_gridDBService = gridDBService;
|
|
||||||
m_gridCore = gridCore;
|
|
||||||
m_config = config;
|
|
||||||
|
|
||||||
m_gridCore.RegisterInterface<IMessagingServerDiscovery>(this);
|
m_gridCore.RegisterInterface<IMessagingServerDiscovery>(this);
|
||||||
|
|
||||||
RegisterHandlers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
|
if (m_gridCore.TryGet<IRegionProfileService>(out m_gridDBService) &&
|
||||||
|
m_gridCore.TryGet<GridConfig>(out m_config))
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.Error("[GridMessagingModule] Failed to post initialize module");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegisterHandlers()
|
public void RegisterHandlers(BaseHttpServer httpServer)
|
||||||
{
|
{
|
||||||
//have these in separate method as some servers restart the http server and reregister all the handlers.
|
m_httpServer = httpServer;
|
||||||
m_httpServer = m_gridCore.GetHttpServer();
|
|
||||||
|
|
||||||
// Message Server ---> Grid Server
|
// Message Server ---> Grid Server
|
||||||
m_httpServer.AddXmlRPCHandler("register_messageserver", XmlRPCRegisterMessageServer);
|
m_httpServer.AddXmlRPCHandler("register_messageserver", XmlRPCRegisterMessageServer);
|
||||||
|
@ -158,5 +159,14 @@ namespace OpenSim.Grid.GridServer.Modules
|
||||||
m_messageServers.Remove(m);
|
m_messageServers.Remove(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "GridMessagingModule"; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ using OpenSim.Grid.Framework;
|
||||||
|
|
||||||
namespace OpenSim.Grid.GridServer.Modules
|
namespace OpenSim.Grid.GridServer.Modules
|
||||||
{
|
{
|
||||||
public class GridRestModule
|
public class GridRestModule : IGridServiceModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
@ -67,24 +67,34 @@ namespace OpenSim.Grid.GridServer.Modules
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(string opensimVersion, GridDBService gridDBService, IGridServiceCore gridCore, GridConfig config)
|
#region IGridServiceModule Members
|
||||||
|
|
||||||
|
public void Close()
|
||||||
{
|
{
|
||||||
//m_opensimVersion = opensimVersion;
|
throw new NotImplementedException();
|
||||||
m_gridDBService = gridDBService;
|
}
|
||||||
m_gridCore = gridCore;
|
|
||||||
m_config = config;
|
public void Initialise(IGridServiceCore core)
|
||||||
RegisterHandlers();
|
{
|
||||||
|
m_gridCore = core;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
|
IRegionProfileService dbService;
|
||||||
|
if (m_gridCore.TryGet<IRegionProfileService>(out dbService) &&
|
||||||
|
m_gridCore.TryGet<GridConfig>(out m_config))
|
||||||
|
{
|
||||||
|
if (dbService is GridDBService)
|
||||||
|
m_gridDBService = (GridDBService)dbService;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_log.Warn("[GridRestModule]: Could not get modules from core");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegisterHandlers()
|
public void RegisterHandlers(BaseHttpServer httpServer)
|
||||||
{
|
{
|
||||||
//have these in separate method as some servers restart the http server and reregister all the handlers.
|
m_httpServer = httpServer;
|
||||||
m_httpServer = m_gridCore.GetHttpServer();
|
|
||||||
|
|
||||||
m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", RestGetSimMethod));
|
m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", RestGetSimMethod));
|
||||||
m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", RestSetSimMethod));
|
m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/sims/", RestSetSimMethod));
|
||||||
|
@ -93,6 +103,13 @@ namespace OpenSim.Grid.GridServer.Modules
|
||||||
m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/regions/", RestSetRegionMethod));
|
m_httpServer.AddStreamHandler(new RestStreamHandler("POST", "/regions/", RestSetRegionMethod));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "GridRestModule"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs a REST Get Operation
|
/// Performs a REST Get Operation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using OpenSim.Data;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Grid.Framework;
|
using OpenSim.Grid.Framework;
|
||||||
|
@ -33,7 +34,7 @@ namespace OpenSim.Grid.GridServer.Modules
|
||||||
public void Initialise(GridServerBase gridServer)
|
public void Initialise(GridServerBase gridServer)
|
||||||
{
|
{
|
||||||
m_core = gridServer;
|
m_core = gridServer;
|
||||||
m_config = gridServer.Config;
|
m_config = gridServer.GConfig;
|
||||||
m_version = gridServer.Version;
|
m_version = gridServer.Version;
|
||||||
m_console = MainConsole.Instance;
|
m_console = MainConsole.Instance;
|
||||||
|
|
||||||
|
@ -42,6 +43,10 @@ namespace OpenSim.Grid.GridServer.Modules
|
||||||
SetupGridServices();
|
SetupGridServices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void PostInitialise()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IPlugin Members
|
#region IPlugin Members
|
||||||
|
@ -71,19 +76,8 @@ namespace OpenSim.Grid.GridServer.Modules
|
||||||
|
|
||||||
//Register the database access service so modules can fetch it
|
//Register the database access service so modules can fetch it
|
||||||
// RegisterInterface<GridDBService>(m_gridDBService);
|
// RegisterInterface<GridDBService>(m_gridDBService);
|
||||||
|
m_core.RegisterInterface<IRegionProfileService>(m_gridDBService);
|
||||||
m_gridMessageModule = new GridMessagingModule();
|
m_core.RegisterInterface<GridConfig>(m_config);
|
||||||
m_gridMessageModule.Initialise(m_version, m_gridDBService, m_core, m_config);
|
|
||||||
|
|
||||||
m_gridXmlRpcModule = new GridXmlRpcModule();
|
|
||||||
m_gridXmlRpcModule.Initialise(m_version, m_gridDBService, m_core, m_config);
|
|
||||||
|
|
||||||
m_gridRestModule = new GridRestModule();
|
|
||||||
m_gridRestModule.Initialise(m_version, m_gridDBService, m_core, m_config);
|
|
||||||
|
|
||||||
m_gridMessageModule.PostInitialise();
|
|
||||||
m_gridXmlRpcModule.PostInitialise();
|
|
||||||
m_gridRestModule.PostInitialise();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Console Command Handlers
|
#region Console Command Handlers
|
||||||
|
|
|
@ -42,7 +42,7 @@ using OpenSim.Grid.Framework;
|
||||||
|
|
||||||
namespace OpenSim.Grid.GridServer.Modules
|
namespace OpenSim.Grid.GridServer.Modules
|
||||||
{
|
{
|
||||||
public class GridXmlRpcModule
|
public class GridXmlRpcModule : IGridServiceModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
@ -69,28 +69,27 @@ namespace OpenSim.Grid.GridServer.Modules
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(string opensimVersion, IRegionProfileService gridDBService, IGridServiceCore gridCore, GridConfig config)
|
#region IGridServiceModule Members
|
||||||
|
|
||||||
|
public void Initialise(IGridServiceCore core)
|
||||||
{
|
{
|
||||||
m_opensimVersion = opensimVersion;
|
m_gridCore = core;
|
||||||
m_gridDBService = gridDBService;
|
|
||||||
m_gridCore = gridCore;
|
|
||||||
m_config = config;
|
|
||||||
RegisterHandlers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
IMessagingServerDiscovery messagingModule;
|
IMessagingServerDiscovery messagingModule;
|
||||||
if (m_gridCore.TryGet<IMessagingServerDiscovery>(out messagingModule))
|
if (m_gridCore.TryGet<IMessagingServerDiscovery>(out messagingModule) &&
|
||||||
|
m_gridCore.TryGet<IRegionProfileService>(out m_gridDBService) &&
|
||||||
|
m_gridCore.TryGet<GridConfig>(out m_config))
|
||||||
{
|
{
|
||||||
m_messagingServerMapper = messagingModule;
|
m_messagingServerMapper = messagingModule;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegisterHandlers()
|
public void RegisterHandlers(BaseHttpServer httpServer)
|
||||||
{
|
{
|
||||||
//have these in separate method as some servers restart the http server and reregister all the handlers.
|
m_httpServer = httpServer;
|
||||||
m_httpServer = m_gridCore.GetHttpServer();
|
|
||||||
|
|
||||||
m_httpServer.AddXmlRPCHandler("simulator_login", XmlRpcSimulatorLoginMethod);
|
m_httpServer.AddXmlRPCHandler("simulator_login", XmlRpcSimulatorLoginMethod);
|
||||||
m_httpServer.AddXmlRPCHandler("simulator_data_request", XmlRpcSimulatorDataRequestMethod);
|
m_httpServer.AddXmlRPCHandler("simulator_data_request", XmlRpcSimulatorDataRequestMethod);
|
||||||
|
@ -99,6 +98,17 @@ namespace OpenSim.Grid.GridServer.Modules
|
||||||
m_httpServer.AddXmlRPCHandler("search_for_region_by_name", XmlRpcSearchForRegionMethod);
|
m_httpServer.AddXmlRPCHandler("search_for_region_by_name", XmlRpcSearchForRegionMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "GridXmlRpcModule"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a XML String containing a list of the neighbouring regions
|
/// Returns a XML String containing a list of the neighbouring regions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
<Addin id="OpenSim.Grid.GridServer" version="0.5" />
|
<Addin id="OpenSim.Grid.GridServer" version="0.5" />
|
||||||
</Dependencies>
|
</Dependencies>
|
||||||
<Extension path = "/OpenSim/GridServer">
|
<Extension path = "/OpenSim/GridServer">
|
||||||
<Plugin id="GridServerModules" type="OpenSim.Grid.GridServer.Modules.GridServerPlugin" />
|
<Plugin id="GridServerPlugin" type="OpenSim.Grid.GridServer.Modules.GridServerPlugin" />
|
||||||
</Extension>
|
</Extension>
|
||||||
</Addin>
|
</Addin>
|
||||||
|
|
|
@ -0,0 +1,250 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Xml;
|
||||||
|
using log4net;
|
||||||
|
using Nini.Config;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
namespace OpenSim.Grid.GridServer
|
||||||
|
{
|
||||||
|
public class GridConfigurationLoader
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
protected OpenSimConfigSource m_config;
|
||||||
|
|
||||||
|
public GridConfigurationLoader()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public OpenSimConfigSource LoadConfigSettings(IConfigSource configSource)
|
||||||
|
{
|
||||||
|
bool iniFileExists = false;
|
||||||
|
|
||||||
|
IConfig startupConfig = configSource.Configs["Startup"];
|
||||||
|
|
||||||
|
string masterFileName = startupConfig.GetString("inimaster", "");
|
||||||
|
string masterfilePath = Path.Combine(Util.configDir(), masterFileName);
|
||||||
|
|
||||||
|
string iniDirName = startupConfig.GetString("inidirectory", "GridConfig");
|
||||||
|
string iniDirPath = Path.Combine(Util.configDir(), iniDirName);
|
||||||
|
|
||||||
|
string iniFileName = startupConfig.GetString("inifile", "OpenSim.Grid.ini");
|
||||||
|
string iniFilePath = Path.Combine(Util.configDir(), iniFileName);
|
||||||
|
|
||||||
|
string xmlPath = Path.Combine(Util.configDir(), "OpenSim.Grid.xml");
|
||||||
|
|
||||||
|
m_config = new OpenSimConfigSource();
|
||||||
|
m_config.Source = new IniConfigSource();
|
||||||
|
m_config.Source.Merge(DefaultConfig());
|
||||||
|
|
||||||
|
m_log.Info("[CONFIG] Reading configuration settings");
|
||||||
|
|
||||||
|
Uri configUri;
|
||||||
|
|
||||||
|
//check for master .INI file (name passed in command line, no default), or XML over http
|
||||||
|
if (masterFileName.Length > 0) // If a master file name is given ...
|
||||||
|
{
|
||||||
|
m_log.InfoFormat("[CONFIG] Reading config master file {0}", masterfilePath);
|
||||||
|
|
||||||
|
bool isMasterUri = Uri.TryCreate(masterFileName, UriKind.Absolute, out configUri) && configUri.Scheme == Uri.UriSchemeHttp;
|
||||||
|
|
||||||
|
if (!ReadConfig(masterFileName, masterfilePath, m_config, isMasterUri))
|
||||||
|
{
|
||||||
|
m_log.FatalFormat("[CONFIG] Could not open master config file {0}", masterfilePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Directory.Exists(iniDirName))
|
||||||
|
{
|
||||||
|
m_log.InfoFormat("Searching folder: {0} , for config ini files", iniDirName);
|
||||||
|
string[] fileEntries = Directory.GetFiles(iniDirName);
|
||||||
|
foreach (string filePath in fileEntries)
|
||||||
|
{
|
||||||
|
// m_log.InfoFormat("reading ini file < {0} > from config dir", filePath);
|
||||||
|
ReadConfig(Path.GetFileName(filePath), filePath, m_config, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for .INI file (either default or name passed on command
|
||||||
|
// line) or XML config source over http
|
||||||
|
bool isIniUri = Uri.TryCreate(iniFileName, UriKind.Absolute, out configUri) && configUri.Scheme == Uri.UriSchemeHttp;
|
||||||
|
iniFileExists = ReadConfig(iniFileName, iniFilePath, m_config, isIniUri);
|
||||||
|
|
||||||
|
if (!iniFileExists)
|
||||||
|
{
|
||||||
|
// check for a xml config file
|
||||||
|
if (File.Exists(xmlPath))
|
||||||
|
{
|
||||||
|
iniFilePath = xmlPath;
|
||||||
|
|
||||||
|
m_log.InfoFormat("Reading XML configuration from {0}", Path.GetFullPath(xmlPath));
|
||||||
|
iniFileExists = true;
|
||||||
|
|
||||||
|
m_config.Source = new XmlConfigSource();
|
||||||
|
m_config.Source.Merge(new XmlConfigSource(iniFilePath));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_config.Source.Merge(configSource);
|
||||||
|
|
||||||
|
if (!iniFileExists)
|
||||||
|
{
|
||||||
|
m_log.FatalFormat("[CONFIG] Could not load any configuration");
|
||||||
|
if (!isIniUri)
|
||||||
|
m_log.FatalFormat("[CONFIG] Tried to load {0}, ", Path.GetFullPath(iniFilePath));
|
||||||
|
else
|
||||||
|
m_log.FatalFormat("[CONFIG] Tried to load from URI {0}, ", iniFileName);
|
||||||
|
m_log.FatalFormat("[CONFIG] and XML source {0}", Path.GetFullPath(xmlPath));
|
||||||
|
|
||||||
|
m_log.FatalFormat("[CONFIG] Did you copy the OpenSim.Grid.ini.example file to OpenSim.Grid.ini?");
|
||||||
|
Environment.Exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
ReadConfigSettings();
|
||||||
|
|
||||||
|
return m_config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provide same ini loader functionality for standard ini and master ini - file system or XML over http
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="iniName">The name of the ini to load</param>
|
||||||
|
/// <param name="iniPath">Full path to the ini</param>
|
||||||
|
/// <param name="m_config">The current configuration source</param>
|
||||||
|
/// <param name="isUri">Boolean representing whether the ini source is a URI path over http or a file on the system</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private bool ReadConfig(string iniName, string iniPath, OpenSimConfigSource m_config, bool isUri)
|
||||||
|
{
|
||||||
|
bool success = false;
|
||||||
|
|
||||||
|
if (!isUri && File.Exists(iniPath))
|
||||||
|
{
|
||||||
|
m_log.InfoFormat("[CONFIG] Reading configuration file {0}", Path.GetFullPath(iniPath));
|
||||||
|
|
||||||
|
// From reading Nini's code, it seems that later merged keys replace earlier ones.
|
||||||
|
m_config.Source.Merge(new IniConfigSource(iniPath));
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (isUri)
|
||||||
|
{
|
||||||
|
m_log.InfoFormat("[CONFIG] {0} is a http:// URI, fetching ...", iniName);
|
||||||
|
|
||||||
|
// The ini file path is a http URI
|
||||||
|
// Try to read it
|
||||||
|
try
|
||||||
|
{
|
||||||
|
XmlReader r = XmlReader.Create(iniName);
|
||||||
|
XmlConfigSource cs = new XmlConfigSource(r);
|
||||||
|
m_config.Source.Merge(cs);
|
||||||
|
|
||||||
|
success = true;
|
||||||
|
m_log.InfoFormat("[CONFIG] Loaded config from {0}", iniName);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.FatalFormat("[CONFIG] Exception reading config from URI {0}\n" + e.ToString(), iniName);
|
||||||
|
Environment.Exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Setup a default config values in case they aren't present in the ini file
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static IConfigSource DefaultConfig()
|
||||||
|
{
|
||||||
|
IConfigSource defaultConfig = new IniConfigSource();
|
||||||
|
|
||||||
|
{
|
||||||
|
IConfig config = defaultConfig.Configs["Startup"];
|
||||||
|
|
||||||
|
if (null == config)
|
||||||
|
config = defaultConfig.AddConfig("Startup");
|
||||||
|
|
||||||
|
config.Set("LoadPlugins", "GridServerPlugin,UserServerPlugin");
|
||||||
|
config.Set("HttpPort", "8051");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
IConfig config = defaultConfig.Configs["GridServices"];
|
||||||
|
|
||||||
|
if (null == config)
|
||||||
|
config = defaultConfig.AddConfig("GridServices");
|
||||||
|
|
||||||
|
config.Set("enable", false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return defaultConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void ReadConfigSettings()
|
||||||
|
{
|
||||||
|
IConfig startupConfig = m_config.Source.Configs["Startup"];
|
||||||
|
if (startupConfig != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
IConfig standaloneConfig = m_config.Source.Configs["StandAlone"];
|
||||||
|
if (standaloneConfig != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class OpenSimConfigSource
|
||||||
|
{
|
||||||
|
public IConfigSource Source;
|
||||||
|
|
||||||
|
public void Save(string path)
|
||||||
|
{
|
||||||
|
if (Source is IniConfigSource)
|
||||||
|
{
|
||||||
|
IniConfigSource iniCon = (IniConfigSource)Source;
|
||||||
|
iniCon.Save(path);
|
||||||
|
}
|
||||||
|
else if (Source is XmlConfigSource)
|
||||||
|
{
|
||||||
|
XmlConfigSource xmlCon = (XmlConfigSource)Source;
|
||||||
|
xmlCon.Save(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -31,6 +31,7 @@ using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using Nini.Config;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
|
@ -44,11 +45,25 @@ namespace OpenSim.Grid.GridServer
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
protected GridConfig m_config;
|
protected GridConfig m_gconfig;
|
||||||
|
protected UserConfig m_uconfig;
|
||||||
|
|
||||||
public GridConfig Config
|
protected GridConfigurationLoader m_configLoader;
|
||||||
|
protected OpenSimConfigSource m_configSource;
|
||||||
|
|
||||||
|
public OpenSimConfigSource ConfigSource
|
||||||
{
|
{
|
||||||
get { return m_config; }
|
get { return m_configSource; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public GridConfig GConfig
|
||||||
|
{
|
||||||
|
get { return m_gconfig; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserConfig UConfig
|
||||||
|
{
|
||||||
|
get { return m_uconfig; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Version
|
public string Version
|
||||||
|
@ -68,23 +83,61 @@ namespace OpenSim.Grid.GridServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public GridServerBase()
|
public GridServerBase(IConfigSource configSource)
|
||||||
{
|
{
|
||||||
m_console = new ConsoleBase("Grid");
|
m_console = new ConsoleBase("Grid");
|
||||||
MainConsole.Instance = m_console;
|
MainConsole.Instance = m_console;
|
||||||
|
|
||||||
|
m_configLoader = new GridConfigurationLoader();
|
||||||
|
m_configSource = m_configLoader.LoadConfigSettings(configSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void StartupSpecific()
|
protected override void StartupSpecific()
|
||||||
{
|
{
|
||||||
m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml")));
|
uint httpPort = 8051;
|
||||||
|
|
||||||
m_log.Info("[GRID]: Starting HTTP process");
|
// m_gconfig = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml")));
|
||||||
m_httpServer = new BaseHttpServer(m_config.HttpPort);
|
|
||||||
|
|
||||||
LoadPlugins();
|
//m_uconfig = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml")));
|
||||||
|
|
||||||
m_httpServer.Start();
|
m_uconfig = new UserConfig();
|
||||||
|
m_uconfig.LoadConfigurationFromNini(m_configSource.Source);
|
||||||
|
|
||||||
|
m_gconfig = new GridConfig();
|
||||||
|
m_gconfig.LoadConfigurationFromNini(m_configSource.Source);
|
||||||
|
|
||||||
|
Console.WriteLine("grid server database provider is {0} ", m_gconfig.DatabaseProvider);
|
||||||
|
|
||||||
|
IConfig startupConfig = m_configSource.Source.Configs["Startup"];
|
||||||
|
if (startupConfig != null)
|
||||||
|
{
|
||||||
|
httpPort = Convert.ToUInt32(startupConfig.GetString("HttpPort", "8051"));
|
||||||
|
|
||||||
|
m_log.InfoFormat("[GRID]: Starting HTTP process on port {0}", httpPort);
|
||||||
|
m_httpServer = new BaseHttpServer(httpPort);
|
||||||
|
RegisterInterface<BaseHttpServer>(m_httpServer);
|
||||||
|
|
||||||
|
string pluginsToLoad = startupConfig.GetString("LoadPlugins", "");
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(pluginsToLoad))
|
||||||
|
{
|
||||||
|
LoadPlugins(pluginsToLoad);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LoadPlugins();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (IGridPlugin plugin in m_plugins)
|
||||||
|
{
|
||||||
|
plugin.PostInitialise();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_httpServer.Start();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
base.StartupSpecific();
|
base.StartupSpecific();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,6 +150,18 @@ namespace OpenSim.Grid.GridServer
|
||||||
m_plugins = loader.Plugins;
|
m_plugins = loader.Plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual void LoadPlugins(string pluginNames)
|
||||||
|
{
|
||||||
|
PluginLoader<IGridPlugin> loader =
|
||||||
|
new PluginLoader<IGridPlugin>(new GridPluginInitialiser(this));
|
||||||
|
|
||||||
|
PluginIdFilter filer = new PluginIdFilter(pluginNames);
|
||||||
|
loader.Add("/OpenSim/GridServer", filer);
|
||||||
|
|
||||||
|
loader.Load();
|
||||||
|
m_plugins = loader.Plugins;
|
||||||
|
}
|
||||||
|
|
||||||
public override void ShutdownSpecific()
|
public override void ShutdownSpecific()
|
||||||
{
|
{
|
||||||
foreach (IGridPlugin plugin in m_plugins) plugin.Dispose();
|
foreach (IGridPlugin plugin in m_plugins) plugin.Dispose();
|
||||||
|
|
|
@ -33,6 +33,7 @@ namespace OpenSim.Grid.GridServer
|
||||||
public interface IGridPlugin : IPlugin
|
public interface IGridPlugin : IPlugin
|
||||||
{
|
{
|
||||||
void Initialise(GridServerBase gridServer);
|
void Initialise(GridServerBase gridServer);
|
||||||
|
void PostInitialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GridPluginInitialiser : PluginInitialiserBase
|
public class GridPluginInitialiser : PluginInitialiserBase
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using log4net.Config;
|
using log4net.Config;
|
||||||
|
using Nini.Config;
|
||||||
|
|
||||||
namespace OpenSim.Grid.GridServer
|
namespace OpenSim.Grid.GridServer
|
||||||
{
|
{
|
||||||
|
@ -35,7 +36,18 @@ namespace OpenSim.Grid.GridServer
|
||||||
{
|
{
|
||||||
XmlConfigurator.Configure();
|
XmlConfigurator.Configure();
|
||||||
|
|
||||||
GridServerBase app = new GridServerBase();
|
ArgvConfigSource configSource = new ArgvConfigSource(args);
|
||||||
|
|
||||||
|
configSource.Alias.AddAlias("On", true);
|
||||||
|
configSource.Alias.AddAlias("Off", false);
|
||||||
|
configSource.Alias.AddAlias("True", true);
|
||||||
|
configSource.Alias.AddAlias("False", false);
|
||||||
|
|
||||||
|
configSource.AddSwitch("Startup", "inifile");
|
||||||
|
configSource.AddSwitch("Startup", "inimaster");
|
||||||
|
configSource.AddSwitch("Startup", "inidirectory");
|
||||||
|
|
||||||
|
GridServerBase app = new GridServerBase(configSource);
|
||||||
|
|
||||||
// if (args.Length > 0 && args[0] == "-setuponly")
|
// if (args.Length > 0 && args[0] == "-setuponly")
|
||||||
// {
|
// {
|
||||||
|
|
|
@ -41,7 +41,7 @@ using OpenSim.Grid.Framework;
|
||||||
|
|
||||||
namespace OpenSim.Grid.UserServer.Modules
|
namespace OpenSim.Grid.UserServer.Modules
|
||||||
{
|
{
|
||||||
public class GridInfoServiceModule
|
public class GridInfoServiceModule : IGridServiceModule
|
||||||
{
|
{
|
||||||
protected IGridServiceCore m_core;
|
protected IGridServiceCore m_core;
|
||||||
protected GridInfoService m_gridInfoService;
|
protected GridInfoService m_gridInfoService;
|
||||||
|
@ -73,5 +73,10 @@ namespace OpenSim.Grid.UserServer.Modules
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "GridInfoServiceModule"; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ namespace OpenSim.Grid.UserServer.Modules
|
||||||
public delegate void RegionShutdownDelegate(UUID regionID);
|
public delegate void RegionShutdownDelegate(UUID regionID);
|
||||||
|
|
||||||
|
|
||||||
public class MessageServersConnector
|
public class MessageServersConnector : IGridServiceModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
@ -508,5 +508,15 @@ namespace OpenSim.Grid.UserServer.Modules
|
||||||
response.Value = result;
|
response.Value = result;
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "MessageServersConnector"; }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
<Addin id="OpenSim.Grid.UserServer.Modules" version="0.1">
|
||||||
|
<Runtime>
|
||||||
|
<Import assembly="OpenSim.Grid.UserServer.Modules.dll"/>
|
||||||
|
</Runtime>
|
||||||
|
<Dependencies>
|
||||||
|
<Addin id="OpenSim.Grid.GridServer" version="0.5" />
|
||||||
|
</Dependencies>
|
||||||
|
<Extension path = "/OpenSim/GridServer">
|
||||||
|
<Plugin id="UserServerPlugin" type="OpenSim.Grid.UserServer.Modules.UserServerPlugin" />
|
||||||
|
</Extension>
|
||||||
|
</Addin>
|
|
@ -41,7 +41,7 @@ namespace OpenSim.Grid.UserServer.Modules
|
||||||
{
|
{
|
||||||
public delegate void logOffUser(UUID AgentID);
|
public delegate void logOffUser(UUID AgentID);
|
||||||
|
|
||||||
public class UserManager
|
public class UserManager : IGridServiceModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
@ -50,24 +50,22 @@ namespace OpenSim.Grid.UserServer.Modules
|
||||||
|
|
||||||
private UserDataBaseService m_userDataBaseService;
|
private UserDataBaseService m_userDataBaseService;
|
||||||
private BaseHttpServer m_httpServer;
|
private BaseHttpServer m_httpServer;
|
||||||
|
private IGridServiceCore m_core;
|
||||||
|
|
||||||
/// <summary>
|
public UserManager()
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userDataBaseService"></param>
|
|
||||||
public UserManager( UserDataBaseService userDataBaseService)
|
|
||||||
{
|
{
|
||||||
m_userDataBaseService = userDataBaseService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(IGridServiceCore core)
|
public void Initialise(IGridServiceCore core)
|
||||||
{
|
{
|
||||||
|
m_core = core;
|
||||||
|
m_core.RegisterInterface<UserManager>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
|
if (!m_core.TryGet<UserDataBaseService>(out m_userDataBaseService))
|
||||||
|
m_log.Error("[UserManager]: Failed to fetch database plugin");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegisterHandlers(BaseHttpServer httpServer)
|
public void RegisterHandlers(BaseHttpServer httpServer)
|
||||||
|
@ -685,6 +683,15 @@ namespace OpenSim.Grid.UserServer.Modules
|
||||||
public void HandleRegionShutdown(UUID regionID)
|
public void HandleRegionShutdown(UUID regionID)
|
||||||
{
|
{
|
||||||
m_userDataBaseService.LogoutUsers(regionID);
|
m_userDataBaseService.LogoutUsers(regionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "UserManager"; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,26 +39,27 @@ using OpenSim.Grid.Framework;
|
||||||
|
|
||||||
namespace OpenSim.Grid.UserServer.Modules
|
namespace OpenSim.Grid.UserServer.Modules
|
||||||
{
|
{
|
||||||
public class UserServerAvatarAppearanceModule
|
public class UserServerAvatarAppearanceModule : IGridServiceModule
|
||||||
{
|
{
|
||||||
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private UserDataBaseService m_userDataBaseService;
|
private UserDataBaseService m_userDataBaseService;
|
||||||
private BaseHttpServer m_httpServer;
|
private BaseHttpServer m_httpServer;
|
||||||
|
private IGridServiceCore m_core;
|
||||||
|
|
||||||
public UserServerAvatarAppearanceModule(UserDataBaseService userDataBaseService)
|
public UserServerAvatarAppearanceModule()
|
||||||
{
|
{
|
||||||
m_userDataBaseService = userDataBaseService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(IGridServiceCore core)
|
public void Initialise(IGridServiceCore core)
|
||||||
{
|
{
|
||||||
|
m_core = core;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
|
if (!m_core.TryGet<UserDataBaseService>(out m_userDataBaseService))
|
||||||
|
m_log.Error("[UserServerAvatarAppearanceModule]: Failed to fetch database plugin");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegisterHandlers(BaseHttpServer httpServer)
|
public void RegisterHandlers(BaseHttpServer httpServer)
|
||||||
|
@ -121,5 +122,14 @@ namespace OpenSim.Grid.UserServer.Modules
|
||||||
response.Value = responseData;
|
response.Value = responseData;
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "UserServerAvatarAppearanceModule"; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,374 +1,383 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using log4net.Config;
|
using log4net.Config;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Data;
|
using OpenSim.Data;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
using OpenSim.Framework.Statistics;
|
using OpenSim.Framework.Statistics;
|
||||||
using OpenSim.Grid.Communications.OGS1;
|
using OpenSim.Grid.Communications.OGS1;
|
||||||
using OpenSim.Grid.Framework;
|
using OpenSim.Grid.Framework;
|
||||||
using OpenSim.Grid.UserServer.Modules;
|
|
||||||
|
namespace OpenSim.Grid.UserServer.Modules
|
||||||
namespace OpenSim.Grid.UserServer
|
{
|
||||||
{
|
public class UserServerCommandModule : IGridServiceModule
|
||||||
public class UserServerCommandModule
|
{
|
||||||
{
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
|
protected ConsoleBase m_console;
|
||||||
protected ConsoleBase m_console;
|
protected UserConfig m_cfg;
|
||||||
protected UserConfig m_cfg;
|
|
||||||
|
protected UserDataBaseService m_userDataBaseService;
|
||||||
protected UserDataBaseService m_userDataBaseService;
|
protected UserLoginService m_loginService;
|
||||||
protected UserLoginService m_loginService;
|
|
||||||
|
protected UUID m_lastCreatedUser = UUID.Random();
|
||||||
protected UUID m_lastCreatedUser = UUID.Random();
|
|
||||||
|
protected IGridServiceCore m_core;
|
||||||
protected IGridServiceCore m_core;
|
|
||||||
|
public UserServerCommandModule()
|
||||||
public UserServerCommandModule()
|
{
|
||||||
{
|
}
|
||||||
}
|
|
||||||
|
public void Initialise(IGridServiceCore core)
|
||||||
public void Initialise(IGridServiceCore core)
|
{
|
||||||
{
|
m_core = core;
|
||||||
m_core = core;
|
}
|
||||||
}
|
|
||||||
|
public void PostInitialise()
|
||||||
public void PostInitialise()
|
{
|
||||||
{
|
UserConfig cfg;
|
||||||
UserConfig cfg;
|
if (m_core.TryGet<UserConfig>(out cfg))
|
||||||
if (m_core.TryGet<UserConfig>(out cfg))
|
{
|
||||||
{
|
m_cfg = cfg;
|
||||||
m_cfg = cfg;
|
}
|
||||||
}
|
|
||||||
|
UserDataBaseService userDBservice;
|
||||||
UserDataBaseService userDBservice;
|
if (m_core.TryGet<UserDataBaseService>(out userDBservice))
|
||||||
if (m_core.TryGet<UserDataBaseService>(out userDBservice))
|
{
|
||||||
{
|
m_userDataBaseService = userDBservice;
|
||||||
m_userDataBaseService = userDBservice;
|
}
|
||||||
}
|
|
||||||
|
UserLoginService loginService;
|
||||||
UserLoginService loginService;
|
if (m_core.TryGet<UserLoginService>(out loginService))
|
||||||
if (m_core.TryGet<UserLoginService>(out loginService))
|
{
|
||||||
{
|
m_loginService = loginService;
|
||||||
m_loginService = loginService;
|
}
|
||||||
}
|
|
||||||
|
ConsoleBase console;
|
||||||
ConsoleBase console;
|
if ((m_core.TryGet<ConsoleBase>(out console)) && (m_cfg != null)
|
||||||
if ((m_core.TryGet<ConsoleBase>(out console)) && (m_cfg != null)
|
&& (m_userDataBaseService != null) && (m_loginService != null))
|
||||||
&& (m_userDataBaseService != null) && (m_loginService != null))
|
{
|
||||||
{
|
RegisterConsoleCommands(console);
|
||||||
RegisterConsoleCommands(console);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public void RegisterHandlers(BaseHttpServer httpServer)
|
||||||
public void RegisterHandlers(BaseHttpServer httpServer)
|
{
|
||||||
{
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
private void RegisterConsoleCommands(ConsoleBase console)
|
||||||
private void RegisterConsoleCommands(ConsoleBase console)
|
{
|
||||||
{
|
m_console = console;
|
||||||
m_console = console;
|
m_console.Commands.AddCommand("userserver", false, "create user",
|
||||||
m_console.Commands.AddCommand("userserver", false, "create user",
|
"create user [<first> [<last> [<x> <y> [email]]]]",
|
||||||
"create user [<first> [<last> [<x> <y> [email]]]]",
|
"Create a new user account", RunCommand);
|
||||||
"Create a new user account", RunCommand);
|
|
||||||
|
m_console.Commands.AddCommand("userserver", false, "reset user password",
|
||||||
m_console.Commands.AddCommand("userserver", false, "reset user password",
|
"reset user password [<first> [<last> [<new password>]]]",
|
||||||
"reset user password [<first> [<last> [<new password>]]]",
|
"Reset a user's password", RunCommand);
|
||||||
"Reset a user's password", RunCommand);
|
|
||||||
|
m_console.Commands.AddCommand("userserver", false, "login level",
|
||||||
m_console.Commands.AddCommand("userserver", false, "login level",
|
"login level <level>",
|
||||||
"login level <level>",
|
"Set the minimum user level to log in", HandleLoginCommand);
|
||||||
"Set the minimum user level to log in", HandleLoginCommand);
|
|
||||||
|
m_console.Commands.AddCommand("userserver", false, "login reset",
|
||||||
m_console.Commands.AddCommand("userserver", false, "login reset",
|
"login reset",
|
||||||
"login reset",
|
"Reset the login level to allow all users",
|
||||||
"Reset the login level to allow all users",
|
HandleLoginCommand);
|
||||||
HandleLoginCommand);
|
|
||||||
|
m_console.Commands.AddCommand("userserver", false, "login text",
|
||||||
m_console.Commands.AddCommand("userserver", false, "login text",
|
"login text <text>",
|
||||||
"login text <text>",
|
"Set the text users will see on login", HandleLoginCommand);
|
||||||
"Set the text users will see on login", HandleLoginCommand);
|
|
||||||
|
m_console.Commands.AddCommand("userserver", false, "test-inventory",
|
||||||
m_console.Commands.AddCommand("userserver", false, "test-inventory",
|
"test-inventory",
|
||||||
"test-inventory",
|
"Perform a test inventory transaction", RunCommand);
|
||||||
"Perform a test inventory transaction", RunCommand);
|
|
||||||
|
m_console.Commands.AddCommand("userserver", false, "logoff-user",
|
||||||
m_console.Commands.AddCommand("userserver", false, "logoff-user",
|
"logoff-user <first> <last> <message>",
|
||||||
"logoff-user <first> <last> <message>",
|
"Log off a named user", RunCommand);
|
||||||
"Log off a named user", RunCommand);
|
}
|
||||||
}
|
|
||||||
|
#region Console Command Handlers
|
||||||
#region Console Command Handlers
|
public void do_create(string[] args)
|
||||||
public void do_create(string[] args)
|
{
|
||||||
{
|
switch (args[0])
|
||||||
switch (args[0])
|
{
|
||||||
{
|
case "user":
|
||||||
case "user":
|
CreateUser(args);
|
||||||
CreateUser(args);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
/// <summary>
|
/// Execute switch for some of the reset commands
|
||||||
/// Execute switch for some of the reset commands
|
/// </summary>
|
||||||
/// </summary>
|
/// <param name="args"></param>
|
||||||
/// <param name="args"></param>
|
protected void Reset(string[] args)
|
||||||
protected void Reset(string[] args)
|
{
|
||||||
{
|
if (args.Length == 0)
|
||||||
if (args.Length == 0)
|
return;
|
||||||
return;
|
|
||||||
|
switch (args[0])
|
||||||
switch (args[0])
|
{
|
||||||
{
|
case "user":
|
||||||
case "user":
|
|
||||||
|
switch (args[1])
|
||||||
switch (args[1])
|
{
|
||||||
{
|
case "password":
|
||||||
case "password":
|
ResetUserPassword(args);
|
||||||
ResetUserPassword(args);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
/// <summary>
|
/// Create a new user
|
||||||
/// Create a new user
|
/// </summary>
|
||||||
/// </summary>
|
/// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param>
|
||||||
/// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param>
|
protected void CreateUser(string[] cmdparams)
|
||||||
protected void CreateUser(string[] cmdparams)
|
{
|
||||||
{
|
string firstName;
|
||||||
string firstName;
|
string lastName;
|
||||||
string lastName;
|
string password;
|
||||||
string password;
|
string email;
|
||||||
string email;
|
uint regX = 1000;
|
||||||
uint regX = 1000;
|
uint regY = 1000;
|
||||||
uint regY = 1000;
|
|
||||||
|
if (cmdparams.Length < 2)
|
||||||
if (cmdparams.Length < 2)
|
firstName = MainConsole.Instance.CmdPrompt("First name", "Default");
|
||||||
firstName = MainConsole.Instance.CmdPrompt("First name", "Default");
|
else firstName = cmdparams[1];
|
||||||
else firstName = cmdparams[1];
|
|
||||||
|
if (cmdparams.Length < 3)
|
||||||
if (cmdparams.Length < 3)
|
lastName = MainConsole.Instance.CmdPrompt("Last name", "User");
|
||||||
lastName = MainConsole.Instance.CmdPrompt("Last name", "User");
|
else lastName = cmdparams[2];
|
||||||
else lastName = cmdparams[2];
|
|
||||||
|
if (cmdparams.Length < 4)
|
||||||
if (cmdparams.Length < 4)
|
password = MainConsole.Instance.PasswdPrompt("Password");
|
||||||
password = MainConsole.Instance.PasswdPrompt("Password");
|
else password = cmdparams[3];
|
||||||
else password = cmdparams[3];
|
|
||||||
|
if (cmdparams.Length < 5)
|
||||||
if (cmdparams.Length < 5)
|
regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", regX.ToString()));
|
||||||
regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", regX.ToString()));
|
else regX = Convert.ToUInt32(cmdparams[4]);
|
||||||
else regX = Convert.ToUInt32(cmdparams[4]);
|
|
||||||
|
if (cmdparams.Length < 6)
|
||||||
if (cmdparams.Length < 6)
|
regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString()));
|
||||||
regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString()));
|
else regY = Convert.ToUInt32(cmdparams[5]);
|
||||||
else regY = Convert.ToUInt32(cmdparams[5]);
|
|
||||||
|
if (cmdparams.Length < 7)
|
||||||
if (cmdparams.Length < 7)
|
email = MainConsole.Instance.CmdPrompt("Email", "");
|
||||||
email = MainConsole.Instance.CmdPrompt("Email", "");
|
else email = cmdparams[6];
|
||||||
else email = cmdparams[6];
|
|
||||||
|
if (null == m_userDataBaseService.GetUserProfile(firstName, lastName))
|
||||||
if (null == m_userDataBaseService.GetUserProfile(firstName, lastName))
|
{
|
||||||
{
|
m_lastCreatedUser = m_userDataBaseService.AddUser(firstName, lastName, password, email, regX, regY);
|
||||||
m_lastCreatedUser = m_userDataBaseService.AddUser(firstName, lastName, password, email, regX, regY);
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
m_log.ErrorFormat("[USERS]: A user with the name {0} {1} already exists!", firstName, lastName);
|
||||||
m_log.ErrorFormat("[USERS]: A user with the name {0} {1} already exists!", firstName, lastName);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
/// <summary>
|
/// Reset a user password.
|
||||||
/// Reset a user password.
|
/// </summary>
|
||||||
/// </summary>
|
/// <param name="cmdparams"></param>
|
||||||
/// <param name="cmdparams"></param>
|
private void ResetUserPassword(string[] cmdparams)
|
||||||
private void ResetUserPassword(string[] cmdparams)
|
{
|
||||||
{
|
string firstName;
|
||||||
string firstName;
|
string lastName;
|
||||||
string lastName;
|
string newPassword;
|
||||||
string newPassword;
|
|
||||||
|
if (cmdparams.Length < 3)
|
||||||
if (cmdparams.Length < 3)
|
firstName = MainConsole.Instance.CmdPrompt("First name");
|
||||||
firstName = MainConsole.Instance.CmdPrompt("First name");
|
else firstName = cmdparams[2];
|
||||||
else firstName = cmdparams[2];
|
|
||||||
|
if (cmdparams.Length < 4)
|
||||||
if (cmdparams.Length < 4)
|
lastName = MainConsole.Instance.CmdPrompt("Last name");
|
||||||
lastName = MainConsole.Instance.CmdPrompt("Last name");
|
else lastName = cmdparams[3];
|
||||||
else lastName = cmdparams[3];
|
|
||||||
|
if (cmdparams.Length < 5)
|
||||||
if (cmdparams.Length < 5)
|
newPassword = MainConsole.Instance.PasswdPrompt("New password");
|
||||||
newPassword = MainConsole.Instance.PasswdPrompt("New password");
|
else newPassword = cmdparams[4];
|
||||||
else newPassword = cmdparams[4];
|
|
||||||
|
m_userDataBaseService.ResetUserPassword(firstName, lastName, newPassword);
|
||||||
m_userDataBaseService.ResetUserPassword(firstName, lastName, newPassword);
|
}
|
||||||
}
|
|
||||||
|
/*
|
||||||
/*
|
private void HandleTestCommand(string module, string[] cmd)
|
||||||
private void HandleTestCommand(string module, string[] cmd)
|
{
|
||||||
{
|
m_log.Info("test command received");
|
||||||
m_log.Info("test command received");
|
}
|
||||||
}
|
*/
|
||||||
*/
|
|
||||||
|
private void HandleLoginCommand(string module, string[] cmd)
|
||||||
private void HandleLoginCommand(string module, string[] cmd)
|
{
|
||||||
{
|
string subcommand = cmd[1];
|
||||||
string subcommand = cmd[1];
|
|
||||||
|
switch (subcommand)
|
||||||
switch (subcommand)
|
{
|
||||||
{
|
case "level":
|
||||||
case "level":
|
// Set the minimal level to allow login
|
||||||
// Set the minimal level to allow login
|
// Useful to allow grid update without worrying about users.
|
||||||
// Useful to allow grid update without worrying about users.
|
// or fixing critical issues
|
||||||
// or fixing critical issues
|
//
|
||||||
//
|
if (cmd.Length > 2)
|
||||||
if (cmd.Length > 2)
|
{
|
||||||
{
|
int level = Convert.ToInt32(cmd[2]);
|
||||||
int level = Convert.ToInt32(cmd[2]);
|
m_loginService.setloginlevel(level);
|
||||||
m_loginService.setloginlevel(level);
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case "reset":
|
||||||
case "reset":
|
m_loginService.setloginlevel(0);
|
||||||
m_loginService.setloginlevel(0);
|
break;
|
||||||
break;
|
case "text":
|
||||||
case "text":
|
if (cmd.Length > 2)
|
||||||
if (cmd.Length > 2)
|
{
|
||||||
{
|
m_loginService.setwelcometext(cmd[2]);
|
||||||
m_loginService.setwelcometext(cmd[2]);
|
}
|
||||||
}
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public void RunCommand(string module, string[] cmd)
|
||||||
public void RunCommand(string module, string[] cmd)
|
{
|
||||||
{
|
List<string> args = new List<string>(cmd);
|
||||||
List<string> args = new List<string>(cmd);
|
string command = cmd[0];
|
||||||
string command = cmd[0];
|
|
||||||
|
args.RemoveAt(0);
|
||||||
args.RemoveAt(0);
|
|
||||||
|
string[] cmdparams = args.ToArray();
|
||||||
string[] cmdparams = args.ToArray();
|
|
||||||
|
switch (command)
|
||||||
switch (command)
|
{
|
||||||
{
|
case "create":
|
||||||
case "create":
|
do_create(cmdparams);
|
||||||
do_create(cmdparams);
|
break;
|
||||||
break;
|
|
||||||
|
case "reset":
|
||||||
case "reset":
|
Reset(cmdparams);
|
||||||
Reset(cmdparams);
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
|
case "test-inventory":
|
||||||
case "test-inventory":
|
// RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>();
|
||||||
// RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>();
|
// requester.ReturnResponseVal = TestResponse;
|
||||||
// requester.ReturnResponseVal = TestResponse;
|
// requester.BeginPostObject<UUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser);
|
||||||
// requester.BeginPostObject<UUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser);
|
SynchronousRestObjectPoster.BeginPostObject<UUID, List<InventoryFolderBase>>(
|
||||||
SynchronousRestObjectPoster.BeginPostObject<UUID, List<InventoryFolderBase>>(
|
"POST", m_cfg.InventoryUrl + "RootFolders/", m_lastCreatedUser);
|
||||||
"POST", m_cfg.InventoryUrl + "RootFolders/", m_lastCreatedUser);
|
break;
|
||||||
break;
|
|
||||||
|
case "logoff-user":
|
||||||
case "logoff-user":
|
if (cmdparams.Length >= 3)
|
||||||
if (cmdparams.Length >= 3)
|
{
|
||||||
{
|
string firstname = cmdparams[0];
|
||||||
string firstname = cmdparams[0];
|
string lastname = cmdparams[1];
|
||||||
string lastname = cmdparams[1];
|
string message = "";
|
||||||
string message = "";
|
|
||||||
|
for (int i = 2; i < cmdparams.Length; i++)
|
||||||
for (int i = 2; i < cmdparams.Length; i++)
|
message += " " + cmdparams[i];
|
||||||
message += " " + cmdparams[i];
|
|
||||||
|
UserProfileData theUser = null;
|
||||||
UserProfileData theUser = null;
|
try
|
||||||
try
|
{
|
||||||
{
|
theUser = m_loginService.GetTheUser(firstname, lastname);
|
||||||
theUser = m_loginService.GetTheUser(firstname, lastname);
|
}
|
||||||
}
|
catch (Exception)
|
||||||
catch (Exception)
|
{
|
||||||
{
|
m_log.Error("[LOGOFF]: Error getting user data from the database.");
|
||||||
m_log.Error("[LOGOFF]: Error getting user data from the database.");
|
}
|
||||||
}
|
|
||||||
|
if (theUser != null)
|
||||||
if (theUser != null)
|
{
|
||||||
{
|
if (theUser.CurrentAgent != null)
|
||||||
if (theUser.CurrentAgent != null)
|
{
|
||||||
{
|
if (theUser.CurrentAgent.AgentOnline)
|
||||||
if (theUser.CurrentAgent.AgentOnline)
|
{
|
||||||
{
|
m_log.Info("[LOGOFF]: Logging off requested user!");
|
||||||
m_log.Info("[LOGOFF]: Logging off requested user!");
|
m_loginService.LogOffUser(theUser, message);
|
||||||
m_loginService.LogOffUser(theUser, message);
|
|
||||||
|
theUser.CurrentAgent.AgentOnline = false;
|
||||||
theUser.CurrentAgent.AgentOnline = false;
|
|
||||||
|
m_loginService.CommitAgent(ref theUser);
|
||||||
m_loginService.CommitAgent(ref theUser);
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
m_log.Info(
|
||||||
m_log.Info(
|
"[LOGOFF]: User Doesn't appear to be online, sending the logoff message anyway.");
|
||||||
"[LOGOFF]: User Doesn't appear to be online, sending the logoff message anyway.");
|
m_loginService.LogOffUser(theUser, message);
|
||||||
m_loginService.LogOffUser(theUser, message);
|
|
||||||
|
theUser.CurrentAgent.AgentOnline = false;
|
||||||
theUser.CurrentAgent.AgentOnline = false;
|
|
||||||
|
m_loginService.CommitAgent(ref theUser);
|
||||||
m_loginService.CommitAgent(ref theUser);
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
m_log.Error(
|
||||||
m_log.Error(
|
"[LOGOFF]: Unable to logoff-user. User doesn't have an agent record so I can't find the simulator to notify");
|
||||||
"[LOGOFF]: Unable to logoff-user. User doesn't have an agent record so I can't find the simulator to notify");
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
m_log.Info("[LOGOFF]: User doesn't exist in the database");
|
||||||
m_log.Info("[LOGOFF]: User doesn't exist in the database");
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
m_log.Error(
|
||||||
m_log.Error(
|
"[LOGOFF]: Invalid amount of parameters. logoff-user takes at least three. Firstname, Lastname, and message");
|
||||||
"[LOGOFF]: Invalid amount of parameters. logoff-user takes at least three. Firstname, Lastname, and message");
|
}
|
||||||
}
|
|
||||||
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
#endregion
|
||||||
#endregion
|
|
||||||
}
|
public void Close()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "UserServerCommandModule"; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,141 +1,151 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using log4net.Config;
|
using log4net.Config;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Data;
|
using OpenSim.Data;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
using OpenSim.Framework.Statistics;
|
using OpenSim.Framework.Statistics;
|
||||||
using OpenSim.Grid.Communications.OGS1;
|
using OpenSim.Grid.Communications.OGS1;
|
||||||
using OpenSim.Grid.Framework;
|
using OpenSim.Grid.Framework;
|
||||||
using OpenSim.Grid.UserServer.Modules;
|
|
||||||
|
namespace OpenSim.Grid.UserServer.Modules
|
||||||
namespace OpenSim.Grid.UserServer
|
{
|
||||||
{
|
//Do we actually need these event dispatchers?
|
||||||
//Do we actually need these event dispatchers?
|
//shouldn't the other modules just directly register event handlers to each other?
|
||||||
//shouldn't the other modules just directly register event handlers to each other?
|
public class UserServerEventDispatchModule : IGridServiceModule
|
||||||
public class UserServerEventDispatchModule
|
{
|
||||||
{
|
protected UserManager m_userManager;
|
||||||
protected UserManager m_userManager;
|
protected MessageServersConnector m_messagesService;
|
||||||
protected MessageServersConnector m_messagesService;
|
protected UserLoginService m_loginService;
|
||||||
protected UserLoginService m_loginService;
|
|
||||||
|
private IGridServiceCore m_core;
|
||||||
public UserServerEventDispatchModule(UserManager userManager, MessageServersConnector messagesService, UserLoginService loginService)
|
|
||||||
{
|
public UserServerEventDispatchModule()
|
||||||
m_userManager = userManager;
|
{
|
||||||
m_messagesService = messagesService;
|
}
|
||||||
m_loginService = loginService;
|
|
||||||
}
|
public void Initialise(IGridServiceCore core)
|
||||||
|
{
|
||||||
public void Initialise(IGridServiceCore core)
|
m_core = core;
|
||||||
{
|
}
|
||||||
}
|
|
||||||
|
public void PostInitialise()
|
||||||
public void PostInitialise()
|
{
|
||||||
{
|
if (m_core.TryGet<UserManager>(out m_userManager) &&
|
||||||
m_loginService.OnUserLoggedInAtLocation += NotifyMessageServersUserLoggedInToLocation;
|
m_core.TryGet<MessageServersConnector>(out m_messagesService) &&
|
||||||
m_userManager.OnLogOffUser += NotifyMessageServersUserLoggOff;
|
m_core.TryGet<UserLoginService>(out m_loginService))
|
||||||
|
{
|
||||||
m_messagesService.OnAgentLocation += HandleAgentLocation;
|
|
||||||
m_messagesService.OnAgentLeaving += HandleAgentLeaving;
|
m_loginService.OnUserLoggedInAtLocation += NotifyMessageServersUserLoggedInToLocation;
|
||||||
m_messagesService.OnRegionStartup += HandleRegionStartup;
|
m_userManager.OnLogOffUser += NotifyMessageServersUserLoggOff;
|
||||||
m_messagesService.OnRegionShutdown += HandleRegionShutdown;
|
|
||||||
}
|
m_messagesService.OnAgentLocation += HandleAgentLocation;
|
||||||
|
m_messagesService.OnAgentLeaving += HandleAgentLeaving;
|
||||||
public void RegisterHandlers(BaseHttpServer httpServer)
|
m_messagesService.OnRegionStartup += HandleRegionStartup;
|
||||||
{
|
m_messagesService.OnRegionShutdown += HandleRegionShutdown;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void RegisterHandlers(BaseHttpServer httpServer)
|
||||||
{
|
{
|
||||||
m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Event Handlers
|
public void Close()
|
||||||
public void NotifyMessageServersUserLoggOff(UUID agentID)
|
{
|
||||||
{
|
m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation;
|
||||||
m_messagesService.TellMessageServersAboutUserLogoff(agentID);
|
}
|
||||||
}
|
|
||||||
|
#region Event Handlers
|
||||||
public void NotifyMessageServersUserLoggedInToLocation(UUID agentID, UUID sessionID, UUID RegionID,
|
public void NotifyMessageServersUserLoggOff(UUID agentID)
|
||||||
ulong regionhandle, float positionX, float positionY,
|
{
|
||||||
float positionZ, string firstname, string lastname)
|
m_messagesService.TellMessageServersAboutUserLogoff(agentID);
|
||||||
{
|
}
|
||||||
m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, positionX,
|
|
||||||
positionY, positionZ, firstname, lastname);
|
public void NotifyMessageServersUserLoggedInToLocation(UUID agentID, UUID sessionID, UUID RegionID,
|
||||||
}
|
ulong regionhandle, float positionX, float positionY,
|
||||||
|
float positionZ, string firstname, string lastname)
|
||||||
public void HandleAgentLocation(UUID agentID, UUID regionID, ulong regionHandle)
|
{
|
||||||
{
|
m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, positionX,
|
||||||
m_userManager.HandleAgentLocation(agentID, regionID, regionHandle);
|
positionY, positionZ, firstname, lastname);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleAgentLeaving(UUID agentID, UUID regionID, ulong regionHandle)
|
public void HandleAgentLocation(UUID agentID, UUID regionID, ulong regionHandle)
|
||||||
{
|
{
|
||||||
m_userManager.HandleAgentLeaving(agentID, regionID, regionHandle);
|
m_userManager.HandleAgentLocation(agentID, regionID, regionHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleRegionStartup(UUID regionID)
|
public void HandleAgentLeaving(UUID agentID, UUID regionID, ulong regionHandle)
|
||||||
{
|
{
|
||||||
// This might seem strange, that we send this back to the
|
m_userManager.HandleAgentLeaving(agentID, regionID, regionHandle);
|
||||||
// server it came from. But there is method to the madness.
|
}
|
||||||
// There can be multiple user servers on the same database,
|
|
||||||
// and each can have multiple messaging servers. So, we send
|
public void HandleRegionStartup(UUID regionID)
|
||||||
// it to all known user servers, who send it to all known
|
{
|
||||||
// message servers. That way, we should be able to finally
|
// This might seem strange, that we send this back to the
|
||||||
// update presence to all regions and thereby all friends
|
// server it came from. But there is method to the madness.
|
||||||
//
|
// There can be multiple user servers on the same database,
|
||||||
m_userManager.HandleRegionStartup(regionID);
|
// and each can have multiple messaging servers. So, we send
|
||||||
m_messagesService.TellMessageServersAboutRegionShutdown(regionID);
|
// it to all known user servers, who send it to all known
|
||||||
}
|
// message servers. That way, we should be able to finally
|
||||||
|
// update presence to all regions and thereby all friends
|
||||||
public void HandleRegionShutdown(UUID regionID)
|
//
|
||||||
{
|
m_userManager.HandleRegionStartup(regionID);
|
||||||
// This might seem strange, that we send this back to the
|
m_messagesService.TellMessageServersAboutRegionShutdown(regionID);
|
||||||
// server it came from. But there is method to the madness.
|
}
|
||||||
// There can be multiple user servers on the same database,
|
|
||||||
// and each can have multiple messaging servers. So, we send
|
public void HandleRegionShutdown(UUID regionID)
|
||||||
// it to all known user servers, who send it to all known
|
{
|
||||||
// message servers. That way, we should be able to finally
|
// This might seem strange, that we send this back to the
|
||||||
// update presence to all regions and thereby all friends
|
// server it came from. But there is method to the madness.
|
||||||
//
|
// There can be multiple user servers on the same database,
|
||||||
m_userManager.HandleRegionShutdown(regionID);
|
// and each can have multiple messaging servers. So, we send
|
||||||
m_messagesService.TellMessageServersAboutRegionShutdown(regionID);
|
// it to all known user servers, who send it to all known
|
||||||
}
|
// message servers. That way, we should be able to finally
|
||||||
#endregion
|
// update presence to all regions and thereby all friends
|
||||||
}
|
//
|
||||||
}
|
m_userManager.HandleRegionShutdown(regionID);
|
||||||
|
m_messagesService.TellMessageServersAboutRegionShutdown(regionID);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "UserServerEventDispatchModule"; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -36,30 +36,32 @@ using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
using OpenSim.Grid.Framework;
|
using OpenSim.Grid.Framework;
|
||||||
|
using OpenSim.Grid.GridServer;
|
||||||
|
|
||||||
namespace OpenSim.Grid.UserServer.Modules
|
namespace OpenSim.Grid.UserServer.Modules
|
||||||
{
|
{
|
||||||
public class UserServerFriendsModule
|
public class UserServerFriendsModule : IGridServiceModule
|
||||||
{
|
{
|
||||||
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private UserDataBaseService m_userDataBaseService;
|
private UserDataBaseService m_userDataBaseService;
|
||||||
|
|
||||||
private BaseHttpServer m_httpServer;
|
private BaseHttpServer m_httpServer;
|
||||||
|
private IGridServiceCore m_core;
|
||||||
|
|
||||||
public UserServerFriendsModule(UserDataBaseService userDataBaseService)
|
public UserServerFriendsModule()
|
||||||
{
|
{
|
||||||
m_userDataBaseService = userDataBaseService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(IGridServiceCore core)
|
public void Initialise(IGridServiceCore core)
|
||||||
{
|
{
|
||||||
|
m_core = core;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
|
if (!m_core.TryGet<UserDataBaseService>(out m_userDataBaseService))
|
||||||
|
m_log.Error("[UserServerFriendsModule]: Failed to fetch database plugin");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegisterHandlers(BaseHttpServer httpServer)
|
public void RegisterHandlers(BaseHttpServer httpServer)
|
||||||
|
@ -170,5 +172,14 @@ namespace OpenSim.Grid.UserServer.Modules
|
||||||
|
|
||||||
return FriendListItemListtoXmlRPCResponse(returndata);
|
return FriendListItemListtoXmlRPCResponse(returndata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "UserServerFriendsModule"; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,170 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSim Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using log4net;
|
||||||
|
using log4net.Config;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Data;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Communications;
|
||||||
|
using OpenSim.Framework.Communications.Cache;
|
||||||
|
using OpenSim.Framework.Console;
|
||||||
|
using OpenSim.Framework.Servers;
|
||||||
|
using OpenSim.Framework.Statistics;
|
||||||
|
using OpenSim.Grid.Communications.OGS1;
|
||||||
|
using OpenSim.Grid.Framework;
|
||||||
|
using OpenSim.Grid.GridServer;
|
||||||
|
|
||||||
|
namespace OpenSim.Grid.UserServer.Modules
|
||||||
|
{
|
||||||
|
public class UserServerPlugin : IGridPlugin
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
protected UserConfig m_cfg;
|
||||||
|
|
||||||
|
protected UserDataBaseService m_userDataBaseService;
|
||||||
|
|
||||||
|
public UserLoginService m_loginService;
|
||||||
|
|
||||||
|
protected BaseHttpServer m_httpServer;
|
||||||
|
|
||||||
|
protected IGridServiceCore m_core;
|
||||||
|
|
||||||
|
protected ConsoleBase m_console;
|
||||||
|
|
||||||
|
protected List<IGridServiceModule> m_modules;
|
||||||
|
|
||||||
|
|
||||||
|
public UserServerPlugin()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IGridPlugin Members
|
||||||
|
|
||||||
|
public void Initialise(GridServerBase gridServer)
|
||||||
|
{
|
||||||
|
Initialise(gridServer.HttpServer, gridServer, gridServer.UConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PostInitialise()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public void Initialise(BaseHttpServer httpServer, IGridServiceCore core, UserConfig config)
|
||||||
|
{
|
||||||
|
m_httpServer = httpServer;
|
||||||
|
m_core = core;
|
||||||
|
m_cfg = config;
|
||||||
|
m_console = MainConsole.Instance;
|
||||||
|
|
||||||
|
IInterServiceInventoryServices inventoryService = StartupCoreComponents();
|
||||||
|
|
||||||
|
//setup services/modules
|
||||||
|
StartupUserServerModules();
|
||||||
|
|
||||||
|
StartOtherComponents(inventoryService);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual IInterServiceInventoryServices StartupCoreComponents()
|
||||||
|
{
|
||||||
|
|
||||||
|
m_core.RegisterInterface<ConsoleBase>(m_console);
|
||||||
|
m_core.RegisterInterface<UserConfig>(m_cfg);
|
||||||
|
|
||||||
|
//Should be in modules?
|
||||||
|
IInterServiceInventoryServices inventoryService = new OGS1InterServiceInventoryService(m_cfg.InventoryUrl);
|
||||||
|
// IRegionProfileRouter regionProfileService = new RegionProfileServiceProxy();
|
||||||
|
|
||||||
|
m_core.RegisterInterface<IInterServiceInventoryServices>(inventoryService);
|
||||||
|
// RegisterInterface<IRegionProfileRouter>(regionProfileService);
|
||||||
|
|
||||||
|
return inventoryService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Start up the user manager
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inventoryService"></param>
|
||||||
|
protected virtual void StartupUserServerModules()
|
||||||
|
{
|
||||||
|
m_log.Info("[STARTUP]: Establishing data connection");
|
||||||
|
//setup database access service, for now this has to be created before the other modules.
|
||||||
|
m_userDataBaseService = new UserDataBaseService();
|
||||||
|
m_userDataBaseService.Initialise(m_core);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void StartOtherComponents(IInterServiceInventoryServices inventoryService)
|
||||||
|
{
|
||||||
|
m_loginService = new UserLoginService(
|
||||||
|
m_userDataBaseService, inventoryService, new LibraryRootFolder(m_cfg.LibraryXmlfile), m_cfg, m_cfg.DefaultStartupMsg, new RegionProfileServiceProxy());
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the minimum defaultLevel to access to the grid
|
||||||
|
//
|
||||||
|
m_loginService.setloginlevel((int)m_cfg.DefaultUserLevel);
|
||||||
|
|
||||||
|
m_core.RegisterInterface<UserLoginService>(m_loginService); //TODO: should be done in the login service
|
||||||
|
|
||||||
|
m_loginService.RegisterHandlers(m_httpServer, m_cfg.EnableLLSDLogin, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IPlugin Members
|
||||||
|
|
||||||
|
public string Version
|
||||||
|
{
|
||||||
|
get { return "0.0"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "UserServerPlugin"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialise()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IDisposable Members
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,270 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of the OpenSim Project nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
|
||||||
using log4net;
|
|
||||||
using log4net.Config;
|
|
||||||
using OpenMetaverse;
|
|
||||||
using OpenSim.Data;
|
|
||||||
using OpenSim.Framework;
|
|
||||||
using OpenSim.Framework.Communications;
|
|
||||||
using OpenSim.Framework.Communications.Cache;
|
|
||||||
using OpenSim.Framework.Console;
|
|
||||||
using OpenSim.Framework.Servers;
|
|
||||||
using OpenSim.Framework.Statistics;
|
|
||||||
using OpenSim.Grid.Communications.OGS1;
|
|
||||||
using OpenSim.Grid.Framework;
|
|
||||||
using OpenSim.Grid.UserServer.Modules;
|
|
||||||
|
|
||||||
namespace OpenSim.Grid.UserServer
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Grid user server main class
|
|
||||||
/// </summary>
|
|
||||||
public class OpenUser_Main : BaseOpenSimServer, IGridServiceCore
|
|
||||||
{
|
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
|
|
||||||
protected UserConfig Cfg;
|
|
||||||
|
|
||||||
protected UserDataBaseService m_userDataBaseService;
|
|
||||||
|
|
||||||
public UserManager m_userManager;
|
|
||||||
|
|
||||||
protected UserServerAvatarAppearanceModule m_avatarAppearanceModule;
|
|
||||||
protected UserServerFriendsModule m_friendsModule;
|
|
||||||
|
|
||||||
public UserLoginService m_loginService;
|
|
||||||
public MessageServersConnector m_messagesService;
|
|
||||||
|
|
||||||
protected GridInfoServiceModule m_gridInfoService;
|
|
||||||
|
|
||||||
protected UserServerCommandModule m_consoleCommandModule;
|
|
||||||
protected UserServerEventDispatchModule m_eventDispatcher;
|
|
||||||
|
|
||||||
public static void Main(string[] args)
|
|
||||||
{
|
|
||||||
XmlConfigurator.Configure();
|
|
||||||
|
|
||||||
m_log.Info("Launching UserServer...");
|
|
||||||
|
|
||||||
OpenUser_Main userserver = new OpenUser_Main();
|
|
||||||
|
|
||||||
userserver.Startup();
|
|
||||||
userserver.Work();
|
|
||||||
}
|
|
||||||
|
|
||||||
public OpenUser_Main()
|
|
||||||
{
|
|
||||||
m_console = new ConsoleBase("User");
|
|
||||||
MainConsole.Instance = m_console;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Work()
|
|
||||||
{
|
|
||||||
m_console.Notice("Enter help for a list of commands\n");
|
|
||||||
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
m_console.Prompt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void StartupSpecific()
|
|
||||||
{
|
|
||||||
IInterServiceInventoryServices inventoryService = StartupCoreComponents();
|
|
||||||
|
|
||||||
m_stats = StatsManager.StartCollectingUserStats();
|
|
||||||
|
|
||||||
//setup services/modules
|
|
||||||
StartupUserServerModules();
|
|
||||||
|
|
||||||
StartOtherComponents(inventoryService);
|
|
||||||
|
|
||||||
//PostInitialise the modules
|
|
||||||
PostInitialiseModules();
|
|
||||||
|
|
||||||
//register http handlers and start http server
|
|
||||||
m_log.Info("[STARTUP]: Starting HTTP process");
|
|
||||||
RegisterHttpHandlers();
|
|
||||||
m_httpServer.Start();
|
|
||||||
|
|
||||||
base.StartupSpecific();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual IInterServiceInventoryServices StartupCoreComponents()
|
|
||||||
{
|
|
||||||
Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml")));
|
|
||||||
|
|
||||||
m_httpServer = new BaseHttpServer(Cfg.HttpPort);
|
|
||||||
|
|
||||||
RegisterInterface<ConsoleBase>(m_console);
|
|
||||||
RegisterInterface<UserConfig>(Cfg);
|
|
||||||
|
|
||||||
//Should be in modules?
|
|
||||||
IInterServiceInventoryServices inventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl);
|
|
||||||
// IRegionProfileRouter regionProfileService = new RegionProfileServiceProxy();
|
|
||||||
|
|
||||||
RegisterInterface<IInterServiceInventoryServices>(inventoryService);
|
|
||||||
// RegisterInterface<IRegionProfileRouter>(regionProfileService);
|
|
||||||
|
|
||||||
return inventoryService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Start up the user manager
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="inventoryService"></param>
|
|
||||||
protected virtual void StartupUserServerModules()
|
|
||||||
{
|
|
||||||
m_log.Info("[STARTUP]: Establishing data connection");
|
|
||||||
//setup database access service, for now this has to be created before the other modules.
|
|
||||||
m_userDataBaseService = new UserDataBaseService();
|
|
||||||
m_userDataBaseService.Initialise(this);
|
|
||||||
|
|
||||||
//TODO: change these modules so they fetch the databaseService class in the PostInitialise method
|
|
||||||
m_userManager = new UserManager(m_userDataBaseService);
|
|
||||||
m_userManager.Initialise(this);
|
|
||||||
|
|
||||||
m_avatarAppearanceModule = new UserServerAvatarAppearanceModule(m_userDataBaseService);
|
|
||||||
m_avatarAppearanceModule.Initialise(this);
|
|
||||||
|
|
||||||
m_friendsModule = new UserServerFriendsModule(m_userDataBaseService);
|
|
||||||
m_friendsModule.Initialise(this);
|
|
||||||
|
|
||||||
m_consoleCommandModule = new UserServerCommandModule();
|
|
||||||
m_consoleCommandModule.Initialise(this);
|
|
||||||
|
|
||||||
m_messagesService = new MessageServersConnector();
|
|
||||||
m_messagesService.Initialise(this);
|
|
||||||
|
|
||||||
m_gridInfoService = new GridInfoServiceModule();
|
|
||||||
m_gridInfoService.Initialise(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void StartOtherComponents(IInterServiceInventoryServices inventoryService)
|
|
||||||
{
|
|
||||||
StartupLoginService(inventoryService);
|
|
||||||
//
|
|
||||||
// Get the minimum defaultLevel to access to the grid
|
|
||||||
//
|
|
||||||
m_loginService.setloginlevel((int)Cfg.DefaultUserLevel);
|
|
||||||
|
|
||||||
RegisterInterface<UserLoginService>(m_loginService); //TODO: should be done in the login service
|
|
||||||
|
|
||||||
m_eventDispatcher = new UserServerEventDispatchModule(m_userManager, m_messagesService, m_loginService);
|
|
||||||
m_eventDispatcher.Initialise(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Start up the login service
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="inventoryService"></param>
|
|
||||||
protected virtual void StartupLoginService(IInterServiceInventoryServices inventoryService)
|
|
||||||
{
|
|
||||||
m_loginService = new UserLoginService(
|
|
||||||
m_userDataBaseService, inventoryService, new LibraryRootFolder(Cfg.LibraryXmlfile), Cfg, Cfg.DefaultStartupMsg, new RegionProfileServiceProxy());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void PostInitialiseModules()
|
|
||||||
{
|
|
||||||
m_consoleCommandModule.PostInitialise(); //it will register its Console command handlers in here
|
|
||||||
m_userDataBaseService.PostInitialise();
|
|
||||||
m_messagesService.PostInitialise();
|
|
||||||
m_eventDispatcher.PostInitialise(); //it will register event handlers in here
|
|
||||||
m_gridInfoService.PostInitialise();
|
|
||||||
m_userManager.PostInitialise();
|
|
||||||
m_avatarAppearanceModule.PostInitialise();
|
|
||||||
m_friendsModule.PostInitialise();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void RegisterHttpHandlers()
|
|
||||||
{
|
|
||||||
m_loginService.RegisterHandlers(m_httpServer, Cfg.EnableLLSDLogin, true);
|
|
||||||
|
|
||||||
m_userManager.RegisterHandlers(m_httpServer);
|
|
||||||
m_friendsModule.RegisterHandlers(m_httpServer);
|
|
||||||
m_avatarAppearanceModule.RegisterHandlers(m_httpServer);
|
|
||||||
m_messagesService.RegisterHandlers(m_httpServer);
|
|
||||||
m_gridInfoService.RegisterHandlers(m_httpServer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void ShutdownSpecific()
|
|
||||||
{
|
|
||||||
m_eventDispatcher.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
#region IUGAIMCore
|
|
||||||
protected Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Register an Module interface.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T"></typeparam>
|
|
||||||
/// <param name="iface"></param>
|
|
||||||
public void RegisterInterface<T>(T iface)
|
|
||||||
{
|
|
||||||
lock (m_moduleInterfaces)
|
|
||||||
{
|
|
||||||
if (!m_moduleInterfaces.ContainsKey(typeof(T)))
|
|
||||||
{
|
|
||||||
m_moduleInterfaces.Add(typeof(T), iface);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool TryGet<T>(out T iface)
|
|
||||||
{
|
|
||||||
if (m_moduleInterfaces.ContainsKey(typeof(T)))
|
|
||||||
{
|
|
||||||
iface = (T)m_moduleInterfaces[typeof(T)];
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
iface = default(T);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T Get<T>()
|
|
||||||
{
|
|
||||||
return (T)m_moduleInterfaces[typeof(T)];
|
|
||||||
}
|
|
||||||
|
|
||||||
public BaseHttpServer GetHttpServer()
|
|
||||||
{
|
|
||||||
return m_httpServer;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
public void TestResponse(List<InventoryFolderBase> resp)
|
|
||||||
{
|
|
||||||
m_console.Notice("response got");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,63 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of the OpenSim Project nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
|
|
||||||
[assembly : AssemblyTitle("OGS-UserServer")]
|
|
||||||
[assembly : AssemblyDescription("")]
|
|
||||||
[assembly : AssemblyConfiguration("")]
|
|
||||||
[assembly : AssemblyCompany("http://opensimulator.org")]
|
|
||||||
[assembly : AssemblyProduct("OGS-UserServer")]
|
|
||||||
[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
|
|
||||||
[assembly : AssemblyTrademark("")]
|
|
||||||
[assembly : AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
|
|
||||||
[assembly : ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
|
|
||||||
[assembly : Guid("e266513a-090b-4d38-80f6-8599eef68c8c")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
|
|
||||||
[assembly : AssemblyVersion("0.6.3.*")]
|
|
||||||
[assembly : AssemblyFileVersion("1.0.0.0")]
|
|
|
@ -93,8 +93,11 @@ namespace OpenSim
|
||||||
string[] fileEntries = Directory.GetFiles(iniDirName);
|
string[] fileEntries = Directory.GetFiles(iniDirName);
|
||||||
foreach (string filePath in fileEntries)
|
foreach (string filePath in fileEntries)
|
||||||
{
|
{
|
||||||
// m_log.InfoFormat("reading ini file < {0} > from config dir", filePath);
|
if (Path.GetExtension(filePath).ToLower() == ".ini")
|
||||||
ReadConfig(Path.GetFileName(filePath), filePath, m_config, false);
|
{
|
||||||
|
// m_log.InfoFormat("reading ini file < {0} > from config dir", filePath);
|
||||||
|
ReadConfig(Path.GetFileName(filePath), filePath, m_config, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
bin/AprSharp.pdb
BIN
bin/AprSharp.pdb
Binary file not shown.
BIN
bin/MXP.pdb
BIN
bin/MXP.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,2 @@
|
||||||
|
[Startup]
|
||||||
|
HttpPort=8051
|
|
@ -0,0 +1,30 @@
|
||||||
|
[Startup]
|
||||||
|
HttpPort = 8001
|
||||||
|
LoadPlugins = "GridServerPlugin,UserServerPlugin,GridModuleLoaderPlugin"
|
||||||
|
|
||||||
|
[UserServerConfig]
|
||||||
|
DatabaseProvider = "OpenSim.Data.MySql.dll"
|
||||||
|
DatabaseConnect = ""
|
||||||
|
DefaultStartupMsg = "Welcome to opensim"
|
||||||
|
DefaultX = 1000
|
||||||
|
DefaultY = 1000
|
||||||
|
GridRecvKey = "key"
|
||||||
|
GridSendKey = "key"
|
||||||
|
HttpSSL = false
|
||||||
|
DefaultUserLevel = 0
|
||||||
|
LibraryXmlfile = ".\inventory\Libraries.xml"
|
||||||
|
InventoryUrl = "http://127.0.0.1:8004/"
|
||||||
|
GridServerURL = "http://127.0.0.1:8001/"
|
||||||
|
EnableLLSDLogin = true
|
||||||
|
|
||||||
|
[GridServerConfig]
|
||||||
|
DatabaseProvider = "OpenSim.Data.MySql.dll"
|
||||||
|
DatabaseConnect = ""
|
||||||
|
DefaultAssetServer = "http://127.0.0.1:8003/"
|
||||||
|
DefaultUserServer = "http://127.0.0.1:8001/"
|
||||||
|
SimRecvKey = "key"
|
||||||
|
SimSendKey = "key"
|
||||||
|
UserRecvKey = "key"
|
||||||
|
UserSendKey = "key"
|
||||||
|
AssetRecvKey = "key"
|
||||||
|
AssetSendKey = "key"
|
Binary file not shown.
BIN
bin/libapr.pdb
BIN
bin/libapr.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
66
prebuild.xml
66
prebuild.xml
|
@ -742,6 +742,7 @@
|
||||||
<Reference name="OpenMetaverse.dll"/>
|
<Reference name="OpenMetaverse.dll"/>
|
||||||
<Reference name="XMLRPC.dll"/>
|
<Reference name="XMLRPC.dll"/>
|
||||||
<Reference name="log4net.dll"/>
|
<Reference name="log4net.dll"/>
|
||||||
|
<Reference name="Nini.dll" />
|
||||||
|
|
||||||
<Files>
|
<Files>
|
||||||
<Match pattern="*.cs" recurse="true"/>
|
<Match pattern="*.cs" recurse="true"/>
|
||||||
|
@ -783,6 +784,32 @@
|
||||||
</Files>
|
</Files>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
||||||
|
<Project name="OpenSim.Grid.GridServer.ModuleLoader" path="OpenSim/Grid/GridServer.ModuleLoader" type="Library">
|
||||||
|
<Configuration name="Debug">
|
||||||
|
<Options>
|
||||||
|
<OutputPath>../../../bin/</OutputPath>
|
||||||
|
</Options>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration name="Release">
|
||||||
|
<Options>
|
||||||
|
<OutputPath>../../../bin/</OutputPath>
|
||||||
|
</Options>
|
||||||
|
</Configuration>
|
||||||
|
|
||||||
|
<ReferencePath>../../../bin/</ReferencePath>
|
||||||
|
<Reference name="System"/>
|
||||||
|
<Reference name="OpenSim.Framework"/>
|
||||||
|
<Reference name="OpenSim.Framework.Servers"/>
|
||||||
|
<Reference name="OpenSim.Grid.Framework"/>
|
||||||
|
<Reference name="OpenSim.Grid.GridServer"/>
|
||||||
|
<Reference name="log4net.dll"/>
|
||||||
|
|
||||||
|
<Files>
|
||||||
|
<Match pattern="*.cs" recurse="true"/>
|
||||||
|
<Match pattern="*.addin.xml" path="Resources" buildAction="EmbeddedResource" recurse="true"/>
|
||||||
|
</Files>
|
||||||
|
</Project>
|
||||||
|
|
||||||
|
|
||||||
<Project name="OpenSim.Grid.AssetServer" path="OpenSim/Grid/AssetServer" type="Exe">
|
<Project name="OpenSim.Grid.AssetServer" path="OpenSim/Grid/AssetServer" type="Exe">
|
||||||
<Configuration name="Debug">
|
<Configuration name="Debug">
|
||||||
|
@ -955,6 +982,7 @@
|
||||||
<Reference name="OpenSim.Framework.Statistics"/>
|
<Reference name="OpenSim.Framework.Statistics"/>
|
||||||
<Reference name="OpenSim.Grid.Framework"/>
|
<Reference name="OpenSim.Grid.Framework"/>
|
||||||
<Reference name="OpenSim.Grid.Communications.OGS1"/>
|
<Reference name="OpenSim.Grid.Communications.OGS1"/>
|
||||||
|
<Reference name="OpenSim.Grid.GridServer"/>
|
||||||
<Reference name="OpenMetaverseTypes.dll"/>
|
<Reference name="OpenMetaverseTypes.dll"/>
|
||||||
<Reference name="OpenMetaverse.StructuredData.dll"/>
|
<Reference name="OpenMetaverse.StructuredData.dll"/>
|
||||||
<Reference name="XMLRPC.dll"/>
|
<Reference name="XMLRPC.dll"/>
|
||||||
|
@ -963,47 +991,11 @@
|
||||||
|
|
||||||
<Files>
|
<Files>
|
||||||
<Match pattern="*.cs" recurse="true"/>
|
<Match pattern="*.cs" recurse="true"/>
|
||||||
|
<Match path="Resources" pattern="*.addin.xml" buildAction="EmbeddedResource" recurse="true" />
|
||||||
</Files>
|
</Files>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
||||||
|
|
||||||
<Project name="OpenSim.Grid.UserServer" path="OpenSim/Grid/UserServer" type="Exe">
|
|
||||||
<Configuration name="Debug">
|
|
||||||
<Options>
|
|
||||||
<OutputPath>../../../bin/</OutputPath>
|
|
||||||
</Options>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration name="Release">
|
|
||||||
<Options>
|
|
||||||
<OutputPath>../../../bin/</OutputPath>
|
|
||||||
</Options>
|
|
||||||
</Configuration>
|
|
||||||
|
|
||||||
<ReferencePath>../../../bin/</ReferencePath>
|
|
||||||
<Reference name="System"/>
|
|
||||||
<Reference name="System.Data"/>
|
|
||||||
<Reference name="System.Xml"/>
|
|
||||||
<Reference name="System.Web"/>
|
|
||||||
<Reference name="OpenSim.Framework"/>
|
|
||||||
<Reference name="OpenSim.Framework.Console"/>
|
|
||||||
<Reference name="OpenSim.Framework.Communications"/>
|
|
||||||
<Reference name="OpenSim.Data"/>
|
|
||||||
<Reference name="OpenSim.Framework.Servers"/>
|
|
||||||
<Reference name="OpenSim.Framework.Statistics"/>
|
|
||||||
<Reference name="OpenSim.Grid.Communications.OGS1"/>
|
|
||||||
<Reference name="OpenSim.Grid.Framework"/>
|
|
||||||
<Reference name="OpenSim.Grid.UserServer.Modules"/>
|
|
||||||
<Reference name="OpenMetaverseTypes.dll"/>
|
|
||||||
<Reference name="OpenMetaverse.StructuredData.dll"/>
|
|
||||||
<Reference name="XMLRPC.dll"/>
|
|
||||||
<Reference name="log4net.dll"/>
|
|
||||||
<Reference name="DotNetOpenId.dll"/>
|
|
||||||
|
|
||||||
<Files>
|
|
||||||
<Match pattern="*.cs" recurse="true"/>
|
|
||||||
</Files>
|
|
||||||
</Project>
|
|
||||||
|
|
||||||
<Project name="OpenSim.Grid.InventoryServer" path="OpenSim/Grid/InventoryServer" type="Exe">
|
<Project name="OpenSim.Grid.InventoryServer" path="OpenSim/Grid/InventoryServer" type="Exe">
|
||||||
<Configuration name="Debug">
|
<Configuration name="Debug">
|
||||||
<Options>
|
<Options>
|
||||||
|
|
Loading…
Reference in New Issue