diff options
author | Melanie Thielker | 2009-05-08 14:08:41 +0000 |
---|---|---|
committer | Melanie Thielker | 2009-05-08 14:08:41 +0000 |
commit | aec069d161e6d818c4b1d9b7448aebade62c29c5 (patch) | |
tree | d1a27527d0119b98d6fbf1255ad5cff7294524fe /OpenSim/Services/UserService/UserServiceBase.cs | |
parent | now that creatorID is no longer a strict UUID, and the column can still be NULL, (diff) | |
download | opensim-SC-aec069d161e6d818c4b1d9b7448aebade62c29c5.zip opensim-SC-aec069d161e6d818c4b1d9b7448aebade62c29c5.tar.gz opensim-SC-aec069d161e6d818c4b1d9b7448aebade62c29c5.tar.bz2 opensim-SC-aec069d161e6d818c4b1d9b7448aebade62c29c5.tar.xz |
More additions to the nextgen reference UGAIM
Diffstat (limited to 'OpenSim/Services/UserService/UserServiceBase.cs')
-rw-r--r-- | OpenSim/Services/UserService/UserServiceBase.cs | 37 |
1 files changed, 8 insertions, 29 deletions
diff --git a/OpenSim/Services/UserService/UserServiceBase.cs b/OpenSim/Services/UserService/UserServiceBase.cs index 6a20670..0cf24a4 100644 --- a/OpenSim/Services/UserService/UserServiceBase.cs +++ b/OpenSim/Services/UserService/UserServiceBase.cs | |||
@@ -30,18 +30,19 @@ using System.Reflection; | |||
30 | using Nini.Config; | 30 | using Nini.Config; |
31 | using OpenSim.Data; | 31 | using OpenSim.Data; |
32 | using OpenSim.Services.Interfaces; | 32 | using OpenSim.Services.Interfaces; |
33 | using OpenSim.Services.Base; | ||
33 | 34 | ||
34 | namespace OpenSim.Services.UserService | 35 | namespace OpenSim.Services.UserService |
35 | { | 36 | { |
36 | public class UserServiceBase | 37 | public class UserServiceBase: ServiceBase |
37 | { | 38 | { |
38 | protected IUserDataPlugin m_Database = null; | 39 | protected IUserDataPlugin m_Database = null; |
39 | 40 | ||
40 | public UserServiceBase(IConfigSource config) | 41 | public UserServiceBase(IConfigSource config) : base(config) |
41 | { | 42 | { |
42 | IConfig userConfig = config.Configs["UserService"]; | 43 | IConfig userConfig = config.Configs["UserService"]; |
43 | if (userConfig == null) | 44 | if (userConfig == null) |
44 | throw new Exception("No userService configuration"); | 45 | throw new Exception("No UserService configuration"); |
45 | 46 | ||
46 | string dllName = userConfig.GetString("StorageProvider", | 47 | string dllName = userConfig.GetString("StorageProvider", |
47 | String.Empty); | 48 | String.Empty); |
@@ -52,34 +53,12 @@ namespace OpenSim.Services.UserService | |||
52 | string connString = userConfig.GetString("ConnectionString", | 53 | string connString = userConfig.GetString("ConnectionString", |
53 | String.Empty); | 54 | String.Empty); |
54 | 55 | ||
55 | try | 56 | m_Database = LoadPlugin<IUserDataPlugin>(dllName); |
56 | { | ||
57 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
58 | 57 | ||
59 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 58 | if (m_Database == null) |
60 | { | 59 | throw new Exception("Could not find a storage interface in the given module"); |
61 | if (pluginType.IsPublic) | ||
62 | { | ||
63 | Type typeInterface = | ||
64 | pluginType.GetInterface("IUserDataPlugin", true); | ||
65 | if (typeInterface != null) | ||
66 | { | ||
67 | IUserDataPlugin plug = | ||
68 | (IUserDataPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
69 | plug.Initialise(connString); | ||
70 | 60 | ||
71 | m_Database = plug; | 61 | m_Database.Initialise(connString); |
72 | } | ||
73 | } | ||
74 | } | ||
75 | |||
76 | if (m_Database == null) | ||
77 | throw new Exception("Could not find a storage interface in the given module"); | ||
78 | } | ||
79 | catch (Exception e) | ||
80 | { | ||
81 | throw new Exception("Can't open database module: "+e.Message); | ||
82 | } | ||
83 | } | 62 | } |
84 | } | 63 | } |
85 | } | 64 | } |