Added a different/better way of specifying data services in DataSnapshot -- using DATA_SRV_ keys, one per service. This allows 3rd party modules to add data services automatically.
parent
8e562f04d1
commit
46ab59723d
|
@ -29,8 +29,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
|
@ -131,9 +133,12 @@ namespace OpenSim.Region.DataSnapshot
|
|||
m_period = config.Configs["DataSnapshot"].GetInt("default_snapshot_period", m_period);
|
||||
m_maxStales = config.Configs["DataSnapshot"].GetInt("max_changes_before_update", m_maxStales);
|
||||
m_snapsDir = config.Configs["DataSnapshot"].GetString("snapshot_cache_directory", m_snapsDir);
|
||||
m_dataServices = config.Configs["DataSnapshot"].GetString("data_services", m_dataServices);
|
||||
m_listener_port = config.Configs["Network"].GetString("http_listener_port", m_listener_port);
|
||||
|
||||
m_dataServices = config.Configs["DataSnapshot"].GetString("data_services", m_dataServices);
|
||||
// New way of spec'ing data services, one per line
|
||||
AddDataServicesVars(config.Configs["DataSnapshot"]);
|
||||
|
||||
String[] annoying_string_array = config.Configs["DataSnapshot"].GetString("disable_modules", "").Split(".".ToCharArray());
|
||||
foreach (String bloody_wanker in annoying_string_array)
|
||||
{
|
||||
|
@ -289,6 +294,28 @@ namespace OpenSim.Region.DataSnapshot
|
|||
return null;
|
||||
}
|
||||
|
||||
private void AddDataServicesVars(IConfig config)
|
||||
{
|
||||
// Make sure the services given this way aren't in m_dataServices already
|
||||
List<string> servs = new List<string>(m_dataServices.Split(new char[] { ';' }));
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
string[] keys = config.GetKeys();
|
||||
|
||||
if (keys.Length > 0)
|
||||
{
|
||||
IEnumerable<string> serviceKeys = keys.Where(value => value.StartsWith("DATA_SRV_"));
|
||||
foreach (string serviceKey in serviceKeys)
|
||||
{
|
||||
string keyValue = config.GetString(serviceKey, string.Empty).Trim();
|
||||
if (!servs.Contains(keyValue))
|
||||
sb.Append(keyValue).Append(";");
|
||||
}
|
||||
}
|
||||
|
||||
m_dataServices = (m_dataServices == "noservices") ? sb.ToString() : sb.Append(m_dataServices).ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region [Public] Snapshot storage functions
|
||||
|
|
|
@ -797,12 +797,15 @@
|
|||
;; the data snapshots.
|
||||
; snapshot_cache_directory = "DataSnapshot"
|
||||
|
||||
;; [Supported, but obsolete]
|
||||
;# {data_services} {index_sims:true} {Data service URLs to register with?} {} http://metaverseink.com/cgi-bin/register.py
|
||||
; This semicolon-separated string serves to notify specific data services
|
||||
; about the existence of this sim. Uncomment if you want to index your
|
||||
; data with this and/or other search providers.
|
||||
; data_services="http://metaverseink.com/cgi-bin/register.py"
|
||||
|
||||
;; New way of specifying data services, one per service
|
||||
;DATA_SRV_MISearch = "http://metaverseink.com/cgi-bin/register.py"
|
||||
|
||||
[Economy]
|
||||
;# {SellEnabled} {} {Enable selling for 0?} {true false} true
|
||||
|
|
|
@ -1389,10 +1389,9 @@
|
|||
; This will be created in bin, if it doesn't exist already. It will hold the data snapshots.
|
||||
snapshot_cache_directory = "DataSnapshot"
|
||||
|
||||
; This semicolon-separated string serves to notify specific data services about the existence
|
||||
; of this sim. Uncomment if you want to index your data with this and/or other search providers.
|
||||
;data_services="http://metaverseink.com/cgi-bin/register.py"
|
||||
|
||||
; Uncomment if you want to index your data with this and/or other search providers. One entry per
|
||||
; data service
|
||||
;DATA_SRV_MISearch = "http://metaverseink.com/cgi-bin/register.py"
|
||||
|
||||
[Economy]
|
||||
; These economy values get used in the BetaGridLikeMoneyModule. - This module is for demonstration only -
|
||||
|
|
Loading…
Reference in New Issue