aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs59
1 files changed, 59 insertions, 0 deletions
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs b/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs
new file mode 100644
index 0000000..dc0be03
--- /dev/null
+++ b/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs
@@ -0,0 +1,59 @@
1using System;
2using System.Reflection;
3using Nini.Config;
4using log4net;
5using OpenSim.Services.Base;
6using OpenSim.Data;
7
8namespace OpenSim.Services.ProfilesService
9{
10 public class UserProfilesServiceBase: ServiceBase
11 {
12 static readonly ILog m_log =
13 LogManager.GetLogger(
14 MethodBase.GetCurrentMethod().DeclaringType);
15
16 public IProfilesData ProfilesData;
17
18 public string ConfigName
19 {
20 get; private set;
21 }
22
23 public UserProfilesServiceBase(IConfigSource config, string configName):
24 base(config)
25 {
26 if(string.IsNullOrEmpty(configName))
27 {
28 m_log.WarnFormat("[PROFILES]: Configuration section not given!");
29 return;
30 }
31
32 string dllName = String.Empty;
33 string connString = null;
34 string realm = String.Empty;
35
36 IConfig dbConfig = config.Configs["DatabaseService"];
37 if (dbConfig != null)
38 {
39 if (dllName == String.Empty)
40 dllName = dbConfig.GetString("StorageProvider", String.Empty);
41 if (string.IsNullOrEmpty(connString))
42 connString = dbConfig.GetString("ConnectionString", String.Empty);
43 }
44
45 IConfig ProfilesConfig = config.Configs[configName];
46 if (ProfilesConfig != null)
47 {
48 connString = ProfilesConfig.GetString("ConnectionString", connString);
49 realm = ProfilesConfig.GetString("Realm", realm);
50 }
51
52 ProfilesData = LoadPlugin<IProfilesData>(dllName, new Object[] { connString });
53 if (ProfilesData == null)
54 throw new Exception("Could not find a storage interface in the given module");
55
56 }
57 }
58}
59