aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServerBase.cs2
-rw-r--r--OpenSim/Framework/Communications/Cache/SQLAssetServer.cs8
-rw-r--r--OpenSim/Framework/Communications/InventoryServiceBase.cs81
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs169
-rw-r--r--OpenSim/Framework/IAssetProvider.cs13
-rw-r--r--OpenSim/Framework/IInventoryData.cs32
-rw-r--r--OpenSim/Framework/IUserData.cs27
-rw-r--r--OpenSim/Framework/PluginLoader.cs24
8 files changed, 174 insertions, 182 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>();
diff --git a/OpenSim/Framework/IAssetProvider.cs b/OpenSim/Framework/IAssetProvider.cs
index a9d0e33..00d290e 100644
--- a/OpenSim/Framework/IAssetProvider.cs
+++ b/OpenSim/Framework/IAssetProvider.cs
@@ -29,7 +29,7 @@ using libsecondlife;
29 29
30namespace OpenSim.Framework 30namespace OpenSim.Framework
31{ 31{
32 public interface IAssetProvider : IPlugin 32 public interface IAssetProviderPlugin : IPlugin
33 { 33 {
34 AssetBase FetchAsset(LLUUID uuid); 34 AssetBase FetchAsset(LLUUID uuid);
35 void CreateAsset(AssetBase asset); 35 void CreateAsset(AssetBase asset);
@@ -37,4 +37,15 @@ namespace OpenSim.Framework
37 bool ExistsAsset(LLUUID uuid); 37 bool ExistsAsset(LLUUID uuid);
38 void Initialise(string connect); 38 void Initialise(string connect);
39 } 39 }
40
41 public class AssetDataInitialiser : PluginInitialiserBase
42 {
43 private string connect;
44 public AssetDataInitialiser (string s) { connect = s; }
45 public override void Initialise (IPlugin plugin)
46 {
47 IAssetProviderPlugin p = plugin as IAssetProviderPlugin;
48 p.Initialise (connect);
49 }
50 }
40} 51}
diff --git a/OpenSim/Framework/IInventoryData.cs b/OpenSim/Framework/IInventoryData.cs
index fabcbe2..0d4c555 100644
--- a/OpenSim/Framework/IInventoryData.cs
+++ b/OpenSim/Framework/IInventoryData.cs
@@ -33,7 +33,7 @@ namespace OpenSim.Framework
33 /// <summary> 33 /// <summary>
34 /// An interface for accessing inventory data from a storage server 34 /// An interface for accessing inventory data from a storage server
35 /// </summary> 35 /// </summary>
36 public interface IInventoryData 36 public interface IInventoryDataPlugin : IPlugin
37 { 37 {
38 /// <summary> 38 /// <summary>
39 /// Initialises the interface 39 /// Initialises the interface
@@ -41,23 +41,6 @@ namespace OpenSim.Framework
41 void Initialise(string connect); 41 void Initialise(string connect);
42 42
43 /// <summary> 43 /// <summary>
44 /// Closes the interface
45 /// </summary>
46 void Close();
47
48 /// <summary>
49 /// The plugin being loaded
50 /// </summary>
51 /// <returns>A string containing the plugin name</returns>
52 string getName();
53
54 /// <summary>
55 /// The plugins version
56 /// </summary>
57 /// <returns>A string containing the plugin version</returns>
58 string getVersion();
59
60 /// <summary>
61 /// Returns all child folders in the hierarchy from the parent folder and down. 44 /// Returns all child folders in the hierarchy from the parent folder and down.
62 /// Does not return the parent folder itself. 45 /// Does not return the parent folder itself.
63 /// </summary> 46 /// </summary>
@@ -149,4 +132,15 @@ namespace OpenSim.Framework
149 /// <param name="folder">The id of the folder</param> 132 /// <param name="folder">The id of the folder</param>
150 void deleteInventoryFolder(LLUUID folder); 133 void deleteInventoryFolder(LLUUID folder);
151 } 134 }
152} \ No newline at end of file 135
136 public class InventoryDataInitialiser : PluginInitialiserBase
137 {
138 private string connect;
139 public InventoryDataInitialiser (string s) { connect = s; }
140 public override void Initialise (IPlugin plugin)
141 {
142 IInventoryDataPlugin p = plugin as IInventoryDataPlugin;
143 p.Initialise (connect);
144 }
145 }
146}
diff --git a/OpenSim/Framework/IUserData.cs b/OpenSim/Framework/IUserData.cs
index 5952713..27686c0 100644
--- a/OpenSim/Framework/IUserData.cs
+++ b/OpenSim/Framework/IUserData.cs
@@ -33,7 +33,7 @@ namespace OpenSim.Framework
33 /// <summary> 33 /// <summary>
34 /// An interface for connecting to user storage servers. 34 /// An interface for connecting to user storage servers.
35 /// </summary> 35 /// </summary>
36 public interface IUserData 36 public interface IUserData : IPlugin
37 { 37 {
38 /// <summary> 38 /// <summary>
39 /// Returns a user profile from a database via their UUID 39 /// Returns a user profile from a database via their UUID
@@ -154,18 +154,6 @@ namespace OpenSim.Framework
154 bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory); 154 bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory);
155 155
156 /// <summary> 156 /// <summary>
157 /// Returns the plugin version
158 /// </summary>
159 /// <returns>Plugin version in MAJOR.MINOR.REVISION.BUILD format</returns>
160 string Version {get;}
161
162 /// <summary>
163 /// Returns the plugin name
164 /// </summary>
165 /// <returns>Plugin name, eg MySQL User Provider</returns>
166 string Name {get;}
167
168 /// <summary>
169 /// Initialises the plugin (artificial constructor) 157 /// Initialises the plugin (artificial constructor)
170 /// </summary> 158 /// </summary>
171 void Initialise(string connect); 159 void Initialise(string connect);
@@ -182,4 +170,15 @@ namespace OpenSim.Framework
182 void RemoveAttachment(LLUUID user, LLUUID item); 170 void RemoveAttachment(LLUUID user, LLUUID item);
183 List<LLUUID> GetAttachments(LLUUID user); 171 List<LLUUID> GetAttachments(LLUUID user);
184 } 172 }
185} \ No newline at end of file 173
174 public class UserDataInitialiser : PluginInitialiserBase
175 {
176 private string connect;
177 public UserDataInitialiser (string s) { connect = s; }
178 public override void Initialise (IPlugin plugin)
179 {
180 IUserData p = plugin as IUserData;
181 p.Initialise (connect);
182 }
183 }
184}
diff --git a/OpenSim/Framework/PluginLoader.cs b/OpenSim/Framework/PluginLoader.cs
index 616fa3e..3bc4de6 100644
--- a/OpenSim/Framework/PluginLoader.cs
+++ b/OpenSim/Framework/PluginLoader.cs
@@ -96,6 +96,11 @@ namespace OpenSim.Framework
96 get { return loaded; } 96 get { return loaded; }
97 } 97 }
98 98
99 public T Plugin
100 {
101 get { return (loaded.Count == 1)? loaded [0] : default (T); }
102 }
103
99 public PluginLoader () 104 public PluginLoader ()
100 { 105 {
101 Initialiser = new PluginInitialiserBase(); 106 Initialiser = new PluginInitialiserBase();
@@ -114,11 +119,26 @@ namespace OpenSim.Framework
114 initialise_plugin_dir_ (dir); 119 initialise_plugin_dir_ (dir);
115 } 120 }
116 121
117 public void AddExtensionPoint (string extpoint) 122 public void Add (string extpoint)
118 { 123 {
124 if (extpoints.Contains (extpoint))
125 return;
126
119 extpoints.Add (extpoint); 127 extpoints.Add (extpoint);
120 } 128 }
121 129
130 public void Add (string extpoint, IPluginConstraint cons)
131 {
132 Add (extpoint);
133 AddConstraint (extpoint, cons);
134 }
135
136 public void Add (string extpoint, IPluginFilter filter)
137 {
138 Add (extpoint);
139 AddFilter (extpoint, filter);
140 }
141
122 public void AddConstraint (string extpoint, IPluginConstraint cons) 142 public void AddConstraint (string extpoint, IPluginConstraint cons)
123 { 143 {
124 constraints.Add (extpoint, cons); 144 constraints.Add (extpoint, cons);
@@ -131,7 +151,7 @@ namespace OpenSim.Framework
131 151
132 public void Load (string extpoint) 152 public void Load (string extpoint)
133 { 153 {
134 AddExtensionPoint (extpoint); 154 Add (extpoint);
135 Load(); 155 Load();
136 } 156 }
137 157