aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Addons/Groups/Service/GroupsServiceBase.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Addons/Groups/Service/GroupsServiceBase.cs')
-rw-r--r--OpenSim/Addons/Groups/Service/GroupsServiceBase.cs103
1 files changed, 60 insertions, 43 deletions
diff --git a/OpenSim/Addons/Groups/Service/GroupsServiceBase.cs b/OpenSim/Addons/Groups/Service/GroupsServiceBase.cs
index 2611a3d..8e237aa 100644
--- a/OpenSim/Addons/Groups/Service/GroupsServiceBase.cs
+++ b/OpenSim/Addons/Groups/Service/GroupsServiceBase.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -35,50 +35,67 @@ using OpenSim.Services.Base;
35 35
36namespace OpenSim.Groups 36namespace OpenSim.Groups
37{ 37{
38 public class GroupsServiceBase : ServiceBase 38 public class GroupsServiceBase : ServiceBase
39 { 39 {
40 protected IGroupsData m_Database = null; 40 protected IGroupsData m_Database = null;
41 protected IGridUserData m_GridUserService = null;
41 42
42 public GroupsServiceBase(IConfigSource config, string cName) 43 public GroupsServiceBase(IConfigSource config, string cName)
43 : base(config) 44 : base(config)
44 { 45 {
45 string dllName = String.Empty; 46 string dllName = String.Empty;
46 string connString = String.Empty; 47 string connString = String.Empty;
47 string realm = "os_groups"; 48 string realm = "os_groups";
48 string configName = (cName == string.Empty) ? "Groups" : cName; 49 string usersRealm = "GridUser";
50 string configName = (cName == string.Empty) ? "Groups" : cName;
49 51
50 // 52 //
51 // Try reading the [DatabaseService] section, if it exists 53 // Try reading the [DatabaseService] section, if it exists
52 // 54 //
53 IConfig dbConfig = config.Configs["DatabaseService"]; 55 IConfig dbConfig = config.Configs["DatabaseService"];
54 if (dbConfig != null) 56 if (dbConfig != null)
55 { 57 {
56 if (dllName == String.Empty) 58 if (dllName == String.Empty)
57 dllName = dbConfig.GetString("StorageProvider", String.Empty); 59 dllName = dbConfig.GetString("StorageProvider", String.Empty);
58 if (connString == String.Empty) 60 if (connString == String.Empty)
59 connString = dbConfig.GetString("ConnectionString", String.Empty); 61 connString = dbConfig.GetString("ConnectionString", String.Empty);
60 } 62 }
61 63
62 // 64 //
63 // [Groups] section overrides [DatabaseService], if it exists 65 // [Groups] section overrides [DatabaseService], if it exists
64 // 66 //
65 IConfig groupsConfig = config.Configs[configName]; 67 IConfig groupsConfig = config.Configs[configName];
66 if (groupsConfig != null) 68 if (groupsConfig != null)
67 { 69 {
68 dllName = groupsConfig.GetString("StorageProvider", dllName); 70 dllName = groupsConfig.GetString("StorageProvider", dllName);
69 connString = groupsConfig.GetString("ConnectionString", connString); 71 connString = groupsConfig.GetString("ConnectionString", connString);
70 realm = groupsConfig.GetString("Realm", realm); 72 realm = groupsConfig.GetString("Realm", realm);
71 } 73 }
72 74
73 // 75 //
74 // We tried, but this doesn't exist. We can't proceed. 76 // We tried, but this doesn't exist. We can't proceed.
75 // 77 //
76 if (dllName.Equals(String.Empty)) 78 if (dllName.Equals(String.Empty))
77 throw new Exception("No StorageProvider configured"); 79 throw new Exception("No StorageProvider configured");
78 80
79 m_Database = LoadPlugin<IGroupsData>(dllName, new Object[] { connString, realm }); 81 m_Database = LoadPlugin<IGroupsData>(dllName, new Object[] { connString, realm });
80 if (m_Database == null) 82 if (m_Database == null)
81 throw new Exception("Could not find a storage interface in the given module " + dllName); 83 throw new Exception("Could not find a storage interface in the given module " + dllName);
82 } 84
83 } 85 //
84} \ No newline at end of file 86 // [GridUserService] section overrides [DatabaseService], if it exists
87 //
88 IConfig usersConfig = config.Configs["GridUserService"];
89 if (usersConfig != null)
90 {
91 dllName = usersConfig.GetString("StorageProvider", dllName);
92 connString = usersConfig.GetString("ConnectionString", connString);
93 usersRealm = usersConfig.GetString("Realm", usersRealm);
94 }
95
96 m_GridUserService = LoadPlugin<IGridUserData>(dllName, new Object[] { connString, usersRealm });
97 if (m_GridUserService == null)
98 throw new Exception("Could not find a storage inferface for the given users module " + dllName);
99 }
100 }
101}