aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/DataPluginFactory.cs141
-rw-r--r--OpenSim/Framework/Communications/InventoryServiceBase.cs20
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs21
-rw-r--r--OpenSim/Grid/AssetServer/Main.cs15
-rw-r--r--OpenSim/Grid/GridServer/GridManager.cs43
-rw-r--r--bin/OpenSim.Data.addin.xml19
6 files changed, 185 insertions, 74 deletions
diff --git a/OpenSim/Data/DataPluginFactory.cs b/OpenSim/Data/DataPluginFactory.cs
new file mode 100644
index 0000000..5293e94
--- /dev/null
+++ b/OpenSim/Data/DataPluginFactory.cs
@@ -0,0 +1,141 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Collections.Generic;
29using OpenSim.Framework;
30
31namespace OpenSim.Data
32{
33 /// <summary>
34 /// A static class containing a series of methods for obtaining handles to
35 /// database storage objects.
36 /// </summary>
37 // Yeah, it's not really a factory, but maybe it'll morph into one?
38 public static class DataPluginFactory
39 {
40 /// <summary>
41 /// Returns a list of new inventory data plugins. Plugins will be
42 /// requested in the order they were added.
43 /// </summary>
44 /// <param name="provider">
45 /// The filename of the inventory server plugin DLL.
46 /// </param>
47 /// <param name="connect">
48 /// The connection string for the storage backend.
49 /// </param>
50 public static List<IInventoryDataPlugin> LoadInventoryDataPlugins(string provider, string connect)
51 {
52 PluginLoader<IInventoryDataPlugin> loader = new PluginLoader<IInventoryDataPlugin> (new InventoryDataInitialiser(connect));
53
54 // loader will try to load all providers (MySQL, MSSQL, etc)
55 // unless it is constrainted to the correct "Provider" entry in the addin.xml
56 loader.Add ("/OpenSim/InventoryData", new PluginProviderFilter(provider));
57 loader.Load();
58
59 return loader.Plugins;
60 }
61
62 /// <summary>
63 /// Returns a list of new user data plugins. Plugins will be requested
64 /// in the order they were added.
65 /// </summary>
66 /// <param name="provider">
67 /// The filename of the user data plugin DLL.
68 /// </param>
69 /// <param name="connect">
70 /// The connection string for the storage backend.
71 /// </param>
72 public static List<IUserDataPlugin> LoadUserDataPlugins(string provider, string connect)
73 {
74 PluginLoader<IUserDataPlugin> loader = new PluginLoader<IUserDataPlugin>(new UserDataInitialiser(connect));
75
76 // loader will try to load all providers (MySQL, MSSQL, etc)
77 // unless it is constrainted to the correct "Provider" entry in the addin.xml
78 loader.Add("/OpenSim/UserData", new PluginProviderFilter(provider));
79 loader.Load();
80
81 return loader.Plugins;
82 }
83
84 /// <summary>
85 /// Returns a list of new grid data plugins. Plugins will be requested
86 /// in the order they were added.
87 /// </summary>
88 /// <param name="provider">
89 /// The filename of the user data plugin DLL.
90 /// </param>
91 /// <param name="connect">
92 /// The connection string for the storage backend.
93 /// </param>
94 public static List<IGridDataPlugin> LoadGridDataPlugins(string provider, string connect)
95 {
96 PluginLoader<IGridDataPlugin> loader = new PluginLoader<IGridDataPlugin>(new GridDataInitialiser(connect));
97
98 // loader will try to load all providers (MySQL, MSSQL, etc)
99 // unless it is constrainted to the correct "Provider" entry in the addin.xml
100 loader.Add("/OpenSim/GridData", new PluginProviderFilter(provider));
101 loader.Load();
102
103 return loader.Plugins;
104 }
105
106 /// <summary>
107 /// Returns a list of new log data plugins. Plugins will be requested
108 /// in the order they were added.
109 /// </summary>
110 /// <param name="provider">
111 /// The filename of the user data plugin DLL.
112 /// </param>
113 /// <param name="connect">
114 /// The connection string for the storage backend.
115 /// </param>
116 public static List<ILogDataPlugin> LoadLogDataPlugins(string provider, string connect)
117 {
118 PluginLoader<ILogDataPlugin> loader = new PluginLoader<ILogDataPlugin>(new LogDataInitialiser(connect));
119
120 // loader will try to load all providers (MySQL, MSSQL, etc)
121 // unless it is constrainted to the correct "Provider" entry in the addin.xml
122 loader.Add("/OpenSim/LogData", new PluginProviderFilter(provider));
123 loader.Load();
124
125 return loader.Plugins;
126 }
127
128 public static IAssetDataPlugin LoadAssetDataPlugin(string provider, string connect)
129 {
130 PluginLoader<IAssetDataPlugin> loader = new PluginLoader<IAssetDataPlugin> (new AssetDataInitialiser (connect));
131
132 // loader will try to load all providers (MySQL, MSSQL, etc)
133 // unless it is constrainted to the correct "Provider" entry in the addin.xml
134 loader.Add ("/OpenSim/AssetData", new PluginProviderFilter (provider));
135 loader.Load();
136
137 return loader.Plugin;
138 }
139
140 }
141}
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs
index ec5c493..a031bdf 100644
--- a/OpenSim/Framework/Communications/InventoryServiceBase.cs
+++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs
@@ -59,20 +59,18 @@ namespace OpenSim.Framework.Communications
59 } 59 }
60 60
61 /// <summary> 61 /// <summary>
62 /// Adds a new inventory data plugin - plugins will be requested in the order they were loaded. 62 /// Adds a list of inventory data plugins, as described by `provider'
63 /// and `connect', to `m_plugins'.
63 /// </summary> 64 /// </summary>
64 /// <param name="provider">The filename of the inventory server plugin DLL</param> 65 /// <param name="provider">
66 /// The filename of the inventory server plugin DLL.
67 /// </param>
68 /// <param name="connect">
69 /// The connection string for the storage backend.
70 /// </param>
65 public void AddPlugin(string provider, string connect) 71 public void AddPlugin(string provider, string connect)
66 { 72 {
67 PluginLoader<IInventoryDataPlugin> loader = 73 m_plugins.AddRange(DataPluginFactory.LoadInventoryDataPlugins(provider, connect));
68 new PluginLoader<IInventoryDataPlugin> (new InventoryDataInitialiser(connect));
69
70 // loader will try to load all providers (MySQL, MSSQL, etc)
71 // unless it is constrainted to the correct "Provider" entry in the addin.xml
72 loader.Add ("/OpenSim/InventoryData", new PluginProviderFilter(provider));
73 loader.Load();
74
75 m_plugins.AddRange(loader.Plugins);
76 } 74 }
77 75
78 #endregion 76 #endregion
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index b12abb3..886900d 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -74,21 +74,18 @@ namespace OpenSim.Framework.Communications
74 } 74 }
75 75
76 /// <summary> 76 /// <summary>
77 /// Add a new user data plugin - plugins will be requested in the order they were added. 77 /// Adds a list of user data plugins, as described by `provider' and
78 /// `connect', to `_plugins'.
78 /// </summary> 79 /// </summary>
79 /// <param name="provider">The filename to the user data plugin DLL</param> 80 /// <param name="provider">
80 /// <param name="connect"></param> 81 /// The filename of the inventory server plugin DLL.
82 /// </param>
83 /// <param name="connect">
84 /// The connection string for the storage backend.
85 /// </param>
81 public void AddPlugin(string provider, string connect) 86 public void AddPlugin(string provider, string connect)
82 { 87 {
83 PluginLoader<IUserDataPlugin> loader = 88 _plugins.AddRange(DataPluginFactory.LoadUserDataPlugins(provider, connect));
84 new PluginLoader<IUserDataPlugin>(new UserDataInitialiser(connect));
85
86 // loader will try to load all providers (MySQL, MSSQL, etc)
87 // unless it is constrainted to the correct "Provider" entry in the addin.xml
88 loader.Add("/OpenSim/UserData", new PluginProviderFilter(provider));
89 loader.Load();
90
91 _plugins.AddRange(loader.Plugins);
92 } 89 }
93 90
94 #region Get UserProfile 91 #region Get UserProfile
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs
index 07fe0a4..060c473 100644
--- a/OpenSim/Grid/AssetServer/Main.cs
+++ b/OpenSim/Grid/AssetServer/Main.cs
@@ -112,24 +112,11 @@ namespace OpenSim.Grid.AssetServer
112 return null; 112 return null;
113 } 113 }
114 114
115 public IAssetDataPlugin LoadDatabasePlugin(string provider, string connect)
116 {
117 PluginLoader<IAssetDataPlugin> loader =
118 new PluginLoader<IAssetDataPlugin> (new AssetDataInitialiser (connect));
119
120 // loader will try to load all providers (MySQL, MSSQL, etc)
121 // unless it is constrainted to the correct "Provider" entry in the addin.xml
122 loader.Add ("/OpenSim/AssetData", new PluginProviderFilter (provider));
123 loader.Load();
124
125 return loader.Plugin;
126 }
127
128 public void setupDB(AssetConfig config) 115 public void setupDB(AssetConfig config)
129 { 116 {
130 try 117 try
131 { 118 {
132 m_assetProvider = LoadDatabasePlugin(config.DatabaseProvider, config.DatabaseConnect); 119 m_assetProvider = DataPluginFactory.LoadAssetDataPlugin(config.DatabaseProvider, config.DatabaseConnect);
133 if (m_assetProvider == null) 120 if (m_assetProvider == null)
134 { 121 {
135 m_log.Error("[ASSET]: Failed to load a database plugin, server halting"); 122 m_log.Error("[ASSET]: Failed to load a database plugin, server halting");
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index daee729..3fc0393 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -53,12 +53,12 @@ namespace OpenSim.Grid.GridServer
53 private List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>(); 53 private List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>();
54 54
55 public GridConfig Config; 55 public GridConfig Config;
56 56
57 /// <value> 57 /// <value>
58 /// Used to notify old regions as to which OpenSim version to upgrade to 58 /// Used to notify old regions as to which OpenSim version to upgrade to
59 /// </value> 59 /// </value>
60 private string m_opensimVersion; 60 private string m_opensimVersion;
61 61
62 /// <summary> 62 /// <summary>
63 /// Constructor 63 /// Constructor
64 /// </summary> 64 /// </summary>
@@ -71,27 +71,20 @@ namespace OpenSim.Grid.GridServer
71 } 71 }
72 72
73 /// <summary> 73 /// <summary>
74 /// Adds a new grid server plugin - grid servers will be requested in the order they were loaded. 74 /// Adds a list of grid and log data plugins, as described by
75 /// `provider' and `connect', to `_plugins' and `_logplugins',
76 /// respectively.
75 /// </summary> 77 /// </summary>
76 /// <param name="provider">The name of the grid server plugin DLL</param> 78 /// <param name="provider">
79 /// The filename of the inventory server plugin DLL.
80 /// </param>
81 /// <param name="connect">
82 /// The connection string for the storage backend.
83 /// </param>
77 public void AddPlugin(string provider, string connect) 84 public void AddPlugin(string provider, string connect)
78 { 85 {
79 PluginLoader<IGridDataPlugin> gridloader = 86 _plugins = DataPluginFactory.LoadGridDataPlugins(provider, connect);
80 new PluginLoader<IGridDataPlugin> (new GridDataInitialiser (connect)); 87 _logplugins = DataPluginFactory.LoadLogDataPlugins(provider, connect);
81
82 PluginLoader<ILogDataPlugin> logloader =
83 new PluginLoader<ILogDataPlugin> (new LogDataInitialiser (connect));
84
85 // loader will try to load all providers (MySQL, MSSQL, etc)
86 // unless it is constrainted to the correct "Provider" entry in the addin.xml
87 gridloader.Add ("/OpenSim/GridData", new PluginProviderFilter (provider));
88 logloader.Add ("/OpenSim/LogData", new PluginProviderFilter (provider));
89
90 gridloader.Load();
91 logloader.Load();
92
93 _plugins = gridloader.Plugins;
94 _logplugins = logloader.Plugins;
95 } 88 }
96 89
97 /// <summary> 90 /// <summary>
@@ -389,8 +382,8 @@ namespace OpenSim.Grid.GridServer
389 m_log.Debug("[LOGIN PRELUDE]: Invalid login parameters, sending back error response."); 382 m_log.Debug("[LOGIN PRELUDE]: Invalid login parameters, sending back error response.");
390 return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString()); 383 return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString());
391 } 384 }
392 385
393 m_log.InfoFormat("[LOGIN BEGIN]: Received login request from simulator: {0}", sim.regionName); 386 m_log.InfoFormat("[LOGIN BEGIN]: Received login request from simulator: {0}", sim.regionName);
394 387
395 if (!Config.AllowRegionRegistration) 388 if (!Config.AllowRegionRegistration)
396 { 389 {
@@ -399,12 +392,12 @@ namespace OpenSim.Grid.GridServer
399 sim.regionName); 392 sim.regionName);
400 393
401 return ErrorResponse("This grid is currently not accepting region registrations."); 394 return ErrorResponse("This grid is currently not accepting region registrations.");
402 } 395 }
403 396
404 int majorInterfaceVersion = 0; 397 int majorInterfaceVersion = 0;
405 if (requestData.ContainsKey("major_interface_version")) 398 if (requestData.ContainsKey("major_interface_version"))
406 int.TryParse((string)requestData["major_interface_version"], out majorInterfaceVersion); 399 int.TryParse((string)requestData["major_interface_version"], out majorInterfaceVersion);
407 400
408 if (majorInterfaceVersion != VersionInfo.MajorInterfaceVersion) 401 if (majorInterfaceVersion != VersionInfo.MajorInterfaceVersion)
409 { 402 {
410 return ErrorResponse( 403 return ErrorResponse(
diff --git a/bin/OpenSim.Data.addin.xml b/bin/OpenSim.Data.addin.xml
index 2a3db5f..65774ff 100644
--- a/bin/OpenSim.Data.addin.xml
+++ b/bin/OpenSim.Data.addin.xml
@@ -1,26 +1,21 @@
1<Addin id="OpenSim.Data" isroot="true" version="0.5"> 1<Addin id="OpenSim.Data" isroot="true" version="0.5">
2 <Runtime> 2 <Runtime>
3 <Import assembly="OpenSim.Grid.UserServer.exe"/> 3 <Import assembly="OpenSim.Data.dll" />
4 <Import assembly="OpenSim.Grid.GridServer.exe"/> 4 <Import assembly="OpenSim.Framework.dll" />
5 <Import assembly="OpenSim.Grid.AssetServer.exe"/>
6 <Import assembly="OpenSim.Grid.InventoryServer.exe"/>
7 <Import assembly="OpenSim.Grid.MessagingServer.exe"/>
8 <Import assembly="OpenSim.Data.dll"/>
9 <Import assembly="OpenSim.Framework.dll"/>
10 </Runtime> 5 </Runtime>
11 <ExtensionPoint path = "/OpenSim/GridData"> 6 <ExtensionPoint path = "/OpenSim/GridData">
12 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IGridDataPlugin"/> 7 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IGridDataPlugin" />
13 </ExtensionPoint> 8 </ExtensionPoint>
14 <ExtensionPoint path = "/OpenSim/LogData"> 9 <ExtensionPoint path = "/OpenSim/LogData">
15 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.ILogDataPlugin"/> 10 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.ILogDataPlugin" />
16 </ExtensionPoint> 11 </ExtensionPoint>
17 <ExtensionPoint path = "/OpenSim/AssetData"> 12 <ExtensionPoint path = "/OpenSim/AssetData">
18 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IAssetDataPlugin"/> 13 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IAssetDataPlugin" />
19 </ExtensionPoint> 14 </ExtensionPoint>
20 <ExtensionPoint path = "/OpenSim/InventoryData"> 15 <ExtensionPoint path = "/OpenSim/InventoryData">
21 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IInventoryDataPlugin"/> 16 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IInventoryDataPlugin" />
22 </ExtensionPoint> 17 </ExtensionPoint>
23 <ExtensionPoint path = "/OpenSim/UserData"> 18 <ExtensionPoint path = "/OpenSim/UserData">
24 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IUserDataPlugin"/> 19 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IUserDataPlugin" />
25 </ExtensionPoint> 20 </ExtensionPoint>
26</Addin> 21</Addin>