Work on creating a shared generic base GridService server, that can load the modules from User, Grid and Messaging servers.
Started to change the configuration of the Grid server so it uses nini.GenericGridServerConcept
parent
29c4eef1fe
commit
1e015a4cb8
|
@ -26,6 +26,7 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using Nini.Config;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
|
@ -49,6 +50,11 @@ namespace OpenSim.Framework
|
|||
public string UserRecvKey = String.Empty;
|
||||
public string UserSendKey = String.Empty;
|
||||
|
||||
public GridConfig()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public GridConfig(string description, string filename)
|
||||
{
|
||||
configMember =
|
||||
|
@ -56,6 +62,11 @@ namespace OpenSim.Framework
|
|||
configMember.performConfigurationRetrieve();
|
||||
}
|
||||
|
||||
public void LoadConfigurationFromNini(IConfigSource configSource)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void loadConfigurationOptions()
|
||||
{
|
||||
configMember.addConfigurationOption("default_asset_server",
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Nini.Config;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
|
@ -91,6 +92,11 @@ namespace OpenSim.Framework
|
|||
configMember.performConfigurationRetrieve();
|
||||
}
|
||||
|
||||
public void LoadConfigurationFromNini(IConfigSource configSource)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void loadConfigurationOptions()
|
||||
{
|
||||
configMember.addConfigurationOption("default_startup_message",
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace OpenSim.Grid.GridServer.Modules
|
|||
public void Initialise(GridServerBase gridServer)
|
||||
{
|
||||
m_core = gridServer;
|
||||
m_config = gridServer.Config;
|
||||
m_config = gridServer.GConfig;
|
||||
m_version = gridServer.Version;
|
||||
m_console = MainConsole.Instance;
|
||||
|
||||
|
@ -67,7 +67,7 @@ namespace OpenSim.Grid.GridServer.Modules
|
|||
{
|
||||
// m_log.Info("[DATA]: Connecting to Storage Server");
|
||||
m_gridDBService = new GridDBService();
|
||||
m_gridDBService.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect);
|
||||
//m_gridDBService.AddPlugin(m_config.DatabaseProvider, m_config.DatabaseConnect);
|
||||
|
||||
//Register the database access service so modules can fetch it
|
||||
// RegisterInterface<GridDBService>(m_gridDBService);
|
||||
|
|
|
@ -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.Timers;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Servers;
|
||||
|
@ -44,11 +45,25 @@ namespace OpenSim.Grid.GridServer
|
|||
{
|
||||
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
|
||||
|
@ -68,18 +83,31 @@ namespace OpenSim.Grid.GridServer
|
|||
}
|
||||
}
|
||||
|
||||
public GridServerBase()
|
||||
public GridServerBase(IConfigSource configSource)
|
||||
{
|
||||
m_console = new ConsoleBase("Grid");
|
||||
MainConsole.Instance = m_console;
|
||||
|
||||
m_configLoader = new GridConfigurationLoader();
|
||||
m_configSource = m_configLoader.LoadConfigSettings(configSource);
|
||||
}
|
||||
|
||||
protected override void StartupSpecific()
|
||||
{
|
||||
m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml")));
|
||||
uint httpPort = 8051;
|
||||
|
||||
m_gconfig = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml")));
|
||||
|
||||
m_uconfig = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml")));
|
||||
|
||||
IConfig startupConfig = m_configSource.Source.Configs["Startup"];
|
||||
if (startupConfig != null)
|
||||
{
|
||||
Convert.ToUInt32(startupConfig.GetString("HttpPort", "8051"));
|
||||
}
|
||||
|
||||
m_log.Info("[GRID]: Starting HTTP process");
|
||||
m_httpServer = new BaseHttpServer(m_config.HttpPort);
|
||||
m_httpServer = new BaseHttpServer(httpPort);
|
||||
|
||||
LoadPlugins();
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
*/
|
||||
|
||||
using log4net.Config;
|
||||
using Nini.Config;
|
||||
|
||||
namespace OpenSim.Grid.GridServer
|
||||
{
|
||||
|
@ -35,7 +36,18 @@ namespace OpenSim.Grid.GridServer
|
|||
{
|
||||
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")
|
||||
// {
|
||||
|
|
|
@ -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,9 +41,8 @@ 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
|
||||
namespace OpenSim.Grid.UserServer.Modules
|
||||
{
|
||||
public class UserServerCommandModule
|
||||
{
|
|
@ -41,9 +41,8 @@ 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
|
||||
namespace OpenSim.Grid.UserServer.Modules
|
||||
{
|
||||
//Do we actually need these event dispatchers?
|
||||
//shouldn't the other modules just directly register event handlers to each other?
|
|
@ -0,0 +1,231 @@
|
|||
/*
|
||||
* 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 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;
|
||||
|
||||
protected BaseHttpServer m_httpServer;
|
||||
|
||||
protected IGridServiceCore m_core;
|
||||
|
||||
protected ConsoleBase m_console;
|
||||
|
||||
|
||||
public UserServerPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
#region IGridPlugin Members
|
||||
|
||||
public void Initialise(GridServerBase gridServer)
|
||||
{
|
||||
Initialise(gridServer.HttpServer, gridServer, gridServer.UConfig);
|
||||
}
|
||||
|
||||
#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);
|
||||
|
||||
//PostInitialise the modules
|
||||
PostInitialiseModules();
|
||||
|
||||
RegisterHttpHandlers();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
//TODO: change these modules so they fetch the databaseService class in the PostInitialise method
|
||||
m_userManager = new UserManager(m_userDataBaseService);
|
||||
m_userManager.Initialise(m_core);
|
||||
|
||||
m_avatarAppearanceModule = new UserServerAvatarAppearanceModule(m_userDataBaseService);
|
||||
m_avatarAppearanceModule.Initialise(m_core);
|
||||
|
||||
m_friendsModule = new UserServerFriendsModule(m_userDataBaseService);
|
||||
m_friendsModule.Initialise(m_core);
|
||||
|
||||
m_consoleCommandModule = new UserServerCommandModule();
|
||||
m_consoleCommandModule.Initialise(m_core);
|
||||
|
||||
m_messagesService = new MessageServersConnector();
|
||||
m_messagesService.Initialise(m_core);
|
||||
|
||||
m_gridInfoService = new GridInfoServiceModule();
|
||||
m_gridInfoService.Initialise(m_core);
|
||||
}
|
||||
|
||||
protected virtual void StartOtherComponents(IInterServiceInventoryServices inventoryService)
|
||||
{
|
||||
StartupLoginService(inventoryService);
|
||||
//
|
||||
// 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_eventDispatcher = new UserServerEventDispatchModule(m_userManager, m_messagesService, m_loginService);
|
||||
m_eventDispatcher.Initialise(m_core);
|
||||
}
|
||||
|
||||
/// <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(m_cfg.LibraryXmlfile), m_cfg, m_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, m_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);
|
||||
}
|
||||
|
||||
#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()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -54,20 +54,7 @@ namespace OpenSim.Grid.UserServer
|
|||
|
||||
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;
|
||||
protected UserServerPlugin m_serverPlugin;
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
|
@ -99,126 +86,23 @@ namespace OpenSim.Grid.UserServer
|
|||
|
||||
protected override void StartupSpecific()
|
||||
{
|
||||
IInterServiceInventoryServices inventoryService = StartupCoreComponents();
|
||||
Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml")));
|
||||
|
||||
m_stats = StatsManager.StartCollectingUserStats();
|
||||
|
||||
//setup services/modules
|
||||
StartupUserServerModules();
|
||||
m_httpServer = new BaseHttpServer(Cfg.HttpPort);
|
||||
|
||||
StartOtherComponents(inventoryService);
|
||||
m_serverPlugin = new UserServerPlugin();
|
||||
m_serverPlugin.Initialise(m_httpServer, this, Cfg);
|
||||
|
||||
//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
|
||||
|
@ -262,9 +146,5 @@ namespace OpenSim.Grid.UserServer
|
|||
}
|
||||
#endregion
|
||||
|
||||
public void TestResponse(List<InventoryFolderBase> resp)
|
||||
{
|
||||
m_console.Notice("response got");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
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
|
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.
|
@ -955,6 +955,7 @@
|
|||
<Reference name="OpenSim.Framework.Statistics"/>
|
||||
<Reference name="OpenSim.Grid.Framework"/>
|
||||
<Reference name="OpenSim.Grid.Communications.OGS1"/>
|
||||
<Reference name="OpenSim.Grid.GridServer"/>
|
||||
<Reference name="OpenMetaverseTypes.dll"/>
|
||||
<Reference name="OpenMetaverse.StructuredData.dll"/>
|
||||
<Reference name="XMLRPC.dll"/>
|
||||
|
@ -963,6 +964,7 @@
|
|||
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true"/>
|
||||
<Match path="Resources" pattern="*.addin.xml" buildAction="EmbeddedResource" recurse="true" />
|
||||
</Files>
|
||||
</Project>
|
||||
|
||||
|
@ -992,6 +994,7 @@
|
|||
<Reference name="OpenSim.Framework.Statistics"/>
|
||||
<Reference name="OpenSim.Grid.Communications.OGS1"/>
|
||||
<Reference name="OpenSim.Grid.Framework"/>
|
||||
<Reference name="OpenSim.Grid.GridServer"/>
|
||||
<Reference name="OpenSim.Grid.UserServer.Modules"/>
|
||||
<Reference name="OpenMetaverseTypes.dll"/>
|
||||
<Reference name="OpenMetaverse.StructuredData.dll"/>
|
||||
|
|
Loading…
Reference in New Issue