aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/AssetInventoryConfig.cs146
-rw-r--r--OpenSim/Framework/PluginLoader.cs48
2 files changed, 193 insertions, 1 deletions
diff --git a/OpenSim/Framework/AssetInventoryConfig.cs b/OpenSim/Framework/AssetInventoryConfig.cs
new file mode 100644
index 0000000..9277b5e
--- /dev/null
+++ b/OpenSim/Framework/AssetInventoryConfig.cs
@@ -0,0 +1,146 @@
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;
29
30namespace OpenSim.Framework
31{
32 /// <summary>
33 /// AssetInventoryConfig -- For AssetInventory Server Configuration
34 /// </summary>
35 public class AssetInventoryConfig
36 {
37 private ConfigurationMember configMember;
38
39 public const uint DefaultHttpPort = 8003;
40 public uint HttpPort = DefaultHttpPort;
41
42 public string AssetStorageProvider = "OpenSimAssetStorage";
43 public string AssetDatabaseConnect = String.Empty;
44 public string InventoryStorageProvider = "OpenSimInventoryStorage";
45 public string InventoryDatabaseConnect = String.Empty;
46
47 public string AuthenticationProvider = "NullAuthentication";
48 public string AuthorizationProvider = "AuthorizeAll";
49 public string MetricsProvider = "NullMetrics";
50 public string Frontends = "OpenSimAssetFrontend,OpenSimInventoryFrontend";
51
52 public AssetInventoryConfig(string description, string filename)
53 {
54 configMember = new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
55 configMember.performConfigurationRetrieve();
56 }
57
58 public void loadConfigurationOptions()
59 {
60 configMember.addConfigurationOption("listen_port",
61 ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
62 "HTTP listener port",
63 DefaultHttpPort.ToString(),
64 false);
65
66 configMember.addConfigurationOption("asset_storage_provider",
67 ConfigurationOption.ConfigurationTypes.TYPE_STRING,
68 "Asset storage provider",
69 AssetStorageProvider,
70 false);
71 configMember.addConfigurationOption("asset_database_connect",
72 ConfigurationOption.ConfigurationTypes.TYPE_STRING,
73 "Asset database connection string",
74 AssetDatabaseConnect,
75 false);
76 configMember.addConfigurationOption("inventory_storage_provider",
77 ConfigurationOption.ConfigurationTypes.TYPE_STRING,
78 "Inventory storage provider",
79 InventoryStorageProvider,
80 false);
81 configMember.addConfigurationOption("inventory_database_connect",
82 ConfigurationOption.ConfigurationTypes.TYPE_STRING,
83 "Inventory database connection string",
84 InventoryDatabaseConnect,
85 false);
86
87 configMember.addConfigurationOption("authentication_provider",
88 ConfigurationOption.ConfigurationTypes.TYPE_STRING,
89 "Authentication provider",
90 AuthenticationProvider,
91 false);
92 configMember.addConfigurationOption("authorization_provider",
93 ConfigurationOption.ConfigurationTypes.TYPE_STRING,
94 "Authentication provider",
95 AuthorizationProvider,
96 false);
97 configMember.addConfigurationOption("metrics_provider",
98 ConfigurationOption.ConfigurationTypes.TYPE_STRING,
99 "Metrics provider",
100 MetricsProvider,
101 false);
102 configMember.addConfigurationOption("frontends",
103 ConfigurationOption.ConfigurationTypes.TYPE_STRING,
104 "Comma-separated list of frontends",
105 Frontends,
106 false);
107
108 }
109
110 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
111 {
112 switch (configuration_key)
113 {
114 case "listen_port":
115 HttpPort = (uint) configuration_result;
116 break;
117 case "asset_storage_provider":
118 AssetStorageProvider = (string) configuration_result;
119 break;
120 case "asset_database_connect":
121 AssetDatabaseConnect = (string) configuration_result;
122 break;
123 case "inventory_storage_provider":
124 InventoryStorageProvider = (string) configuration_result;
125 break;
126 case "inventory_database_connect":
127 InventoryDatabaseConnect = (string) configuration_result;
128 break;
129 case "authentication_provider":
130 AuthenticationProvider = (string) configuration_result;
131 break;
132 case "authorization_provider":
133 AuthorizationProvider = (string) configuration_result;
134 break;
135 case "metrics_provider":
136 MetricsProvider = (string) configuration_result;
137 break;
138 case "frontends":
139 Frontends = (string) configuration_result;
140 break;
141 }
142
143 return true;
144 }
145 }
146}
diff --git a/OpenSim/Framework/PluginLoader.cs b/OpenSim/Framework/PluginLoader.cs
index 15e0b9f..b586fe3 100644
--- a/OpenSim/Framework/PluginLoader.cs
+++ b/OpenSim/Framework/PluginLoader.cs
@@ -278,6 +278,9 @@ namespace OpenSim.Framework
278 public class PluginExtensionNode : ExtensionNode 278 public class PluginExtensionNode : ExtensionNode
279 { 279 {
280 [NodeAttribute] 280 [NodeAttribute]
281 string id = "";
282
283 [NodeAttribute]
281 string provider = ""; 284 string provider = "";
282 285
283 [NodeAttribute] 286 [NodeAttribute]
@@ -285,6 +288,7 @@ namespace OpenSim.Framework
285 288
286 Type typeobj; 289 Type typeobj;
287 290
291 public string ID { get { return id; } }
288 public string Provider { get { return provider; } } 292 public string Provider { get { return provider; } }
289 public string TypeName { get { return type; } } 293 public string TypeName { get { return type; } }
290 294
@@ -349,7 +353,7 @@ namespace OpenSim.Framework
349 } 353 }
350 354
351 /// <summary> 355 /// <summary>
352 /// Filters out which plugin to load based on its the plugin name or names given. Plugin names are contained in 356 /// Filters out which plugin to load based on the plugin name or names given. Plugin names are contained in
353 /// their addin.xml 357 /// their addin.xml
354 /// </summary> 358 /// </summary>
355 public class PluginProviderFilter : IPluginFilter 359 public class PluginProviderFilter : IPluginFilter
@@ -390,4 +394,46 @@ namespace OpenSim.Framework
390 return false; 394 return false;
391 } 395 }
392 } 396 }
397
398 /// <summary>
399 /// Filters plugins according to their ID. Plugin IDs are contained in their addin.xml
400 /// </summary>
401 public class PluginIdFilter : IPluginFilter
402 {
403 private string[] m_filters;
404
405 /// <summary>
406 /// Constructor.
407 /// </summary>
408 /// <param name="p">
409 /// Plugin ID or IDs on which to filter. Multiple names should be separated by commas.
410 /// </param>
411 public PluginIdFilter(string p)
412 {
413 m_filters = p.Split(',');
414
415 for (int i = 0; i < m_filters.Length; i++)
416 {
417 m_filters[i] = m_filters[i].Trim();
418 }
419 }
420
421 /// <summary>
422 /// Apply this filter to <paramref name="plugin" />.
423 /// </summary>
424 /// <param name="plugin">PluginExtensionNode instance to check whether it passes the filter.</param>
425 /// <returns>true if the plugin's ID matches one of the filters, false otherwise.</returns>
426 public bool Apply (PluginExtensionNode plugin)
427 {
428 for (int i = 0; i < m_filters.Length; i++)
429 {
430 if (m_filters[i] == plugin.ID)
431 {
432 return true;
433 }
434 }
435
436 return false;
437 }
438 }
393} 439}