diff options
author | Mike Mazur | 2009-02-16 02:26:27 +0000 |
---|---|---|
committer | Mike Mazur | 2009-02-16 02:26:27 +0000 |
commit | 74a2bd237aed26b49d88045fe6afa526ed19c00d (patch) | |
tree | c72262c4343a6b95b8aa20616094e1b0fbc640a4 /OpenSim | |
parent | - added Simple AssetInventoryServer plugin (asset storage only) (diff) | |
download | opensim-SC_OLD-74a2bd237aed26b49d88045fe6afa526ed19c00d.zip opensim-SC_OLD-74a2bd237aed26b49d88045fe6afa526ed19c00d.tar.gz opensim-SC_OLD-74a2bd237aed26b49d88045fe6afa526ed19c00d.tar.bz2 opensim-SC_OLD-74a2bd237aed26b49d88045fe6afa526ed19c00d.tar.xz |
Add OpenSim & Simple inventory storage plugins and Null metrics plugin.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs | 7 | ||||
-rw-r--r-- | OpenSim/Grid/AssetInventoryServer/Interfaces.cs | 2 | ||||
-rw-r--r-- | OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs (renamed from OpenSim/Grid/AssetInventoryServer/Plugins/NullMetrics.cs) | 4 | ||||
-rw-r--r-- | OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs (renamed from OpenSim/Grid/AssetInventoryServer/Extensions/OpenSimMySQLInventory.cs) | 85 | ||||
-rw-r--r-- | OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/Resources/AssetInventoryServerOpenSimPlugins.addin.xml | 3 | ||||
-rw-r--r-- | OpenSim/Grid/AssetInventoryServer/Plugins/Resources/AssetInventoryServerPlugins.addin.xml | 2 | ||||
-rw-r--r-- | OpenSim/Grid/AssetInventoryServer/Plugins/Simple/Resources/AssetInventoryServerSimplePlugins.addin.xml | 3 | ||||
-rw-r--r-- | OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs (renamed from OpenSim/Grid/AssetInventoryServer/Extensions/SimpleInventory.cs) | 61 |
8 files changed, 115 insertions, 52 deletions
diff --git a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs b/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs index e51f559..e100377 100644 --- a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs +++ b/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs | |||
@@ -50,7 +50,7 @@ namespace OpenSim.Grid.AssetInventoryServer | |||
50 | public IniConfigSource ConfigFile; | 50 | public IniConfigSource ConfigFile; |
51 | 51 | ||
52 | public IAssetStorageProvider StorageProvider; | 52 | public IAssetStorageProvider StorageProvider; |
53 | public IInventoryProvider InventoryProvider; | 53 | public IInventoryStorageProvider InventoryProvider; |
54 | public IAuthenticationProvider AuthenticationProvider; | 54 | public IAuthenticationProvider AuthenticationProvider; |
55 | public IAuthorizationProvider AuthorizationProvider; | 55 | public IAuthorizationProvider AuthorizationProvider; |
56 | public IMetricsProvider MetricsProvider; | 56 | public IMetricsProvider MetricsProvider; |
@@ -107,7 +107,8 @@ namespace OpenSim.Grid.AssetInventoryServer | |||
107 | } | 107 | } |
108 | 108 | ||
109 | StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/StorageProvider", "OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll") as IAssetStorageProvider; | 109 | StorageProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/StorageProvider", "OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll") as IAssetStorageProvider; |
110 | MetricsProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/MetricsProvider", "") as IMetricsProvider; | 110 | InventoryProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/InventoryProvider", "OpenSim.Grid.AssetInventoryServer.Plugins.Simple.dll") as IInventoryStorageProvider; |
111 | MetricsProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/MetricsProvider", String.Empty) as IMetricsProvider; | ||
111 | 112 | ||
112 | try | 113 | try |
113 | { | 114 | { |
@@ -120,7 +121,7 @@ namespace OpenSim.Grid.AssetInventoryServer | |||
120 | return false; | 121 | return false; |
121 | } | 122 | } |
122 | 123 | ||
123 | frontend = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/Frontend", ""); | 124 | frontend = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/Frontend", String.Empty); |
124 | 125 | ||
125 | return true; | 126 | return true; |
126 | } | 127 | } |
diff --git a/OpenSim/Grid/AssetInventoryServer/Interfaces.cs b/OpenSim/Grid/AssetInventoryServer/Interfaces.cs index 870cf89..c4aa7ac 100644 --- a/OpenSim/Grid/AssetInventoryServer/Interfaces.cs +++ b/OpenSim/Grid/AssetInventoryServer/Interfaces.cs | |||
@@ -83,7 +83,7 @@ namespace OpenSim.Grid.AssetInventoryServer | |||
83 | int ForEach(Action<Metadata> action, int start, int count); | 83 | int ForEach(Action<Metadata> action, int start, int count); |
84 | } | 84 | } |
85 | 85 | ||
86 | public interface IInventoryProvider | 86 | public interface IInventoryStorageProvider : IAssetInventoryServerPlugin |
87 | { | 87 | { |
88 | BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItem item); | 88 | BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItem item); |
89 | BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolder folder); | 89 | BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolder folder); |
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetrics.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs index 86ae5cd..caa4efd 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetrics.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/NullMetricsPlugin.cs | |||
@@ -32,11 +32,11 @@ using OpenMetaverse; | |||
32 | 32 | ||
33 | namespace OpenSim.Grid.AssetInventoryServer.Plugins | 33 | namespace OpenSim.Grid.AssetInventoryServer.Plugins |
34 | { | 34 | { |
35 | public class NullMetrics : IMetricsProvider | 35 | public class NullMetricsPlugin : IMetricsProvider |
36 | { | 36 | { |
37 | AssetInventoryServer server; | 37 | AssetInventoryServer server; |
38 | 38 | ||
39 | public NullMetrics() | 39 | public NullMetricsPlugin() |
40 | { | 40 | { |
41 | } | 41 | } |
42 | 42 | ||
diff --git a/OpenSim/Grid/AssetInventoryServer/Extensions/OpenSimMySQLInventory.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs index 07bf92f..3fd06c0 100644 --- a/OpenSim/Grid/AssetInventoryServer/Extensions/OpenSimMySQLInventory.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs | |||
@@ -36,43 +36,25 @@ using ExtensionLoader; | |||
36 | using ExtensionLoader.Config; | 36 | using ExtensionLoader.Config; |
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | using OpenMetaverse.StructuredData; | 38 | using OpenMetaverse.StructuredData; |
39 | using OpenSim.Framework; | ||
40 | using OpenSim.Grid.AssetInventoryServer.Extensions; | ||
41 | using OpenSim.Data; | ||
39 | 42 | ||
40 | namespace OpenSim.Grid.AssetInventoryServer.Extensions | 43 | namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim |
41 | { | 44 | { |
42 | public class OpenSimMySQLInventory : IExtension<AssetInventoryServer>, IInventoryProvider | 45 | public class OpenSimInventoryStoragePlugin : IInventoryStorageProvider |
43 | { | 46 | { |
44 | const string EXTENSION_NAME = "OpenSimMySQLInventory"; // Used in metrics reporting | 47 | const string EXTENSION_NAME = "OpenSimInventoryStorage"; // Used in metrics reporting |
45 | 48 | ||
46 | AssetInventoryServer server; | 49 | private AssetInventoryServer server; |
50 | private IInventoryDataPlugin m_inventoryProvider; | ||
47 | 51 | ||
48 | public OpenSimMySQLInventory() | 52 | public OpenSimInventoryStoragePlugin() |
49 | { | 53 | { |
50 | } | 54 | } |
51 | 55 | ||
52 | #region Required Interfaces | 56 | #region Required Interfaces |
53 | 57 | ||
54 | public void Start(AssetInventoryServer server) | ||
55 | { | ||
56 | this.server = server; | ||
57 | |||
58 | using (MySqlConnection dbConnection = new MySqlConnection(DBConnString.GetConnectionString(server.ConfigFile))) | ||
59 | { | ||
60 | try | ||
61 | { | ||
62 | dbConnection.Open(); | ||
63 | Logger.Log.Info("Connected to MySQL inventory backend: " + dbConnection.ServerVersion); | ||
64 | } | ||
65 | catch (MySqlException ex) | ||
66 | { | ||
67 | Logger.Log.Error("Connection to MySQL inventory backend failed: " + ex.Message); | ||
68 | } | ||
69 | } | ||
70 | } | ||
71 | |||
72 | public void Stop() | ||
73 | { | ||
74 | } | ||
75 | |||
76 | public BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItem item) | 58 | public BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItem item) |
77 | { | 59 | { |
78 | item = null; | 60 | item = null; |
@@ -800,5 +782,54 @@ namespace OpenSim.Grid.AssetInventoryServer.Extensions | |||
800 | } | 782 | } |
801 | 783 | ||
802 | #endregion Required Interfaces | 784 | #endregion Required Interfaces |
785 | |||
786 | #region IPlugin implementation | ||
787 | |||
788 | public void Initialise(AssetInventoryServer server) | ||
789 | { | ||
790 | this.server = server; | ||
791 | |||
792 | try | ||
793 | { | ||
794 | m_inventoryProvider = DataPluginFactory.LoadInventoryDataPlugin("OpenSim.Data.MySQL.dll", server.ConfigFile.Configs["MySQL"].GetString("database_connect", null)); | ||
795 | if (m_inventoryProvider == null) | ||
796 | { | ||
797 | Logger.Log.Error("[INVENTORY]: Failed to load a database plugin, server halting."); | ||
798 | Environment.Exit(-1); | ||
799 | } | ||
800 | else | ||
801 | Logger.Log.InfoFormat("[INVENTORY]: Loaded storage backend: {0}", Version); | ||
802 | } | ||
803 | catch (Exception e) | ||
804 | { | ||
805 | Logger.Log.WarnFormat("[INVENTORY]: Failure loading data plugin: {0}", e.ToString()); | ||
806 | } | ||
807 | } | ||
808 | |||
809 | public void Stop() | ||
810 | { | ||
811 | } | ||
812 | |||
813 | public void Initialise() | ||
814 | { | ||
815 | Logger.Log.InfoFormat("[INVENTORY]: {0} cannot be default-initialized!", Name); | ||
816 | throw new PluginNotInitialisedException(Name); | ||
817 | } | ||
818 | |||
819 | public void Dispose() | ||
820 | { | ||
821 | } | ||
822 | |||
823 | public string Version | ||
824 | { | ||
825 | get { return m_inventoryProvider.Version; } | ||
826 | } | ||
827 | |||
828 | public string Name | ||
829 | { | ||
830 | get { return "AssetInventoryServer OpenSim inventory storage provider"; } | ||
831 | } | ||
832 | |||
833 | #endregion IPlugin implementation | ||
803 | } | 834 | } |
804 | } | 835 | } |
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/Resources/AssetInventoryServerOpenSimPlugins.addin.xml b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/Resources/AssetInventoryServerOpenSimPlugins.addin.xml index f458909..6d21327 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/Resources/AssetInventoryServerOpenSimPlugins.addin.xml +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/Resources/AssetInventoryServerOpenSimPlugins.addin.xml | |||
@@ -15,6 +15,9 @@ | |||
15 | <Extension path="/OpenSim/AssetInventoryServer/StorageProvider"> | 15 | <Extension path="/OpenSim/AssetInventoryServer/StorageProvider"> |
16 | <Plugin id="OpenSimAssetStorage" provider="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.OpenSimAssetStoragePlugin" /> | 16 | <Plugin id="OpenSimAssetStorage" provider="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.OpenSimAssetStoragePlugin" /> |
17 | </Extension> | 17 | </Extension> |
18 | <Extension path="/OpenSim/AssetInventoryServer/InventoryProvider"> | ||
19 | <Plugin id="OpenSimInventoryStorage" provider="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.OpenSimInventoryStoragePlugin" /> | ||
20 | </Extension> | ||
18 | <Extension path="/OpenSim/AssetInventoryServer/Frontend"> | 21 | <Extension path="/OpenSim/AssetInventoryServer/Frontend"> |
19 | <Plugin id="OpenSimAssetFrontend" provider="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.OpenSimAssetFrontendPlugin" /> | 22 | <Plugin id="OpenSimAssetFrontend" provider="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim.OpenSimAssetFrontendPlugin" /> |
20 | </Extension> | 23 | </Extension> |
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/Resources/AssetInventoryServerPlugins.addin.xml b/OpenSim/Grid/AssetInventoryServer/Plugins/Resources/AssetInventoryServerPlugins.addin.xml index bca7ee1..089c6a2 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/Resources/AssetInventoryServerPlugins.addin.xml +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/Resources/AssetInventoryServerPlugins.addin.xml | |||
@@ -8,6 +8,6 @@ | |||
8 | </Dependencies> | 8 | </Dependencies> |
9 | 9 | ||
10 | <Extension path="/OpenSim/AssetInventoryServer/MetricsProvider"> | 10 | <Extension path="/OpenSim/AssetInventoryServer/MetricsProvider"> |
11 | <Plugin id="OpenSimMetrics" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.NullMetrics" /> | 11 | <Plugin id="AssetInventoryMetrics" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.NullMetricsPlugin" /> |
12 | </Extension> | 12 | </Extension> |
13 | </Addin> | 13 | </Addin> |
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/Resources/AssetInventoryServerSimplePlugins.addin.xml b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/Resources/AssetInventoryServerSimplePlugins.addin.xml index 53534c4..f898145 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/Resources/AssetInventoryServerSimplePlugins.addin.xml +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/Resources/AssetInventoryServerSimplePlugins.addin.xml | |||
@@ -10,4 +10,7 @@ | |||
10 | <Extension path="/OpenSim/AssetInventoryServer/StorageProvider"> | 10 | <Extension path="/OpenSim/AssetInventoryServer/StorageProvider"> |
11 | <Plugin id="SimpleAssetStorage" provider="OpenSim.Grid.AssetInventoryServer.Plugins.Simple.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.Simple.SimpleAssetStoragePlugin" /> | 11 | <Plugin id="SimpleAssetStorage" provider="OpenSim.Grid.AssetInventoryServer.Plugins.Simple.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.Simple.SimpleAssetStoragePlugin" /> |
12 | </Extension> | 12 | </Extension> |
13 | <Extension path="/OpenSim/AssetInventoryServer/InventoryProvider"> | ||
14 | <Plugin id="SimpleInventoryStorage" provider="OpenSim.Grid.AssetInventoryServer.Plugins.Simple.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.Simple.SimpleInventoryStoragePlugin" /> | ||
15 | </Extension> | ||
13 | </Addin> | 16 | </Addin> |
diff --git a/OpenSim/Grid/AssetInventoryServer/Extensions/SimpleInventory.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs index c140965..78dae35 100644 --- a/OpenSim/Grid/AssetInventoryServer/Extensions/SimpleInventory.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs | |||
@@ -35,12 +35,13 @@ using System.Text; | |||
35 | using ExtensionLoader; | 35 | using ExtensionLoader; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using OpenMetaverse.StructuredData; | 37 | using OpenMetaverse.StructuredData; |
38 | using OpenSim.Framework; | ||
38 | 39 | ||
39 | namespace OpenSim.Grid.AssetInventoryServer.Extensions | 40 | namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple |
40 | { | 41 | { |
41 | public class SimpleInventory : IExtension<AssetInventoryServer>, IInventoryProvider | 42 | public class SimpleInventoryStoragePlugin : IInventoryStorageProvider |
42 | { | 43 | { |
43 | const string EXTENSION_NAME = "SimpleInventory"; // Used for metrics reporting | 44 | const string EXTENSION_NAME = "SimpleInventoryStorage"; // Used for metrics reporting |
44 | const string DEFAULT_INVENTORY_DIR = "SimpleInventory"; | 45 | const string DEFAULT_INVENTORY_DIR = "SimpleInventory"; |
45 | 46 | ||
46 | AssetInventoryServer server; | 47 | AssetInventoryServer server; |
@@ -49,26 +50,12 @@ namespace OpenSim.Grid.AssetInventoryServer.Extensions | |||
49 | Utils.InventoryItemSerializer itemSerializer = new Utils.InventoryItemSerializer(); | 50 | Utils.InventoryItemSerializer itemSerializer = new Utils.InventoryItemSerializer(); |
50 | Utils.InventoryFolderSerializer folderSerializer = new Utils.InventoryFolderSerializer(); | 51 | Utils.InventoryFolderSerializer folderSerializer = new Utils.InventoryFolderSerializer(); |
51 | 52 | ||
52 | public SimpleInventory() | 53 | public SimpleInventoryStoragePlugin() |
53 | { | 54 | { |
54 | } | 55 | } |
55 | 56 | ||
56 | #region Required Interfaces | 57 | #region Required Interfaces |
57 | 58 | ||
58 | public void Start(AssetInventoryServer server) | ||
59 | { | ||
60 | this.server = server; | ||
61 | |||
62 | LoadFiles(DEFAULT_INVENTORY_DIR); | ||
63 | |||
64 | Logger.Log.InfoFormat("Initialized the inventory index with data for {0} avatars", | ||
65 | inventories.Count); | ||
66 | } | ||
67 | |||
68 | public void Stop() | ||
69 | { | ||
70 | } | ||
71 | |||
72 | public BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItem item) | 59 | public BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItem item) |
73 | { | 60 | { |
74 | item = null; | 61 | item = null; |
@@ -598,5 +585,43 @@ namespace OpenSim.Grid.AssetInventoryServer.Extensions | |||
598 | Logger.Log.ErrorFormat("Failed loading inventory from {0}: {1}", folder, ex.Message); | 585 | Logger.Log.ErrorFormat("Failed loading inventory from {0}: {1}", folder, ex.Message); |
599 | } | 586 | } |
600 | } | 587 | } |
588 | |||
589 | #region IPlugin implementation | ||
590 | |||
591 | public void Initialise(AssetInventoryServer server) | ||
592 | { | ||
593 | this.server = server; | ||
594 | |||
595 | LoadFiles(DEFAULT_INVENTORY_DIR); | ||
596 | |||
597 | Logger.Log.InfoFormat("Initialized the inventory index with data for {0} avatars", | ||
598 | inventories.Count); | ||
599 | } | ||
600 | |||
601 | /// <summary> | ||
602 | /// <para>Initialises asset interface</para> | ||
603 | /// </summary> | ||
604 | public void Initialise() | ||
605 | { | ||
606 | Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name); | ||
607 | throw new PluginNotInitialisedException(Name); | ||
608 | } | ||
609 | |||
610 | public void Dispose() | ||
611 | { | ||
612 | } | ||
613 | |||
614 | public string Version | ||
615 | { | ||
616 | // TODO: this should be something meaningful and not hardcoded? | ||
617 | get { return "0.1"; } | ||
618 | } | ||
619 | |||
620 | public string Name | ||
621 | { | ||
622 | get { return "AssetInventoryServer Simple inventory storage provider"; } | ||
623 | } | ||
624 | |||
625 | #endregion IPlugin implementation | ||
601 | } | 626 | } |
602 | } | 627 | } |