diff options
author | Mike Mazur | 2008-07-31 09:24:28 +0000 |
---|---|---|
committer | Mike Mazur | 2008-07-31 09:24:28 +0000 |
commit | 2270b252656146d9d74b84665a7ace6c3139db30 (patch) | |
tree | 7a967ee50349cf4301ed801e0b8c85f5060ffe1d /OpenSim/Framework/Communications | |
parent | dropping intermediate GridInfoPlugin.addin.xml, as it's no longer (diff) | |
download | opensim-SC_OLD-2270b252656146d9d74b84665a7ace6c3139db30.zip opensim-SC_OLD-2270b252656146d9d74b84665a7ace6c3139db30.tar.gz opensim-SC_OLD-2270b252656146d9d74b84665a7ace6c3139db30.tar.bz2 opensim-SC_OLD-2270b252656146d9d74b84665a7ace6c3139db30.tar.xz |
Thanks, sempuki, for a patch that moves all Grid Server's plugins to
PluginLoader. Fix issue 1871.
Diffstat (limited to 'OpenSim/Framework/Communications')
4 files changed, 114 insertions, 146 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs index f729d78..ed5b896 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs | |||
@@ -43,7 +43,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
43 | protected IAssetReceiver m_receiver; | 43 | protected IAssetReceiver m_receiver; |
44 | protected BlockingQueue<AssetRequest> m_assetRequests; | 44 | protected BlockingQueue<AssetRequest> m_assetRequests; |
45 | protected Thread m_localAssetServerThread; | 45 | protected Thread m_localAssetServerThread; |
46 | protected IAssetProvider m_assetProvider; | 46 | protected IAssetProviderPlugin m_assetProvider; |
47 | 47 | ||
48 | // Temporarily hardcoded - should be a plugin | 48 | // Temporarily hardcoded - should be a plugin |
49 | protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); | 49 | protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); |
diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs index 94a8509..2f72e11 100644 --- a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs +++ b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs | |||
@@ -40,7 +40,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
40 | AddPlugin(pluginName, connect); | 40 | AddPlugin(pluginName, connect); |
41 | } | 41 | } |
42 | 42 | ||
43 | public SQLAssetServer(IAssetProvider assetProvider) | 43 | public SQLAssetServer(IAssetProviderPlugin assetProvider) |
44 | { | 44 | { |
45 | m_assetProvider = assetProvider; | 45 | m_assetProvider = assetProvider; |
46 | } | 46 | } |
@@ -54,12 +54,12 @@ namespace OpenSim.Framework.Communications.Cache | |||
54 | { | 54 | { |
55 | if (!pluginType.IsAbstract) | 55 | if (!pluginType.IsAbstract) |
56 | { | 56 | { |
57 | Type typeInterface = pluginType.GetInterface("IAssetProvider", true); | 57 | Type typeInterface = pluginType.GetInterface("IAssetProviderPlugin", true); |
58 | 58 | ||
59 | if (typeInterface != null) | 59 | if (typeInterface != null) |
60 | { | 60 | { |
61 | IAssetProvider plug = | 61 | IAssetProviderPlugin plug = |
62 | (IAssetProvider) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 62 | (IAssetProviderPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
63 | m_assetProvider = plug; | 63 | m_assetProvider = plug; |
64 | m_assetProvider.Initialise(connect); | 64 | m_assetProvider.Initialise(connect); |
65 | 65 | ||
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index 06b707b..40701f0 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs | |||
@@ -43,38 +43,25 @@ namespace OpenSim.Framework.Communications | |||
43 | private static readonly ILog m_log | 43 | private static readonly ILog m_log |
44 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | protected Dictionary<string, IInventoryData> m_plugins = new Dictionary<string, IInventoryData>(); | 46 | protected List<IInventoryDataPlugin> m_plugins = new List<IInventoryDataPlugin>(); |
47 | 47 | ||
48 | #region Plugin methods | 48 | #region Plugin methods |
49 | 49 | ||
50 | /// <summary> | 50 | /// <summary> |
51 | /// Adds a new user server plugin - plugins will be requested in the order they were loaded. | 51 | /// Adds a new user server plugin - plugins will be requested in the order they were loaded. |
52 | /// </summary> | 52 | /// </summary> |
53 | /// <param name="FileName">The filename to the user server plugin DLL</param> | 53 | /// <param name="provider">The filename to the user server plugin DLL</param> |
54 | public void AddPlugin(string FileName, string connect) | 54 | public void AddPlugin(string provider, string connect) |
55 | { | 55 | { |
56 | if (!String.IsNullOrEmpty(FileName)) | 56 | PluginLoader<IInventoryDataPlugin> loader = |
57 | { | 57 | new PluginLoader<IInventoryDataPlugin> (new InventoryDataInitialiser (connect)); |
58 | m_log.Info("[AGENT INVENTORY]: Inventory storage: Attempting to load " + FileName); | 58 | |
59 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | 59 | // loader will try to load all providers (MySQL, MSSQL, etc) |
60 | 60 | // unless it is constrainted to the correct "Provider" entry in the addin.xml | |
61 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 61 | loader.Add ("/OpenSim/InventoryData", new PluginProviderFilter (provider)); |
62 | { | 62 | loader.Load(); |
63 | if (!pluginType.IsAbstract) | 63 | |
64 | { | 64 | m_plugins = loader.Plugins; |
65 | Type typeInterface = pluginType.GetInterface("IInventoryData", true); | ||
66 | |||
67 | if (typeInterface != null) | ||
68 | { | ||
69 | IInventoryData plug = | ||
70 | (IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
71 | plug.Initialise(connect); | ||
72 | m_plugins.Add(plug.getName(), plug); | ||
73 | m_log.Info("[AGENTINVENTORY]: Added IInventoryData Interface"); | ||
74 | } | ||
75 | } | ||
76 | } | ||
77 | } | ||
78 | } | 65 | } |
79 | 66 | ||
80 | #endregion | 67 | #endregion |
@@ -103,9 +90,9 @@ namespace OpenSim.Framework.Communications | |||
103 | 90 | ||
104 | userFolders.Add(rootFolder); | 91 | userFolders.Add(rootFolder); |
105 | 92 | ||
106 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | 93 | foreach (IInventoryDataPlugin plugin in m_plugins) |
107 | { | 94 | { |
108 | IList<InventoryFolderBase> folders = plugin.Value.getFolderHierarchy(rootFolder.ID); | 95 | IList<InventoryFolderBase> folders = plugin.getFolderHierarchy(rootFolder.ID); |
109 | userFolders.AddRange(folders); | 96 | userFolders.AddRange(folders); |
110 | } | 97 | } |
111 | 98 | ||
@@ -127,9 +114,9 @@ namespace OpenSim.Framework.Communications | |||
127 | public InventoryFolderBase RequestRootFolder(LLUUID userID) | 114 | public InventoryFolderBase RequestRootFolder(LLUUID userID) |
128 | { | 115 | { |
129 | // FIXME: Probably doesn't do what was originally intended - only ever queries the first plugin | 116 | // FIXME: Probably doesn't do what was originally intended - only ever queries the first plugin |
130 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | 117 | foreach (IInventoryDataPlugin plugin in m_plugins) |
131 | { | 118 | { |
132 | return plugin.Value.getUserRootFolder(userID); | 119 | return plugin.getUserRootFolder(userID); |
133 | } | 120 | } |
134 | return null; | 121 | return null; |
135 | } | 122 | } |
@@ -168,9 +155,9 @@ namespace OpenSim.Framework.Communications | |||
168 | public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID) | 155 | public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID) |
169 | { | 156 | { |
170 | List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>(); | 157 | List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>(); |
171 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | 158 | foreach (IInventoryDataPlugin plugin in m_plugins) |
172 | { | 159 | { |
173 | return plugin.Value.getInventoryFolders(parentFolderID); | 160 | return plugin.getInventoryFolders(parentFolderID); |
174 | } | 161 | } |
175 | return inventoryList; | 162 | return inventoryList; |
176 | } | 163 | } |
@@ -178,9 +165,9 @@ namespace OpenSim.Framework.Communications | |||
178 | public List<InventoryItemBase> RequestFolderItems(LLUUID folderID) | 165 | public List<InventoryItemBase> RequestFolderItems(LLUUID folderID) |
179 | { | 166 | { |
180 | List<InventoryItemBase> itemsList = new List<InventoryItemBase>(); | 167 | List<InventoryItemBase> itemsList = new List<InventoryItemBase>(); |
181 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | 168 | foreach (IInventoryDataPlugin plugin in m_plugins) |
182 | { | 169 | { |
183 | itemsList = plugin.Value.getInventoryInFolder(folderID); | 170 | itemsList = plugin.getInventoryInFolder(folderID); |
184 | return itemsList; | 171 | return itemsList; |
185 | } | 172 | } |
186 | return itemsList; | 173 | return itemsList; |
@@ -194,9 +181,9 @@ namespace OpenSim.Framework.Communications | |||
194 | m_log.DebugFormat( | 181 | m_log.DebugFormat( |
195 | "[AGENT INVENTORY]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); | 182 | "[AGENT INVENTORY]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); |
196 | 183 | ||
197 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | 184 | foreach (IInventoryDataPlugin plugin in m_plugins) |
198 | { | 185 | { |
199 | plugin.Value.addInventoryFolder(folder); | 186 | plugin.addInventoryFolder(folder); |
200 | } | 187 | } |
201 | 188 | ||
202 | // FIXME: Should return false on failure | 189 | // FIXME: Should return false on failure |
@@ -209,9 +196,9 @@ namespace OpenSim.Framework.Communications | |||
209 | m_log.DebugFormat( | 196 | m_log.DebugFormat( |
210 | "[AGENT INVENTORY]: Updating folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); | 197 | "[AGENT INVENTORY]: Updating folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); |
211 | 198 | ||
212 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | 199 | foreach (IInventoryDataPlugin plugin in m_plugins) |
213 | { | 200 | { |
214 | plugin.Value.updateInventoryFolder(folder); | 201 | plugin.updateInventoryFolder(folder); |
215 | } | 202 | } |
216 | 203 | ||
217 | // FIXME: Should return false on failure | 204 | // FIXME: Should return false on failure |
@@ -224,9 +211,9 @@ namespace OpenSim.Framework.Communications | |||
224 | m_log.DebugFormat( | 211 | m_log.DebugFormat( |
225 | "[AGENT INVENTORY]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); | 212 | "[AGENT INVENTORY]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); |
226 | 213 | ||
227 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | 214 | foreach (IInventoryDataPlugin plugin in m_plugins) |
228 | { | 215 | { |
229 | plugin.Value.moveInventoryFolder(folder); | 216 | plugin.moveInventoryFolder(folder); |
230 | } | 217 | } |
231 | 218 | ||
232 | // FIXME: Should return false on failure | 219 | // FIXME: Should return false on failure |
@@ -239,9 +226,9 @@ namespace OpenSim.Framework.Communications | |||
239 | m_log.DebugFormat( | 226 | m_log.DebugFormat( |
240 | "[AGENT INVENTORY]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder); | 227 | "[AGENT INVENTORY]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder); |
241 | 228 | ||
242 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | 229 | foreach (IInventoryDataPlugin plugin in m_plugins) |
243 | { | 230 | { |
244 | plugin.Value.addInventoryItem(item); | 231 | plugin.addInventoryItem(item); |
245 | } | 232 | } |
246 | 233 | ||
247 | // FIXME: Should return false on failure | 234 | // FIXME: Should return false on failure |
@@ -254,9 +241,9 @@ namespace OpenSim.Framework.Communications | |||
254 | m_log.InfoFormat( | 241 | m_log.InfoFormat( |
255 | "[AGENT INVENTORY]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder); | 242 | "[AGENT INVENTORY]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder); |
256 | 243 | ||
257 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | 244 | foreach (IInventoryDataPlugin plugin in m_plugins) |
258 | { | 245 | { |
259 | plugin.Value.updateInventoryItem(item); | 246 | plugin.updateInventoryItem(item); |
260 | } | 247 | } |
261 | 248 | ||
262 | // FIXME: Should return false on failure | 249 | // FIXME: Should return false on failure |
@@ -269,9 +256,9 @@ namespace OpenSim.Framework.Communications | |||
269 | m_log.InfoFormat( | 256 | m_log.InfoFormat( |
270 | "[AGENT INVENTORY]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder); | 257 | "[AGENT INVENTORY]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder); |
271 | 258 | ||
272 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | 259 | foreach (IInventoryDataPlugin plugin in m_plugins) |
273 | { | 260 | { |
274 | plugin.Value.deleteInventoryItem(item.ID); | 261 | plugin.deleteInventoryItem(item.ID); |
275 | } | 262 | } |
276 | 263 | ||
277 | // FIXME: Should return false on failure | 264 | // FIXME: Should return false on failure |
@@ -296,9 +283,9 @@ namespace OpenSim.Framework.Communications | |||
296 | { | 283 | { |
297 | // m_log.DebugFormat("[AGENT INVENTORY]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID); | 284 | // m_log.DebugFormat("[AGENT INVENTORY]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID); |
298 | 285 | ||
299 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | 286 | foreach (IInventoryDataPlugin plugin in m_plugins) |
300 | { | 287 | { |
301 | plugin.Value.deleteInventoryFolder(subFolder.ID); | 288 | plugin.deleteInventoryFolder(subFolder.ID); |
302 | } | 289 | } |
303 | } | 290 | } |
304 | 291 | ||
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 1b73152..f8e77df 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -47,42 +47,23 @@ namespace OpenSim.Framework.Communications | |||
47 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | public UserConfig _config; | 49 | public UserConfig _config; |
50 | private Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); | 50 | private List<IUserData> _plugins = new List<IUserData>(); |
51 | 51 | ||
52 | /// <summary> | 52 | /// <summary> |
53 | /// Adds a new user server plugin - user servers will be requested in the order they were loaded. | 53 | /// Adds a new user server plugin - user servers will be requested in the order they were loaded. |
54 | /// </summary> | 54 | /// </summary> |
55 | /// <param name="FileName">The filename to the user server plugin DLL</param> | 55 | /// <param name="provider">The filename to the user server plugin DLL</param> |
56 | public void AddPlugin(string FileName, string connect) | 56 | public void AddPlugin(string provider, string connect) |
57 | { | 57 | { |
58 | if (!String.IsNullOrEmpty(FileName)) | 58 | PluginLoader<IUserData> loader = |
59 | { | 59 | new PluginLoader<IUserData> (new UserDataInitialiser (connect)); |
60 | m_log.Info("[USERSTORAGE]: Attempting to load " + FileName); | 60 | |
61 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | 61 | // loader will try to load all providers (MySQL, MSSQL, etc) |
62 | 62 | // unless it is constrainted to the correct "Provider" entry in the addin.xml | |
63 | m_log.Info("[USERSTORAGE]: Found " + pluginAssembly.GetTypes().Length + " interfaces."); | 63 | loader.Add ("/OpenSim/UserData", new PluginProviderFilter (provider)); |
64 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 64 | loader.Load(); |
65 | { | 65 | |
66 | if (!pluginType.IsAbstract) | 66 | _plugins = loader.Plugins; |
67 | { | ||
68 | Type typeInterface = pluginType.GetInterface("IUserData", true); | ||
69 | |||
70 | if (typeInterface != null) | ||
71 | { | ||
72 | IUserData plug = | ||
73 | (IUserData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
74 | AddPlugin(plug, connect); | ||
75 | } | ||
76 | } | ||
77 | } | ||
78 | } | ||
79 | } | ||
80 | |||
81 | public void AddPlugin(IUserData plug, string connect) | ||
82 | { | ||
83 | plug.Initialise(connect); | ||
84 | _plugins.Add(plug.Name, plug); | ||
85 | m_log.Info("[USERSTORAGE]: Added IUserData Interface"); | ||
86 | } | 67 | } |
87 | 68 | ||
88 | #region Get UserProfile | 69 | #region Get UserProfile |
@@ -90,9 +71,9 @@ namespace OpenSim.Framework.Communications | |||
90 | // see IUserService | 71 | // see IUserService |
91 | public UserProfileData GetUserProfile(string fname, string lname) | 72 | public UserProfileData GetUserProfile(string fname, string lname) |
92 | { | 73 | { |
93 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 74 | foreach (IUserData plugin in _plugins) |
94 | { | 75 | { |
95 | UserProfileData profile = plugin.Value.GetUserByName(fname, lname); | 76 | UserProfileData profile = plugin.GetUserByName(fname, lname); |
96 | 77 | ||
97 | if (profile != null) | 78 | if (profile != null) |
98 | { | 79 | { |
@@ -105,9 +86,9 @@ namespace OpenSim.Framework.Communications | |||
105 | } | 86 | } |
106 | public UserAgentData GetAgentByUUID(LLUUID userId) | 87 | public UserAgentData GetAgentByUUID(LLUUID userId) |
107 | { | 88 | { |
108 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 89 | foreach (IUserData plugin in _plugins) |
109 | { | 90 | { |
110 | UserAgentData agent = plugin.Value.GetAgentByUUID(userId); | 91 | UserAgentData agent = plugin.GetAgentByUUID(userId); |
111 | 92 | ||
112 | if (agent != null) | 93 | if (agent != null) |
113 | { | 94 | { |
@@ -120,9 +101,9 @@ namespace OpenSim.Framework.Communications | |||
120 | // see IUserService | 101 | // see IUserService |
121 | public UserProfileData GetUserProfile(LLUUID uuid) | 102 | public UserProfileData GetUserProfile(LLUUID uuid) |
122 | { | 103 | { |
123 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 104 | foreach (IUserData plugin in _plugins) |
124 | { | 105 | { |
125 | UserProfileData profile = plugin.Value.GetUserByUUID(uuid); | 106 | UserProfileData profile = plugin.GetUserByUUID(uuid); |
126 | 107 | ||
127 | if (null != profile) | 108 | if (null != profile) |
128 | { | 109 | { |
@@ -137,15 +118,15 @@ namespace OpenSim.Framework.Communications | |||
137 | public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query) | 118 | public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query) |
138 | { | 119 | { |
139 | List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>(); | 120 | List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>(); |
140 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 121 | foreach (IUserData plugin in _plugins) |
141 | { | 122 | { |
142 | try | 123 | try |
143 | { | 124 | { |
144 | pickerlist = plugin.Value.GeneratePickerResults(queryID, query); | 125 | pickerlist = plugin.GeneratePickerResults(queryID, query); |
145 | } | 126 | } |
146 | catch (Exception) | 127 | catch (Exception) |
147 | { | 128 | { |
148 | m_log.Info("[USERSTORAGE]: Unable to generate AgentPickerData via " + plugin.Key + "(" + query + ")"); | 129 | m_log.Info("[USERSTORAGE]: Unable to generate AgentPickerData via " + plugin.Name + "(" + query + ")"); |
149 | return new List<AvatarPickerAvatar>(); | 130 | return new List<AvatarPickerAvatar>(); |
150 | } | 131 | } |
151 | } | 132 | } |
@@ -159,17 +140,17 @@ namespace OpenSim.Framework.Communications | |||
159 | /// <returns></returns> | 140 | /// <returns></returns> |
160 | public bool UpdateUserProfile(UserProfileData data) | 141 | public bool UpdateUserProfile(UserProfileData data) |
161 | { | 142 | { |
162 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 143 | foreach (IUserData plugin in _plugins) |
163 | { | 144 | { |
164 | try | 145 | try |
165 | { | 146 | { |
166 | plugin.Value.UpdateUserProfile(data); | 147 | plugin.UpdateUserProfile(data); |
167 | return true; | 148 | return true; |
168 | } | 149 | } |
169 | catch (Exception e) | 150 | catch (Exception e) |
170 | { | 151 | { |
171 | m_log.InfoFormat("[USERSTORAGE]: Unable to set user {0} {1} via {2}: {3}", data.FirstName, data.SurName, | 152 | m_log.InfoFormat("[USERSTORAGE]: Unable to set user {0} {1} via {2}: {3}", data.FirstName, data.SurName, |
172 | plugin.Key, e.ToString()); | 153 | plugin.Name, e.ToString()); |
173 | } | 154 | } |
174 | } | 155 | } |
175 | return false; | 156 | return false; |
@@ -186,15 +167,15 @@ namespace OpenSim.Framework.Communications | |||
186 | /// <returns>Agent profiles</returns> | 167 | /// <returns>Agent profiles</returns> |
187 | public UserAgentData GetUserAgent(LLUUID uuid) | 168 | public UserAgentData GetUserAgent(LLUUID uuid) |
188 | { | 169 | { |
189 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 170 | foreach (IUserData plugin in _plugins) |
190 | { | 171 | { |
191 | try | 172 | try |
192 | { | 173 | { |
193 | return plugin.Value.GetAgentByUUID(uuid); | 174 | return plugin.GetAgentByUUID(uuid); |
194 | } | 175 | } |
195 | catch (Exception e) | 176 | catch (Exception e) |
196 | { | 177 | { |
197 | m_log.Info("[USERSTORAGE]: Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 178 | m_log.Info("[USERSTORAGE]: Unable to find user via " + plugin.Name + "(" + e.ToString() + ")"); |
198 | } | 179 | } |
199 | } | 180 | } |
200 | 181 | ||
@@ -208,15 +189,15 @@ namespace OpenSim.Framework.Communications | |||
208 | /// <returns>A user agent</returns> | 189 | /// <returns>A user agent</returns> |
209 | public UserAgentData GetUserAgent(string name) | 190 | public UserAgentData GetUserAgent(string name) |
210 | { | 191 | { |
211 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 192 | foreach (IUserData plugin in _plugins) |
212 | { | 193 | { |
213 | try | 194 | try |
214 | { | 195 | { |
215 | return plugin.Value.GetAgentByName(name); | 196 | return plugin.GetAgentByName(name); |
216 | } | 197 | } |
217 | catch (Exception e) | 198 | catch (Exception e) |
218 | { | 199 | { |
219 | m_log.Info("[USERSTORAGE]: Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 200 | m_log.Info("[USERSTORAGE]: Unable to find user via " + plugin.Name + "(" + e.ToString() + ")"); |
220 | } | 201 | } |
221 | } | 202 | } |
222 | 203 | ||
@@ -231,15 +212,15 @@ namespace OpenSim.Framework.Communications | |||
231 | /// <returns>A user agent</returns> | 212 | /// <returns>A user agent</returns> |
232 | public UserAgentData GetUserAgent(string fname, string lname) | 213 | public UserAgentData GetUserAgent(string fname, string lname) |
233 | { | 214 | { |
234 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 215 | foreach (IUserData plugin in _plugins) |
235 | { | 216 | { |
236 | try | 217 | try |
237 | { | 218 | { |
238 | return plugin.Value.GetAgentByName(fname, lname); | 219 | return plugin.GetAgentByName(fname, lname); |
239 | } | 220 | } |
240 | catch (Exception e) | 221 | catch (Exception e) |
241 | { | 222 | { |
242 | m_log.Info("[USERSTORAGE]: Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | 223 | m_log.Info("[USERSTORAGE]: Unable to find user via " + plugin.Name + "(" + e.ToString() + ")"); |
243 | } | 224 | } |
244 | } | 225 | } |
245 | 226 | ||
@@ -248,15 +229,15 @@ namespace OpenSim.Framework.Communications | |||
248 | 229 | ||
249 | public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle) | 230 | public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle) |
250 | { | 231 | { |
251 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 232 | foreach (IUserData plugin in _plugins) |
252 | { | 233 | { |
253 | try | 234 | try |
254 | { | 235 | { |
255 | plugin.Value.UpdateUserCurrentRegion(avatarid, regionuuid, regionhandle); | 236 | plugin.UpdateUserCurrentRegion(avatarid, regionuuid, regionhandle); |
256 | } | 237 | } |
257 | catch (Exception e) | 238 | catch (Exception e) |
258 | { | 239 | { |
259 | m_log.Info("[USERSTORAGE]: Unable to updateuser location via " + plugin.Key + "(" + e.ToString() + ")"); | 240 | m_log.Info("[USERSTORAGE]: Unable to updateuser location via " + plugin.Name + "(" + e.ToString() + ")"); |
260 | } | 241 | } |
261 | } | 242 | } |
262 | } | 243 | } |
@@ -268,15 +249,15 @@ namespace OpenSim.Framework.Communications | |||
268 | /// <returns>A List of FriendListItems that contains info about the user's friends</returns> | 249 | /// <returns>A List of FriendListItems that contains info about the user's friends</returns> |
269 | public List<FriendListItem> GetUserFriendList(LLUUID ownerID) | 250 | public List<FriendListItem> GetUserFriendList(LLUUID ownerID) |
270 | { | 251 | { |
271 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 252 | foreach (IUserData plugin in _plugins) |
272 | { | 253 | { |
273 | try | 254 | try |
274 | { | 255 | { |
275 | return plugin.Value.GetUserFriendList(ownerID); | 256 | return plugin.GetUserFriendList(ownerID); |
276 | } | 257 | } |
277 | catch (Exception e) | 258 | catch (Exception e) |
278 | { | 259 | { |
279 | m_log.Info("[USERSTORAGE]: Unable to GetUserFriendList via " + plugin.Key + "(" + e.ToString() + ")"); | 260 | m_log.Info("[USERSTORAGE]: Unable to GetUserFriendList via " + plugin.Name + "(" + e.ToString() + ")"); |
280 | } | 261 | } |
281 | } | 262 | } |
282 | 263 | ||
@@ -285,60 +266,60 @@ namespace OpenSim.Framework.Communications | |||
285 | 266 | ||
286 | public void StoreWebLoginKey(LLUUID agentID, LLUUID webLoginKey) | 267 | public void StoreWebLoginKey(LLUUID agentID, LLUUID webLoginKey) |
287 | { | 268 | { |
288 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 269 | foreach (IUserData plugin in _plugins) |
289 | { | 270 | { |
290 | try | 271 | try |
291 | { | 272 | { |
292 | plugin.Value.StoreWebLoginKey(agentID, webLoginKey); | 273 | plugin.StoreWebLoginKey(agentID, webLoginKey); |
293 | } | 274 | } |
294 | catch (Exception e) | 275 | catch (Exception e) |
295 | { | 276 | { |
296 | m_log.Info("[USERSTORAGE]: Unable to Store WebLoginKey via " + plugin.Key + "(" + e.ToString() + ")"); | 277 | m_log.Info("[USERSTORAGE]: Unable to Store WebLoginKey via " + plugin.Name + "(" + e.ToString() + ")"); |
297 | } | 278 | } |
298 | } | 279 | } |
299 | } | 280 | } |
300 | 281 | ||
301 | public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) | 282 | public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) |
302 | { | 283 | { |
303 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 284 | foreach (IUserData plugin in _plugins) |
304 | { | 285 | { |
305 | try | 286 | try |
306 | { | 287 | { |
307 | plugin.Value.AddNewUserFriend(friendlistowner,friend,perms); | 288 | plugin.AddNewUserFriend(friendlistowner,friend,perms); |
308 | } | 289 | } |
309 | catch (Exception e) | 290 | catch (Exception e) |
310 | { | 291 | { |
311 | m_log.Info("[USERSTORAGE]: Unable to AddNewUserFriend via " + plugin.Key + "(" + e.ToString() + ")"); | 292 | m_log.Info("[USERSTORAGE]: Unable to AddNewUserFriend via " + plugin.Name + "(" + e.ToString() + ")"); |
312 | } | 293 | } |
313 | } | 294 | } |
314 | } | 295 | } |
315 | 296 | ||
316 | public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) | 297 | public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) |
317 | { | 298 | { |
318 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 299 | foreach (IUserData plugin in _plugins) |
319 | { | 300 | { |
320 | try | 301 | try |
321 | { | 302 | { |
322 | plugin.Value.RemoveUserFriend(friendlistowner, friend); | 303 | plugin.RemoveUserFriend(friendlistowner, friend); |
323 | } | 304 | } |
324 | catch (Exception e) | 305 | catch (Exception e) |
325 | { | 306 | { |
326 | m_log.Info("[USERSTORAGE]: Unable to RemoveUserFriend via " + plugin.Key + "(" + e.ToString() + ")"); | 307 | m_log.Info("[USERSTORAGE]: Unable to RemoveUserFriend via " + plugin.Name + "(" + e.ToString() + ")"); |
327 | } | 308 | } |
328 | } | 309 | } |
329 | } | 310 | } |
330 | 311 | ||
331 | public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) | 312 | public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) |
332 | { | 313 | { |
333 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 314 | foreach (IUserData plugin in _plugins) |
334 | { | 315 | { |
335 | try | 316 | try |
336 | { | 317 | { |
337 | plugin.Value.UpdateUserFriendPerms(friendlistowner, friend, perms); | 318 | plugin.UpdateUserFriendPerms(friendlistowner, friend, perms); |
338 | } | 319 | } |
339 | catch (Exception e) | 320 | catch (Exception e) |
340 | { | 321 | { |
341 | m_log.Info("[USERSTORAGE]: Unable to UpdateUserFriendPerms via " + plugin.Key + "(" + e.ToString() + ")"); | 322 | m_log.Info("[USERSTORAGE]: Unable to UpdateUserFriendPerms via " + plugin.Name + "(" + e.ToString() + ")"); |
342 | } | 323 | } |
343 | } | 324 | } |
344 | } | 325 | } |
@@ -564,15 +545,15 @@ namespace OpenSim.Framework.Communications | |||
564 | user.HomeRegionX = regX; | 545 | user.HomeRegionX = regX; |
565 | user.HomeRegionY = regY; | 546 | user.HomeRegionY = regY; |
566 | 547 | ||
567 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 548 | foreach (IUserData plugin in _plugins) |
568 | { | 549 | { |
569 | try | 550 | try |
570 | { | 551 | { |
571 | plugin.Value.AddNewUserProfile(user); | 552 | plugin.AddNewUserProfile(user); |
572 | } | 553 | } |
573 | catch (Exception e) | 554 | catch (Exception e) |
574 | { | 555 | { |
575 | m_log.Info("[USERSTORAGE]: Unable to add user via " + plugin.Key + "(" + e.ToString() + ")"); | 556 | m_log.Info("[USERSTORAGE]: Unable to add user via " + plugin.Name + "(" + e.ToString() + ")"); |
576 | } | 557 | } |
577 | } | 558 | } |
578 | 559 | ||
@@ -586,16 +567,16 @@ namespace OpenSim.Framework.Communications | |||
586 | m_log.Info("[USERSTORAGE]: Failed to find User by UUID " + UserProfile.ID.ToString()); | 567 | m_log.Info("[USERSTORAGE]: Failed to find User by UUID " + UserProfile.ID.ToString()); |
587 | return false; | 568 | return false; |
588 | } | 569 | } |
589 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 570 | foreach (IUserData plugin in _plugins) |
590 | { | 571 | { |
591 | try | 572 | try |
592 | { | 573 | { |
593 | plugin.Value.UpdateUserProfile(UserProfile); | 574 | plugin.UpdateUserProfile(UserProfile); |
594 | } | 575 | } |
595 | catch (Exception e) | 576 | catch (Exception e) |
596 | { | 577 | { |
597 | m_log.Info("[USERSTORAGE]: Unable to update user " + UserProfile.ID.ToString() | 578 | m_log.Info("[USERSTORAGE]: Unable to update user " + UserProfile.ID.ToString() |
598 | + " via " + plugin.Key + "(" + e.ToString() + ")"); | 579 | + " via " + plugin.Name + "(" + e.ToString() + ")"); |
599 | return false; | 580 | return false; |
600 | } | 581 | } |
601 | } | 582 | } |
@@ -612,16 +593,16 @@ namespace OpenSim.Framework.Communications | |||
612 | /// <param name="agentdata">The agent data to be added</param> | 593 | /// <param name="agentdata">The agent data to be added</param> |
613 | public bool AddUserAgent(UserAgentData agentdata) | 594 | public bool AddUserAgent(UserAgentData agentdata) |
614 | { | 595 | { |
615 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 596 | foreach (IUserData plugin in _plugins) |
616 | { | 597 | { |
617 | try | 598 | try |
618 | { | 599 | { |
619 | plugin.Value.AddNewUserAgent(agentdata); | 600 | plugin.AddNewUserAgent(agentdata); |
620 | return true; | 601 | return true; |
621 | } | 602 | } |
622 | catch (Exception e) | 603 | catch (Exception e) |
623 | { | 604 | { |
624 | m_log.Info("[USERSTORAGE]: Unable to add agent via " + plugin.Key + "(" + e.ToString() + ")"); | 605 | m_log.Info("[USERSTORAGE]: Unable to add agent via " + plugin.Name + "(" + e.ToString() + ")"); |
625 | } | 606 | } |
626 | } | 607 | } |
627 | return false; | 608 | return false; |
@@ -631,15 +612,15 @@ namespace OpenSim.Framework.Communications | |||
631 | /// TODO: stubs for now to get us to a compiling state gently | 612 | /// TODO: stubs for now to get us to a compiling state gently |
632 | public AvatarAppearance GetUserAppearance(LLUUID user) | 613 | public AvatarAppearance GetUserAppearance(LLUUID user) |
633 | { | 614 | { |
634 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 615 | foreach (IUserData plugin in _plugins) |
635 | { | 616 | { |
636 | try | 617 | try |
637 | { | 618 | { |
638 | return plugin.Value.GetUserAppearance(user); | 619 | return plugin.GetUserAppearance(user); |
639 | } | 620 | } |
640 | catch (Exception e) | 621 | catch (Exception e) |
641 | { | 622 | { |
642 | m_log.InfoFormat("[USERSTORAGE]: Unable to find user appearance {0} via {1} ({2})", user.ToString(), plugin.Key, e.ToString()); | 623 | m_log.InfoFormat("[USERSTORAGE]: Unable to find user appearance {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString()); |
643 | } | 624 | } |
644 | } | 625 | } |
645 | return null; | 626 | return null; |
@@ -647,60 +628,60 @@ namespace OpenSim.Framework.Communications | |||
647 | 628 | ||
648 | public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) | 629 | public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) |
649 | { | 630 | { |
650 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 631 | foreach (IUserData plugin in _plugins) |
651 | { | 632 | { |
652 | try | 633 | try |
653 | { | 634 | { |
654 | plugin.Value.UpdateUserAppearance(user, appearance); | 635 | plugin.UpdateUserAppearance(user, appearance); |
655 | } | 636 | } |
656 | catch (Exception e) | 637 | catch (Exception e) |
657 | { | 638 | { |
658 | m_log.InfoFormat("[USERSTORAGE]: Unable to update user appearance {0} via {1} ({2})", user.ToString(), plugin.Key, e.ToString()); | 639 | m_log.InfoFormat("[USERSTORAGE]: Unable to update user appearance {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString()); |
659 | } | 640 | } |
660 | } | 641 | } |
661 | } | 642 | } |
662 | 643 | ||
663 | public void AddAttachment(LLUUID user, LLUUID item) | 644 | public void AddAttachment(LLUUID user, LLUUID item) |
664 | { | 645 | { |
665 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 646 | foreach (IUserData plugin in _plugins) |
666 | { | 647 | { |
667 | try | 648 | try |
668 | { | 649 | { |
669 | plugin.Value.AddAttachment(user, item); | 650 | plugin.AddAttachment(user, item); |
670 | } | 651 | } |
671 | catch (Exception e) | 652 | catch (Exception e) |
672 | { | 653 | { |
673 | m_log.InfoFormat("[USERSTORAGE]: Unable to attach {3} => {0} via {1} ({2})", user.ToString(), plugin.Key, e.ToString(), item.ToString()); | 654 | m_log.InfoFormat("[USERSTORAGE]: Unable to attach {3} => {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString(), item.ToString()); |
674 | } | 655 | } |
675 | } | 656 | } |
676 | } | 657 | } |
677 | 658 | ||
678 | public void RemoveAttachment(LLUUID user, LLUUID item) | 659 | public void RemoveAttachment(LLUUID user, LLUUID item) |
679 | { | 660 | { |
680 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 661 | foreach (IUserData plugin in _plugins) |
681 | { | 662 | { |
682 | try | 663 | try |
683 | { | 664 | { |
684 | plugin.Value.RemoveAttachment(user, item); | 665 | plugin.RemoveAttachment(user, item); |
685 | } | 666 | } |
686 | catch (Exception e) | 667 | catch (Exception e) |
687 | { | 668 | { |
688 | m_log.InfoFormat("[USERSTORAGE]: Unable to remove attachment {3} => {0} via {1} ({2})", user.ToString(), plugin.Key, e.ToString(), item.ToString()); | 669 | m_log.InfoFormat("[USERSTORAGE]: Unable to remove attachment {3} => {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString(), item.ToString()); |
689 | } | 670 | } |
690 | } | 671 | } |
691 | } | 672 | } |
692 | 673 | ||
693 | public List<LLUUID> GetAttachments(LLUUID user) | 674 | public List<LLUUID> GetAttachments(LLUUID user) |
694 | { | 675 | { |
695 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 676 | foreach (IUserData plugin in _plugins) |
696 | { | 677 | { |
697 | try | 678 | try |
698 | { | 679 | { |
699 | return plugin.Value.GetAttachments(user); | 680 | return plugin.GetAttachments(user); |
700 | } | 681 | } |
701 | catch (Exception e) | 682 | catch (Exception e) |
702 | { | 683 | { |
703 | m_log.InfoFormat("[USERSTORAGE]: Unable to get attachments for {0} via {1} ({2})", user.ToString(), plugin.Key, e.ToString()); | 684 | m_log.InfoFormat("[USERSTORAGE]: Unable to get attachments for {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString()); |
704 | } | 685 | } |
705 | } | 686 | } |
706 | return new List<LLUUID>(); | 687 | return new List<LLUUID>(); |