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 | |
parent | dropping intermediate GridInfoPlugin.addin.xml, as it's no longer (diff) | |
download | opensim-SC-2270b252656146d9d74b84665a7ace6c3139db30.zip opensim-SC-2270b252656146d9d74b84665a7ace6c3139db30.tar.gz opensim-SC-2270b252656146d9d74b84665a7ace6c3139db30.tar.bz2 opensim-SC-2270b252656146d9d74b84665a7ace6c3139db30.tar.xz |
Thanks, sempuki, for a patch that moves all Grid Server's plugins to
PluginLoader. Fix issue 1871.
Diffstat (limited to 'OpenSim')
25 files changed, 308 insertions, 272 deletions
diff --git a/OpenSim/Data/AssetDataBase.cs b/OpenSim/Data/AssetDataBase.cs index 6e9e085..690abd0 100644 --- a/OpenSim/Data/AssetDataBase.cs +++ b/OpenSim/Data/AssetDataBase.cs | |||
@@ -30,7 +30,7 @@ using OpenSim.Framework; | |||
30 | 30 | ||
31 | namespace OpenSim.Data | 31 | namespace OpenSim.Data |
32 | { | 32 | { |
33 | public abstract class AssetDataBase : IAssetProvider | 33 | public abstract class AssetDataBase : IAssetProviderPlugin |
34 | { | 34 | { |
35 | public abstract AssetBase FetchAsset(LLUUID uuid); | 35 | public abstract AssetBase FetchAsset(LLUUID uuid); |
36 | public abstract void CreateAsset(AssetBase asset); | 36 | public abstract void CreateAsset(AssetBase asset); |
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index e0e20df..443907f 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs | |||
@@ -45,7 +45,7 @@ namespace OpenSim.Data.MSSQL | |||
45 | 45 | ||
46 | private MSSQLManager database; | 46 | private MSSQLManager database; |
47 | 47 | ||
48 | #region IAssetProvider Members | 48 | #region IAssetProviderPlugin Members |
49 | 49 | ||
50 | /// <summary> | 50 | /// <summary> |
51 | /// Migration method | 51 | /// Migration method |
diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs index 4a8d6e9..9e60b16 100644 --- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs | |||
@@ -39,7 +39,7 @@ namespace OpenSim.Data.MSSQL | |||
39 | /// <summary> | 39 | /// <summary> |
40 | /// A MSSQL interface for the inventory server | 40 | /// A MSSQL interface for the inventory server |
41 | /// </summary> | 41 | /// </summary> |
42 | public class MSSQLInventoryData : IInventoryData | 42 | public class MSSQLInventoryData : IInventoryDataPlugin |
43 | { | 43 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
@@ -59,6 +59,12 @@ namespace OpenSim.Data.MSSQL | |||
59 | /// </summary> | 59 | /// </summary> |
60 | private MSSQLManager database; | 60 | private MSSQLManager database; |
61 | 61 | ||
62 | public void Initialise() | ||
63 | { | ||
64 | m_log.Info("[MSSQLInventoryData]: " + Name + " cannot be default-initialized!"); | ||
65 | throw new PluginNotInitialisedException (Name); | ||
66 | } | ||
67 | |||
62 | /// <summary> | 68 | /// <summary> |
63 | /// Loads and initialises the MSSQL inventory storage interface | 69 | /// Loads and initialises the MSSQL inventory storage interface |
64 | /// </summary> | 70 | /// </summary> |
@@ -134,15 +140,15 @@ namespace OpenSim.Data.MSSQL | |||
134 | /// The name of this DB provider | 140 | /// The name of this DB provider |
135 | /// </summary> | 141 | /// </summary> |
136 | /// <returns>A string containing the name of the DB provider</returns> | 142 | /// <returns>A string containing the name of the DB provider</returns> |
137 | public string getName() | 143 | public string Name |
138 | { | 144 | { |
139 | return "MSSQL Inventory Data Interface"; | 145 | get { return "MSSQL Inventory Data Interface"; } |
140 | } | 146 | } |
141 | 147 | ||
142 | /// <summary> | 148 | /// <summary> |
143 | /// Closes this DB provider | 149 | /// Closes this DB provider |
144 | /// </summary> | 150 | /// </summary> |
145 | public void Close() | 151 | public void Dispose() |
146 | { | 152 | { |
147 | // Do nothing. | 153 | // Do nothing. |
148 | } | 154 | } |
@@ -151,9 +157,9 @@ namespace OpenSim.Data.MSSQL | |||
151 | /// Returns the version of this DB provider | 157 | /// Returns the version of this DB provider |
152 | /// </summary> | 158 | /// </summary> |
153 | /// <returns>A string containing the DB provider</returns> | 159 | /// <returns>A string containing the DB provider</returns> |
154 | public string getVersion() | 160 | public string Version |
155 | { | 161 | { |
156 | return database.getVersion(); | 162 | get { return database.getVersion(); } |
157 | } | 163 | } |
158 | 164 | ||
159 | /// <summary> | 165 | /// <summary> |
@@ -681,7 +687,7 @@ namespace OpenSim.Data.MSSQL | |||
681 | folders.Add(f); | 687 | folders.Add(f); |
682 | } | 688 | } |
683 | 689 | ||
684 | // See IInventoryData | 690 | // See IInventoryDataPlugin |
685 | public List<InventoryFolderBase> getFolderHierarchy(LLUUID parentID) | 691 | public List<InventoryFolderBase> getFolderHierarchy(LLUUID parentID) |
686 | { | 692 | { |
687 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | 693 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); |
diff --git a/OpenSim/Data/MSSQL/MSSQLUserData.cs b/OpenSim/Data/MSSQL/MSSQLUserData.cs index 0593c62..0703aab 100644 --- a/OpenSim/Data/MSSQL/MSSQLUserData.cs +++ b/OpenSim/Data/MSSQL/MSSQLUserData.cs | |||
@@ -52,6 +52,12 @@ namespace OpenSim.Data.MSSQL | |||
52 | private string m_usersTableName; | 52 | private string m_usersTableName; |
53 | private string m_userFriendsTableName; | 53 | private string m_userFriendsTableName; |
54 | 54 | ||
55 | public override void Initialise() | ||
56 | { | ||
57 | m_log.Info("[MSSQLUserData]: " + Name + " cannot be default-initialized!"); | ||
58 | throw new PluginNotInitialisedException (Name); | ||
59 | } | ||
60 | |||
55 | /// <summary> | 61 | /// <summary> |
56 | /// Loads and initialises the MSSQL storage plugin | 62 | /// Loads and initialises the MSSQL storage plugin |
57 | /// </summary> | 63 | /// </summary> |
@@ -93,6 +99,8 @@ namespace OpenSim.Data.MSSQL | |||
93 | 99 | ||
94 | TestTables(); | 100 | TestTables(); |
95 | } | 101 | } |
102 | |||
103 | public override void Dispose () {} | ||
96 | 104 | ||
97 | /// <summary> | 105 | /// <summary> |
98 | /// | 106 | /// |
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 9284ba9..cec736a 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -112,7 +112,7 @@ namespace OpenSim.Data.MySQL | |||
112 | 112 | ||
113 | override public void Dispose() { } | 113 | override public void Dispose() { } |
114 | 114 | ||
115 | #region IAssetProvider Members | 115 | #region IAssetProviderPlugin Members |
116 | 116 | ||
117 | /// <summary> | 117 | /// <summary> |
118 | /// <list type="bullet"> | 118 | /// <list type="bullet"> |
diff --git a/OpenSim/Data/MySQL/MySQLGridData.cs b/OpenSim/Data/MySQL/MySQLGridData.cs index fee457a..4cddbe5 100644 --- a/OpenSim/Data/MySQL/MySQLGridData.cs +++ b/OpenSim/Data/MySQL/MySQLGridData.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Data.MySQL | |||
51 | 51 | ||
52 | override public void Initialise() | 52 | override public void Initialise() |
53 | { | 53 | { |
54 | m_log.Info("[MySQLLogData]: " + Name + " cannot be default-initialized!"); | 54 | m_log.Info("[MySQLGridData]: " + Name + " cannot be default-initialized!"); |
55 | throw new PluginNotInitialisedException (Name); | 55 | throw new PluginNotInitialisedException (Name); |
56 | } | 56 | } |
57 | 57 | ||
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index 5bde40a..0fb49c1 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs | |||
@@ -38,7 +38,7 @@ namespace OpenSim.Data.MySQL | |||
38 | /// <summary> | 38 | /// <summary> |
39 | /// A MySQL interface for the inventory server | 39 | /// A MySQL interface for the inventory server |
40 | /// </summary> | 40 | /// </summary> |
41 | public class MySQLInventoryData : IInventoryData | 41 | public class MySQLInventoryData : IInventoryDataPlugin |
42 | { | 42 | { |
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); |
@@ -48,6 +48,12 @@ namespace OpenSim.Data.MySQL | |||
48 | /// </summary> | 48 | /// </summary> |
49 | private MySQLManager database; | 49 | private MySQLManager database; |
50 | 50 | ||
51 | public void Initialise() | ||
52 | { | ||
53 | m_log.Info("[MySQLInventoryData]: " + Name + " cannot be default-initialized!"); | ||
54 | throw new PluginNotInitialisedException (Name); | ||
55 | } | ||
56 | |||
51 | /// <summary> | 57 | /// <summary> |
52 | /// <para>Initialises Inventory interface</para> | 58 | /// <para>Initialises Inventory interface</para> |
53 | /// <para> | 59 | /// <para> |
@@ -183,16 +189,16 @@ namespace OpenSim.Data.MySQL | |||
183 | /// The name of this DB provider | 189 | /// The name of this DB provider |
184 | /// </summary> | 190 | /// </summary> |
185 | /// <returns>Name of DB provider</returns> | 191 | /// <returns>Name of DB provider</returns> |
186 | public string getName() | 192 | public string Name |
187 | { | 193 | { |
188 | return "MySQL Inventory Data Interface"; | 194 | get { return "MySQL Inventory Data Interface"; } |
189 | } | 195 | } |
190 | 196 | ||
191 | /// <summary> | 197 | /// <summary> |
192 | /// Closes this DB provider | 198 | /// Closes this DB provider |
193 | /// </summary> | 199 | /// </summary> |
194 | /// <remarks>do nothing</remarks> | 200 | /// <remarks>do nothing</remarks> |
195 | public void Close() | 201 | public void Dispose() |
196 | { | 202 | { |
197 | // Do nothing. | 203 | // Do nothing. |
198 | } | 204 | } |
@@ -201,9 +207,9 @@ namespace OpenSim.Data.MySQL | |||
201 | /// Returns the version of this DB provider | 207 | /// Returns the version of this DB provider |
202 | /// </summary> | 208 | /// </summary> |
203 | /// <returns>A string containing the DB provider version</returns> | 209 | /// <returns>A string containing the DB provider version</returns> |
204 | public string getVersion() | 210 | public string Version |
205 | { | 211 | { |
206 | return database.getVersion(); | 212 | get { return database.getVersion(); } |
207 | } | 213 | } |
208 | 214 | ||
209 | /// <summary> | 215 | /// <summary> |
@@ -692,7 +698,7 @@ namespace OpenSim.Data.MySQL | |||
692 | 698 | ||
693 | 699 | ||
694 | /// <summary> | 700 | /// <summary> |
695 | /// See IInventoryData | 701 | /// See IInventoryDataPlugin |
696 | /// </summary> | 702 | /// </summary> |
697 | /// <param name="parentID"></param> | 703 | /// <param name="parentID"></param> |
698 | /// <returns></returns> | 704 | /// <returns></returns> |
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs index 11d9c26..d8830de 100644 --- a/OpenSim/Data/MySQL/MySQLUserData.cs +++ b/OpenSim/Data/MySQL/MySQLUserData.cs | |||
@@ -55,6 +55,12 @@ namespace OpenSim.Data.MySQL | |||
55 | private string m_appearanceTableName = "avatarappearance"; | 55 | private string m_appearanceTableName = "avatarappearance"; |
56 | private string m_connectString; | 56 | private string m_connectString; |
57 | 57 | ||
58 | public override void Initialise() | ||
59 | { | ||
60 | m_log.Info("[MySQLUserData]: " + Name + " cannot be default-initialized!"); | ||
61 | throw new PluginNotInitialisedException (Name); | ||
62 | } | ||
63 | |||
58 | /// <summary> | 64 | /// <summary> |
59 | /// Initialise User Interface | 65 | /// Initialise User Interface |
60 | /// Loads and initialises the MySQL storage plugin | 66 | /// Loads and initialises the MySQL storage plugin |
@@ -120,6 +126,9 @@ namespace OpenSim.Data.MySQL | |||
120 | m.Update(); | 126 | m.Update(); |
121 | } | 127 | } |
122 | 128 | ||
129 | public override void Dispose () { } | ||
130 | |||
131 | |||
123 | #region Test and initialization code | 132 | #region Test and initialization code |
124 | 133 | ||
125 | /// <summary> | 134 | /// <summary> |
@@ -252,7 +261,7 @@ namespace OpenSim.Data.MySQL | |||
252 | 261 | ||
253 | UserProfileData row = database.readUserRow(reader); | 262 | UserProfileData row = database.readUserRow(reader); |
254 | 263 | ||
255 | reader.Close(); | 264 | reader.Dispose(); |
256 | result.Dispose(); | 265 | result.Dispose(); |
257 | return row; | 266 | return row; |
258 | } | 267 | } |
@@ -398,7 +407,7 @@ namespace OpenSim.Data.MySQL | |||
398 | 407 | ||
399 | Lfli.Add(fli); | 408 | Lfli.Add(fli); |
400 | } | 409 | } |
401 | reader.Close(); | 410 | reader.Dispose(); |
402 | result.Dispose(); | 411 | result.Dispose(); |
403 | } | 412 | } |
404 | } | 413 | } |
@@ -450,7 +459,7 @@ namespace OpenSim.Data.MySQL | |||
450 | user.lastName = (string) reader["lastname"]; | 459 | user.lastName = (string) reader["lastname"]; |
451 | returnlist.Add(user); | 460 | returnlist.Add(user); |
452 | } | 461 | } |
453 | reader.Close(); | 462 | reader.Dispose(); |
454 | result.Dispose(); | 463 | result.Dispose(); |
455 | } | 464 | } |
456 | } | 465 | } |
@@ -484,7 +493,7 @@ namespace OpenSim.Data.MySQL | |||
484 | user.lastName = (string) reader["lastname"]; | 493 | user.lastName = (string) reader["lastname"]; |
485 | returnlist.Add(user); | 494 | returnlist.Add(user); |
486 | } | 495 | } |
487 | reader.Close(); | 496 | reader.Dispose(); |
488 | result.Dispose(); | 497 | result.Dispose(); |
489 | } | 498 | } |
490 | } | 499 | } |
@@ -517,7 +526,7 @@ namespace OpenSim.Data.MySQL | |||
517 | 526 | ||
518 | UserProfileData row = database.readUserRow(reader); | 527 | UserProfileData row = database.readUserRow(reader); |
519 | 528 | ||
520 | reader.Close(); | 529 | reader.Dispose(); |
521 | result.Dispose(); | 530 | result.Dispose(); |
522 | 531 | ||
523 | return row; | 532 | return row; |
@@ -603,7 +612,7 @@ namespace OpenSim.Data.MySQL | |||
603 | 612 | ||
604 | UserAgentData row = database.readAgentRow(reader); | 613 | UserAgentData row = database.readAgentRow(reader); |
605 | 614 | ||
606 | reader.Close(); | 615 | reader.Dispose(); |
607 | result.Dispose(); | 616 | result.Dispose(); |
608 | 617 | ||
609 | return row; | 618 | return row; |
@@ -725,7 +734,7 @@ namespace OpenSim.Data.MySQL | |||
725 | 734 | ||
726 | AvatarAppearance appearance = database.readAppearanceRow(reader); | 735 | AvatarAppearance appearance = database.readAppearanceRow(reader); |
727 | 736 | ||
728 | reader.Close(); | 737 | reader.Dispose(); |
729 | result.Dispose(); | 738 | result.Dispose(); |
730 | 739 | ||
731 | return appearance; | 740 | return appearance; |
diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs index 153d2d5..657a7b2 100644 --- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs +++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs | |||
@@ -42,7 +42,7 @@ using Environment=NHibernate.Cfg.Environment; | |||
42 | 42 | ||
43 | namespace OpenSim.Data.NHibernate | 43 | namespace OpenSim.Data.NHibernate |
44 | { | 44 | { |
45 | public class NHibernateInventoryData: IInventoryData | 45 | public class NHibernateInventoryData: IInventoryDataPlugin |
46 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
@@ -50,6 +50,12 @@ namespace OpenSim.Data.NHibernate | |||
50 | private ISessionFactory factory; | 50 | private ISessionFactory factory; |
51 | private ISession session; | 51 | private ISession session; |
52 | 52 | ||
53 | public void Initialise() | ||
54 | { | ||
55 | m_log.Info("[NHibernateInventoryData]: " + Name + " cannot be default-initialized!"); | ||
56 | throw new PluginNotInitialisedException (Name); | ||
57 | } | ||
58 | |||
53 | /// <summary> | 59 | /// <summary> |
54 | /// Initialises the interface | 60 | /// Initialises the interface |
55 | /// </summary> | 61 | /// </summary> |
@@ -257,7 +263,7 @@ namespace OpenSim.Data.NHibernate | |||
257 | /// <summary> | 263 | /// <summary> |
258 | /// Closes the interface | 264 | /// Closes the interface |
259 | /// </summary> | 265 | /// </summary> |
260 | public void Close() | 266 | public void Dispose() |
261 | { | 267 | { |
262 | } | 268 | } |
263 | 269 | ||
@@ -265,25 +271,28 @@ namespace OpenSim.Data.NHibernate | |||
265 | /// The plugin being loaded | 271 | /// The plugin being loaded |
266 | /// </summary> | 272 | /// </summary> |
267 | /// <returns>A string containing the plugin name</returns> | 273 | /// <returns>A string containing the plugin name</returns> |
268 | public string getName() | 274 | public string Name |
269 | { | 275 | { |
270 | return "NHibernate Inventory Data Interface"; | 276 | get { return "NHibernate Inventory Data Interface"; } |
271 | } | 277 | } |
272 | 278 | ||
273 | /// <summary> | 279 | /// <summary> |
274 | /// The plugins version | 280 | /// The plugins version |
275 | /// </summary> | 281 | /// </summary> |
276 | /// <returns>A string containing the plugin version</returns> | 282 | /// <returns>A string containing the plugin version</returns> |
277 | public string getVersion() | 283 | public string Version |
278 | { | 284 | { |
279 | Module module = GetType().Module; | 285 | get |
280 | // string dllName = module.Assembly.ManifestModule.Name; | 286 | { |
281 | Version dllVersion = module.Assembly.GetName().Version; | 287 | Module module = GetType().Module; |
288 | // string dllName = module.Assembly.ManifestModule.Name; | ||
289 | Version dllVersion = module.Assembly.GetName().Version; | ||
282 | 290 | ||
283 | 291 | ||
284 | return | 292 | return |
285 | string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, | 293 | string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, |
286 | dllVersion.Revision); | 294 | dllVersion.Revision); |
295 | } | ||
287 | } | 296 | } |
288 | 297 | ||
289 | // Move seems to be just update | 298 | // Move seems to be just update |
@@ -369,7 +378,7 @@ namespace OpenSim.Data.NHibernate | |||
369 | return folders; | 378 | return folders; |
370 | } | 379 | } |
371 | 380 | ||
372 | // See IInventoryData | 381 | // See IInventoryDataPlugin |
373 | public List<InventoryFolderBase> getFolderHierarchy(LLUUID parentID) | 382 | public List<InventoryFolderBase> getFolderHierarchy(LLUUID parentID) |
374 | { | 383 | { |
375 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | 384 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); |
diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs index 9d9aec9..bceae7c 100644 --- a/OpenSim/Data/NHibernate/NHibernateUserData.cs +++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs | |||
@@ -53,6 +53,12 @@ namespace OpenSim.Data.NHibernate | |||
53 | private ISessionFactory factory; | 53 | private ISessionFactory factory; |
54 | private ISession session; | 54 | private ISession session; |
55 | 55 | ||
56 | public override void Initialise() | ||
57 | { | ||
58 | m_log.Info("[NHibernateUserData]: " + Name + " cannot be default-initialized!"); | ||
59 | throw new PluginNotInitialisedException (Name); | ||
60 | } | ||
61 | |||
56 | public override void Initialise(string connect) | 62 | public override void Initialise(string connect) |
57 | { | 63 | { |
58 | char[] split = {';'}; | 64 | char[] split = {';'}; |
@@ -320,7 +326,7 @@ namespace OpenSim.Data.NHibernate | |||
320 | get { return "0.1"; } | 326 | get { return "0.1"; } |
321 | } | 327 | } |
322 | 328 | ||
323 | public void Dispose() | 329 | public override void Dispose() |
324 | { | 330 | { |
325 | 331 | ||
326 | } | 332 | } |
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index 99560a0..ef4ef99 100644 --- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs | |||
@@ -39,7 +39,7 @@ namespace OpenSim.Data.SQLite | |||
39 | /// <summary> | 39 | /// <summary> |
40 | /// An Inventory Interface to the SQLite database | 40 | /// An Inventory Interface to the SQLite database |
41 | /// </summary> | 41 | /// </summary> |
42 | public class SQLiteInventoryStore : SQLiteUtil, IInventoryData | 42 | public class SQLiteInventoryStore : SQLiteUtil, IInventoryDataPlugin |
43 | { | 43 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
@@ -50,6 +50,12 @@ namespace OpenSim.Data.SQLite | |||
50 | private SqliteDataAdapter invItemsDa; | 50 | private SqliteDataAdapter invItemsDa; |
51 | private SqliteDataAdapter invFoldersDa; | 51 | private SqliteDataAdapter invFoldersDa; |
52 | 52 | ||
53 | public void Initialise() | ||
54 | { | ||
55 | m_log.Info("[SQLiteInventoryData]: " + Name + " cannot be default-initialized!"); | ||
56 | throw new PluginNotInitialisedException (Name); | ||
57 | } | ||
58 | |||
53 | /// <summary> | 59 | /// <summary> |
54 | /// <list type="bullet"> | 60 | /// <list type="bullet"> |
55 | /// <item>Initialises Inventory interface</item> | 61 | /// <item>Initialises Inventory interface</item> |
@@ -277,7 +283,7 @@ namespace OpenSim.Data.SQLite | |||
277 | /// <summary> | 283 | /// <summary> |
278 | /// Closes the inventory interface | 284 | /// Closes the inventory interface |
279 | /// </summary> | 285 | /// </summary> |
280 | public void Close() | 286 | public void Dispose() |
281 | { | 287 | { |
282 | } | 288 | } |
283 | 289 | ||
@@ -285,25 +291,28 @@ namespace OpenSim.Data.SQLite | |||
285 | /// The name of this DB provider | 291 | /// The name of this DB provider |
286 | /// </summary> | 292 | /// </summary> |
287 | /// <returns>Name of DB provider</returns> | 293 | /// <returns>Name of DB provider</returns> |
288 | public string getName() | 294 | public string Name |
289 | { | 295 | { |
290 | return "SQLite Inventory Data Interface"; | 296 | get { return "SQLite Inventory Data Interface"; } |
291 | } | 297 | } |
292 | 298 | ||
293 | /// <summary> | 299 | /// <summary> |
294 | /// Returns the version of this DB provider | 300 | /// Returns the version of this DB provider |
295 | /// </summary> | 301 | /// </summary> |
296 | /// <returns>A string containing the DB provider version</returns> | 302 | /// <returns>A string containing the DB provider version</returns> |
297 | public string getVersion() | 303 | public string Version |
298 | { | 304 | { |
299 | Module module = GetType().Module; | 305 | get |
300 | // string dllName = module.Assembly.ManifestModule.Name; | 306 | { |
301 | Version dllVersion = module.Assembly.GetName().Version; | 307 | Module module = GetType().Module; |
308 | // string dllName = module.Assembly.ManifestModule.Name; | ||
309 | Version dllVersion = module.Assembly.GetName().Version; | ||
302 | 310 | ||
303 | 311 | ||
304 | return | 312 | return |
305 | string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, | 313 | string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, |
306 | dllVersion.Revision); | 314 | dllVersion.Revision); |
315 | } | ||
307 | } | 316 | } |
308 | 317 | ||
309 | /// <summary> | 318 | /// <summary> |
@@ -399,7 +408,7 @@ namespace OpenSim.Data.SQLite | |||
399 | } | 408 | } |
400 | 409 | ||
401 | /// <summary> | 410 | /// <summary> |
402 | /// See IInventoryData | 411 | /// See IInventoryDataPlugin |
403 | /// </summary> | 412 | /// </summary> |
404 | /// <param name="parentID"></param> | 413 | /// <param name="parentID"></param> |
405 | /// <returns></returns> | 414 | /// <returns></returns> |
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs index c7673bd..2d3687c 100644 --- a/OpenSim/Data/SQLite/SQLiteUserData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserData.cs | |||
@@ -65,6 +65,12 @@ namespace OpenSim.Data.SQLite | |||
65 | private SqliteDataAdapter daf; | 65 | private SqliteDataAdapter daf; |
66 | SqliteConnection g_conn; | 66 | SqliteConnection g_conn; |
67 | 67 | ||
68 | public override void Initialise() | ||
69 | { | ||
70 | m_log.Info("[SQLiteUserData]: " + Name + " cannot be default-initialized!"); | ||
71 | throw new PluginNotInitialisedException (Name); | ||
72 | } | ||
73 | |||
68 | /// <summary> | 74 | /// <summary> |
69 | /// <list type="bullet"> | 75 | /// <list type="bullet"> |
70 | /// <item>Initialises User Interface</item> | 76 | /// <item>Initialises User Interface</item> |
@@ -124,6 +130,8 @@ namespace OpenSim.Data.SQLite | |||
124 | return; | 130 | return; |
125 | } | 131 | } |
126 | 132 | ||
133 | public override void Dispose () {} | ||
134 | |||
127 | /// <summary> | 135 | /// <summary> |
128 | /// see IUserData, | 136 | /// see IUserData, |
129 | /// Get user data profile by UUID | 137 | /// Get user data profile by UUID |
diff --git a/OpenSim/Data/UserDataBase.cs b/OpenSim/Data/UserDataBase.cs index eb21aee..e4e39d6 100644 --- a/OpenSim/Data/UserDataBase.cs +++ b/OpenSim/Data/UserDataBase.cs | |||
@@ -55,9 +55,6 @@ namespace OpenSim.Data | |||
55 | public abstract List<FriendListItem> GetUserFriendList(LLUUID friendlistowner); | 55 | public abstract List<FriendListItem> GetUserFriendList(LLUUID friendlistowner); |
56 | public abstract bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount); | 56 | public abstract bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount); |
57 | public abstract bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory); | 57 | public abstract bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory); |
58 | public abstract string Version {get;} | ||
59 | public abstract string Name {get;} | ||
60 | public abstract void Initialise(string connect); | ||
61 | public abstract List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query); | 58 | public abstract List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query); |
62 | public abstract AvatarAppearance GetUserAppearance(LLUUID user); | 59 | public abstract AvatarAppearance GetUserAppearance(LLUUID user); |
63 | public abstract void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance); | 60 | public abstract void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance); |
@@ -78,5 +75,11 @@ namespace OpenSim.Data | |||
78 | public abstract void AddAttachment(LLUUID user, LLUUID item); | 75 | public abstract void AddAttachment(LLUUID user, LLUUID item); |
79 | public abstract void RemoveAttachment(LLUUID user, LLUUID item); | 76 | public abstract void RemoveAttachment(LLUUID user, LLUUID item); |
80 | public abstract List<LLUUID> GetAttachments(LLUUID user); | 77 | public abstract List<LLUUID> GetAttachments(LLUUID user); |
78 | |||
79 | public abstract string Version {get;} | ||
80 | public abstract string Name {get;} | ||
81 | public abstract void Initialise(string connect); | ||
82 | public abstract void Initialise(); | ||
83 | public abstract void Dispose(); | ||
81 | } | 84 | } |
82 | } | 85 | } |
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 | ||
30 | namespace OpenSim.Framework | 30 | namespace 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 | ||
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index 7053f72..7c7e39b 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs | |||
@@ -53,7 +53,7 @@ namespace OpenSim.Grid.AssetServer | |||
53 | // Temporarily hardcoded - should be a plugin | 53 | // Temporarily hardcoded - should be a plugin |
54 | protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); | 54 | protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); |
55 | 55 | ||
56 | private IAssetProvider m_assetProvider; | 56 | private IAssetProviderPlugin m_assetProvider; |
57 | 57 | ||
58 | [STAThread] | 58 | [STAThread] |
59 | public static void Main(string[] args) | 59 | public static void Main(string[] args) |
@@ -116,36 +116,19 @@ namespace OpenSim.Grid.AssetServer | |||
116 | return null; | 116 | return null; |
117 | } | 117 | } |
118 | 118 | ||
119 | public IAssetProvider LoadDatabasePlugin(string FileName, string connect) | 119 | public IAssetProviderPlugin LoadDatabasePlugin(string provider, string connect) |
120 | { | 120 | { |
121 | m_log.Info("[ASSET SERVER]: LoadDatabasePlugin: Attempting to load " + FileName); | 121 | PluginLoader<IAssetProviderPlugin> loader = |
122 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | 122 | new PluginLoader<IAssetProviderPlugin> (new AssetDataInitialiser (connect)); |
123 | IAssetProvider assetPlugin = null; | ||
124 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
125 | { | ||
126 | if (!pluginType.IsAbstract) | ||
127 | { | ||
128 | Type typeInterface = pluginType.GetInterface("IAssetProvider", true); | ||
129 | 123 | ||
130 | if (typeInterface != null) | 124 | // loader will try to load all providers (MySQL, MSSQL, etc) |
131 | { | 125 | // unless it is constrainted to the correct "Provider" entry in the addin.xml |
132 | IAssetProvider plug = | 126 | loader.Add ("/OpenSim/AssetData", new PluginProviderFilter (provider)); |
133 | (IAssetProvider) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 127 | loader.Load(); |
134 | assetPlugin = plug; | ||
135 | assetPlugin.Initialise(connect); | ||
136 | 128 | ||
137 | m_log.Info("[ASSET SERVER]: Added " + assetPlugin.Name + " " + assetPlugin.Version); | 129 | return loader.Plugin; |
138 | break; | ||
139 | } | ||
140 | |||
141 | typeInterface = null; | ||
142 | } | ||
143 | } | ||
144 | |||
145 | pluginAssembly = null; | ||
146 | return assetPlugin; | ||
147 | } | 130 | } |
148 | 131 | ||
149 | public void setupDB(AssetConfig config) | 132 | public void setupDB(AssetConfig config) |
150 | { | 133 | { |
151 | try | 134 | try |
diff --git a/OpenSim/Grid/AssetServer/RestService.cs b/OpenSim/Grid/AssetServer/RestService.cs index 372f5f8..f63b78b 100644 --- a/OpenSim/Grid/AssetServer/RestService.cs +++ b/OpenSim/Grid/AssetServer/RestService.cs | |||
@@ -45,14 +45,14 @@ namespace OpenSim.Grid.AssetServer | |||
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | // private OpenAsset_Main m_assetManager; | 47 | // private OpenAsset_Main m_assetManager; |
48 | private IAssetProvider m_assetProvider; | 48 | private IAssetProviderPlugin m_assetProvider; |
49 | 49 | ||
50 | /// <summary> | 50 | /// <summary> |
51 | /// Constructor. | 51 | /// Constructor. |
52 | /// </summary> | 52 | /// </summary> |
53 | /// <param name="assetManager"></param> | 53 | /// <param name="assetManager"></param> |
54 | /// <param name="assetProvider"></param> | 54 | /// <param name="assetProvider"></param> |
55 | public GetAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider) | 55 | public GetAssetStreamHandler(OpenAsset_Main assetManager, IAssetProviderPlugin assetProvider) |
56 | : base("GET", "/assets") | 56 | : base("GET", "/assets") |
57 | { | 57 | { |
58 | m_log.Info("[REST]: In Get Request"); | 58 | m_log.Info("[REST]: In Get Request"); |
@@ -121,7 +121,7 @@ namespace OpenSim.Grid.AssetServer | |||
121 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 121 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
122 | 122 | ||
123 | // private OpenAsset_Main m_assetManager; | 123 | // private OpenAsset_Main m_assetManager; |
124 | private IAssetProvider m_assetProvider; | 124 | private IAssetProviderPlugin m_assetProvider; |
125 | 125 | ||
126 | public override byte[] Handle(string path, Stream request, | 126 | public override byte[] Handle(string path, Stream request, |
127 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 127 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
@@ -142,7 +142,7 @@ namespace OpenSim.Grid.AssetServer | |||
142 | return new byte[] {}; | 142 | return new byte[] {}; |
143 | } | 143 | } |
144 | 144 | ||
145 | public PostAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider) | 145 | public PostAssetStreamHandler(OpenAsset_Main assetManager, IAssetProviderPlugin assetProvider) |
146 | : base("POST", "/assets") | 146 | : base("POST", "/assets") |
147 | { | 147 | { |
148 | // m_assetManager = assetManager; | 148 | // m_assetManager = assetManager; |
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index 98e670f..3101a38 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs | |||
@@ -67,13 +67,10 @@ namespace OpenSim.Grid.GridServer | |||
67 | PluginLoader<ILogDataPlugin> logloader = | 67 | PluginLoader<ILogDataPlugin> logloader = |
68 | new PluginLoader<ILogDataPlugin> (new LogDataInitialiser (connect)); | 68 | new PluginLoader<ILogDataPlugin> (new LogDataInitialiser (connect)); |
69 | 69 | ||
70 | gridloader.AddExtensionPoint ("/OpenSim/GridData"); | ||
71 | logloader.AddExtensionPoint ("/OpenSim/LogData"); | ||
72 | |||
73 | // loader will try to load all providers (MySQL, MSSQL, etc) | 70 | // loader will try to load all providers (MySQL, MSSQL, etc) |
74 | // unless it is constrainted to the correct "Provider" entry in the addin.xml | 71 | // unless it is constrainted to the correct "Provider" entry in the addin.xml |
75 | gridloader.AddFilter ("/OpenSim/GridData", new PluginProviderFilter (provider)); | 72 | gridloader.Add ("/OpenSim/GridData", new PluginProviderFilter (provider)); |
76 | logloader.AddFilter ("/OpenSim/LogData", new PluginProviderFilter (provider)); | 73 | logloader.Add ("/OpenSim/LogData", new PluginProviderFilter (provider)); |
77 | 74 | ||
78 | gridloader.Load(); | 75 | gridloader.Load(); |
79 | logloader.Load(); | 76 | logloader.Load(); |
diff --git a/OpenSim/Tests/Inventory/TestInventory.cs b/OpenSim/Tests/Inventory/TestInventory.cs index 3083c89..7863904 100644 --- a/OpenSim/Tests/Inventory/TestInventory.cs +++ b/OpenSim/Tests/Inventory/TestInventory.cs | |||
@@ -42,7 +42,7 @@ namespace OpenSim.Test.Inventory | |||
42 | [TestFixture] | 42 | [TestFixture] |
43 | public class TestInventory | 43 | public class TestInventory |
44 | { | 44 | { |
45 | IInventoryData _dbPlugin; | 45 | IInventoryDataPlugin _dbPlugin; |
46 | LLUUID _agent_1_id; | 46 | LLUUID _agent_1_id; |
47 | public static LLUUID LibraryFolderRootUuid = new LLUUID("5926de2a-c2d7-4c11-ac4e-74512ffeb6d1"); | 47 | public static LLUUID LibraryFolderRootUuid = new LLUUID("5926de2a-c2d7-4c11-ac4e-74512ffeb6d1"); |
48 | 48 | ||