Step one on the long march towards grid based inventory. Introduction of an InevntoryServer

This commit is contained in:
Tleiades Hax
2007-10-30 22:42:34 +00:00
parent a8c42a5829
commit 6a8d8f54e8
15 changed files with 533 additions and 73 deletions

View File

@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework
{
/// <summary>
/// UserConfig -- For User Server Configuration
/// </summary>
public class InventoryConfig
{
public string DefaultStartupMsg = "";
public string UserServerURL = "";
public string UserSendKey = "";
public string UserRecvKey = "";
public string DatabaseProvider = "";
public static uint DefaultHttpPort = 8004;
public int HttpPort = 8004;
private ConfigurationMember configMember;
public InventoryConfig(string description, string filename)
{
configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration);
configMember.performConfigurationRetrieve();
}
public void loadConfigurationOptions()
{
configMember.addConfigurationOption("default_startup_message", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Startup Message", "Welcome to OGS", false);
configMember.addConfigurationOption("default_user_server", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default User Server URI", "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString(), false);
configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to user server", "null", false);
configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from user server", "null", false);
configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false);
configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Http Listener port", DefaultHttpPort.ToString(), false);
}
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
{
switch (configuration_key)
{
case "default_startup_message":
this.DefaultStartupMsg = (string)configuration_result;
break;
case "default_user_server":
this.UserServerURL = (string)configuration_result;
break;
case "user_send_key":
this.UserSendKey = (string)configuration_result;
break;
case "user_recv_key":
this.UserRecvKey = (string)configuration_result;
break;
case "database_provider":
this.DatabaseProvider = (string)configuration_result;
break;
case "http_port":
HttpPort = (int)configuration_result;
break;
}
return true;
}
}
}

View File

@@ -25,6 +25,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using System;
using System.Xml.Serialization;
using System.Collections;
using System.Collections.Generic;
using libsecondlife;
@@ -242,4 +245,29 @@ namespace OpenSim.Framework
/// <param name="folder">The id of the folder</param>
void deleteInventoryFolder(LLUUID folder);
}
}
/*
* .Net has some issues, serializing a dictionary, so we cannot reuse the InventoryFolder
* class defined in Communications.Framework.Communications.Caches. So we serialize/deserialize
* into this simpler class, and then use that.
*/
[XmlRoot(ElementName = "inventory", IsNullable = true)]
public class SerializableInventory
{
[XmlRoot(ElementName = "folder", IsNullable = true)]
public class SerializableFolder : InventoryFolderBase
{
[XmlArray(ElementName = "folders", IsNullable = true)]
[XmlArrayItem(ElementName = "folder", IsNullable = true, Type = typeof(SerializableFolder))]
public ArrayList SubFolders;
[XmlArray(ElementName = "items", IsNullable = true)]
[XmlArrayItem(ElementName = "item", IsNullable = true, Type = typeof(InventoryItemBase))]
public ArrayList Items;
}
[XmlElement(ElementName = "folder", IsNullable = true)]
public SerializableFolder root;
}
}

View File

@@ -43,6 +43,8 @@ namespace OpenSim.Framework
public string UserRecvKey = "";
public bool isSandbox;
public string InventoryURL = "";
public static int DefaultHttpListenerPort = 9000;
public int HttpListenerPort = DefaultHttpListenerPort;
@@ -91,6 +93,8 @@ namespace OpenSim.Framework
UserSendKey = config.Configs["Network"].GetString("user_send_key", "null");
UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null");
AssetURL = config.Configs["Network"].GetString("asset_server_url", AssetURL);
InventoryURL = config.Configs["Network"].GetString("inventory_server_url",
"http://127.0.0.1:" + InventoryConfig.DefaultHttpPort.ToString());
}
}
}
}