More additions to the nextgen reference UGAIM

This commit is contained in:
Melanie Thielker
2009-05-08 14:08:41 +00:00
parent 3485b2b1c3
commit aec069d161
9 changed files with 490 additions and 29 deletions

View File

@@ -30,18 +30,19 @@ using System.Reflection;
using Nini.Config;
using OpenSim.Data;
using OpenSim.Services.Interfaces;
using OpenSim.Services.Base;
namespace OpenSim.Services.UserService
{
public class UserServiceBase
public class UserServiceBase: ServiceBase
{
protected IUserDataPlugin m_Database = null;
public UserServiceBase(IConfigSource config)
public UserServiceBase(IConfigSource config) : base(config)
{
IConfig userConfig = config.Configs["UserService"];
if (userConfig == null)
throw new Exception("No userService configuration");
throw new Exception("No UserService configuration");
string dllName = userConfig.GetString("StorageProvider",
String.Empty);
@@ -52,34 +53,12 @@ namespace OpenSim.Services.UserService
string connString = userConfig.GetString("ConnectionString",
String.Empty);
try
{
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
m_Database = LoadPlugin<IUserDataPlugin>(dllName);
foreach (Type pluginType in pluginAssembly.GetTypes())
{
if (pluginType.IsPublic)
{
Type typeInterface =
pluginType.GetInterface("IUserDataPlugin", true);
if (typeInterface != null)
{
IUserDataPlugin plug =
(IUserDataPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
plug.Initialise(connString);
if (m_Database == null)
throw new Exception("Could not find a storage interface in the given module");
m_Database = plug;
}
}
}
if (m_Database == null)
throw new Exception("Could not find a storage interface in the given module");
}
catch (Exception e)
{
throw new Exception("Can't open database module: "+e.Message);
}
m_Database.Initialise(connString);
}
}
}