From 033a3da254d5acba8fff002bec921dc39752bff8 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Mon, 4 Jan 2010 23:30:38 +0000
Subject: Sqlite framework and generic handler. They compile. More I cannot
say.
---
OpenSim/Data/SQLite/SQLiteFramework.cs | 83 ++++++++
OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs | 253 +++++++++++++++++++++++
2 files changed, 336 insertions(+)
create mode 100644 OpenSim/Data/SQLite/SQLiteFramework.cs
create mode 100644 OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
diff --git a/OpenSim/Data/SQLite/SQLiteFramework.cs b/OpenSim/Data/SQLite/SQLiteFramework.cs
new file mode 100644
index 0000000..12b2750
--- /dev/null
+++ b/OpenSim/Data/SQLite/SQLiteFramework.cs
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Data;
+using OpenMetaverse;
+using OpenSim.Framework;
+using Mono.Data.SqliteClient;
+
+namespace OpenSim.Data.SQLite
+{
+ ///
+ /// A database interface class to a user profile storage system
+ ///
+ public class SQLiteFramework
+ {
+ protected SqliteConnection m_Connection;
+
+ protected SQLiteFramework(string connectionString)
+ {
+ m_Connection = new SqliteConnection(connectionString);
+ m_Connection.Open();
+ }
+
+ //////////////////////////////////////////////////////////////
+ //
+ // All non queries are funneled through one connection
+ // to increase performance a little
+ //
+ protected int ExecuteNonQuery(SqliteCommand cmd)
+ {
+ lock (m_Connection)
+ {
+ cmd.Connection = m_Connection;
+
+ return cmd.ExecuteNonQuery();
+ }
+ }
+
+ protected IDataReader ExecuteReader(SqliteCommand cmd)
+ {
+ SqliteConnection newConnection =
+ (SqliteConnection)((ICloneable)m_Connection).Clone();
+ newConnection.Open();
+
+ cmd.Connection = newConnection;
+ return cmd.ExecuteReader();
+ }
+
+ protected void CloseReaderCommand(SqliteCommand cmd)
+ {
+ cmd.Connection.Close();
+ cmd.Connection.Dispose();
+ cmd.Dispose();
+ }
+ }
+}
diff --git a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
new file mode 100644
index 0000000..6b67ec6
--- /dev/null
+++ b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs
@@ -0,0 +1,253 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Reflection;
+using log4net;
+using Mono.Data.SqliteClient;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Interfaces;
+
+namespace OpenSim.Data.SQLite
+{
+ public class SQLiteGenericTableHandler : SQLiteFramework where T: class, new()
+ {
+ private static readonly ILog m_log =
+ LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+
+ protected Dictionary m_Fields =
+ new Dictionary();
+
+ protected List m_ColumnNames = null;
+ protected string m_Realm;
+ protected FieldInfo m_DataField = null;
+
+ public SQLiteGenericTableHandler(string connectionString,
+ string realm, string storeName) : base(connectionString)
+ {
+ m_Realm = realm;
+ if (storeName != String.Empty)
+ {
+ Assembly assem = GetType().Assembly;
+
+ Migration m = new Migration(m_Connection, assem, storeName);
+ m.Update();
+ }
+
+ Type t = typeof(T);
+ FieldInfo[] fields = t.GetFields(BindingFlags.Public |
+ BindingFlags.Instance |
+ BindingFlags.DeclaredOnly);
+
+ if (fields.Length == 0)
+ return;
+
+ foreach (FieldInfo f in fields)
+ {
+ if (f.Name != "Data")
+ m_Fields[f.Name] = f;
+ else
+ m_DataField = f;
+ }
+ }
+
+ private void CheckColumnNames(IDataReader reader)
+ {
+ if (m_ColumnNames != null)
+ return;
+
+ m_ColumnNames = new List();
+
+ DataTable schemaTable = reader.GetSchemaTable();
+ foreach (DataRow row in schemaTable.Rows)
+ {
+ if (row["ColumnName"] != null &&
+ (!m_Fields.ContainsKey(row["ColumnName"].ToString())))
+ m_ColumnNames.Add(row["ColumnName"].ToString());
+ }
+ }
+
+ public T[] Get(string field, string key)
+ {
+ return Get(new string[] { field }, new string[] { key });
+ }
+
+ public T[] Get(string[] fields, string[] keys)
+ {
+ if (fields.Length != keys.Length)
+ return new T[0];
+
+ List terms = new List();
+
+ SqliteCommand cmd = new SqliteCommand();
+
+ for (int i = 0 ; i < fields.Length ; i++)
+ {
+ cmd.Parameters.Add(new SqliteParameter(":" + fields[i], keys[i]));
+ terms.Add("`" + fields[i] + "` = :" + fields[i]);
+ }
+
+ string where = String.Join(" and ", terms.ToArray());
+
+ string query = String.Format("select * from {0} where {1}",
+ m_Realm, where);
+
+ cmd.CommandText = query;
+
+ return DoQuery(cmd);
+ }
+
+ protected T[] DoQuery(SqliteCommand cmd)
+ {
+ IDataReader reader = ExecuteReader(cmd);
+ if (reader == null)
+ return new T[0];
+
+ CheckColumnNames(reader);
+
+ List result = new List();
+
+ while (reader.Read())
+ {
+ T row = new T();
+
+ foreach (string name in m_Fields.Keys)
+ {
+ if (m_Fields[name].GetValue(row) is bool)
+ {
+ int v = Convert.ToInt32(reader[name]);
+ m_Fields[name].SetValue(row, v != 0 ? true : false);
+ }
+ else if (m_Fields[name].GetValue(row) is UUID)
+ {
+ UUID uuid = UUID.Zero;
+
+ UUID.TryParse(reader[name].ToString(), out uuid);
+ m_Fields[name].SetValue(row, uuid);
+ }
+ else if (m_Fields[name].GetValue(row) is int)
+ {
+ int v = Convert.ToInt32(reader[name]);
+ m_Fields[name].SetValue(row, v);
+ }
+ else
+ {
+ m_Fields[name].SetValue(row, reader[name]);
+ }
+ }
+
+ if (m_DataField != null)
+ {
+ Dictionary data =
+ new Dictionary();
+
+ foreach (string col in m_ColumnNames)
+ {
+ data[col] = reader[col].ToString();
+ if (data[col] == null)
+ data[col] = String.Empty;
+ }
+
+ m_DataField.SetValue(row, data);
+ }
+
+ result.Add(row);
+ }
+
+ CloseReaderCommand(cmd);
+
+ return result.ToArray();
+ }
+
+ public T[] Get(string where)
+ {
+ SqliteCommand cmd = new SqliteCommand();
+
+ string query = String.Format("select * from {0} where {1}",
+ m_Realm, where);
+
+ cmd.CommandText = query;
+
+ return DoQuery(cmd);
+ }
+
+ public bool Store(T row)
+ {
+ SqliteCommand cmd = new SqliteCommand();
+
+ string query = "";
+ List names = new List();
+ List values = new List();
+
+ foreach (FieldInfo fi in m_Fields.Values)
+ {
+ names.Add(fi.Name);
+ values.Add(":" + fi.Name);
+ cmd.Parameters.Add(new SqliteParameter(":" + fi.Name, fi.GetValue(row).ToString()));
+ }
+
+ if (m_DataField != null)
+ {
+ Dictionary data =
+ (Dictionary)m_DataField.GetValue(row);
+
+ foreach (KeyValuePair kvp in data)
+ {
+ names.Add(kvp.Key);
+ values.Add(":" + kvp.Key);
+ cmd.Parameters.Add(new SqliteParameter(":" + kvp.Key, kvp.Value));
+ }
+ }
+
+ query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values (" + String.Join(",", values.ToArray()) + ")";
+
+ cmd.CommandText = query;
+
+ if (ExecuteNonQuery(cmd) > 0)
+ return true;
+
+ return false;
+ }
+
+ public bool Delete(string field, string val)
+ {
+ SqliteCommand cmd = new SqliteCommand();
+
+ cmd.CommandText = String.Format("delete from {0} where `{1}` = :{1}", m_Realm, field);
+ cmd.Parameters.Add(new SqliteParameter(field, val));
+
+ if (ExecuteNonQuery(cmd) > 0)
+ return true;
+
+ return false;
+ }
+ }
+}
--
cgit v1.1
From 28ba16ee531a6d21f793845f897828e7b1b3fdca Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 5 Jan 2010 00:35:54 +0000
Subject: Add the port of the XInventoryService for the new Sqlite framework
---
OpenSim/Data/SQLite/SQLiteXInventoryData.cs | 156 ++++++++++++++++++++++++++++
1 file changed, 156 insertions(+)
create mode 100644 OpenSim/Data/SQLite/SQLiteXInventoryData.cs
diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
new file mode 100644
index 0000000..97625a7
--- /dev/null
+++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Data;
+using System.Reflection;
+using System.Collections.Generic;
+using Mono.Data.SqliteClient;
+using log4net;
+using OpenMetaverse;
+using OpenSim.Framework;
+
+namespace OpenSim.Data.SQLite
+{
+ ///
+ /// A MySQL Interface for the Asset Server
+ ///
+ public class SQLiteXInventoryData : IXInventoryData
+ {
+ private static readonly ILog m_log = LogManager.GetLogger(
+ MethodBase.GetCurrentMethod().DeclaringType);
+
+ private SQLiteGenericTableHandler m_Folders;
+ private SqliteItemHandler m_Items;
+
+ public SQLiteXInventoryData(string conn, string realm)
+ {
+ m_Folders = new SQLiteGenericTableHandler(
+ conn, "inventoryfolders", "InventoryStore");
+ m_Items = new SqliteItemHandler(
+ conn, "inventoryitems", String.Empty);
+ }
+
+ public XInventoryFolder[] GetFolders(string[] fields, string[] vals)
+ {
+ return m_Folders.Get(fields, vals);
+ }
+
+ public XInventoryItem[] GetItems(string[] fields, string[] vals)
+ {
+ return m_Items.Get(fields, vals);
+ }
+
+ public bool StoreFolder(XInventoryFolder folder)
+ {
+ return m_Folders.Store(folder);
+ }
+
+ public bool StoreItem(XInventoryItem item)
+ {
+ return m_Items.Store(item);
+ }
+
+ public bool DeleteFolders(string field, string val)
+ {
+ return m_Folders.Delete(field, val);
+ }
+
+ public bool DeleteItems(string field, string val)
+ {
+ return m_Items.Delete(field, val);
+ }
+
+ public bool MoveItem(string id, string newParent)
+ {
+ return m_Items.MoveItem(id, newParent);
+ }
+
+ public XInventoryItem[] GetActiveGestures(UUID principalID)
+ {
+ return m_Items.GetActiveGestures(principalID);
+ }
+
+ public int GetAssetPermissions(UUID principalID, UUID assetID)
+ {
+ return m_Items.GetAssetPermissions(principalID, assetID);
+ }
+ }
+
+ public class SqliteItemHandler : SQLiteGenericTableHandler
+ {
+ public SqliteItemHandler(string c, string t, string m) :
+ base(c, t, m)
+ {
+ }
+
+ public bool MoveItem(string id, string newParent)
+ {
+ SqliteCommand cmd = new SqliteCommand();
+
+ cmd.CommandText = String.Format("update {0} set parentFolderID = :ParentFolderID where inventoryID = :InventoryID", m_Realm);
+ cmd.Parameters.Add(new SqliteParameter(":ParentFolderID", newParent));
+ cmd.Parameters.Add(new SqliteParameter(":InventoryID", id));
+
+ return ExecuteNonQuery(cmd) == 0 ? false : true;
+ }
+
+ public XInventoryItem[] GetActiveGestures(UUID principalID)
+ {
+ SqliteCommand cmd = new SqliteCommand();
+ cmd.CommandText = String.Format("select * from inventoryitems where avatarId = :uuid and assetType = :type and flags = 1", m_Realm);
+
+ cmd.Parameters.Add(new SqliteParameter(":uuid", principalID.ToString()));
+ cmd.Parameters.Add(new SqliteParameter(":type", (int)AssetType.Gesture));
+
+ return DoQuery(cmd);
+ }
+
+ public int GetAssetPermissions(UUID principalID, UUID assetID)
+ {
+ SqliteCommand cmd = new SqliteCommand();
+
+ cmd.CommandText = String.Format("select inventoryCurrentPermissions from inventoryitems where avatarID = :PrincipalID and assetID = :AssetID", m_Realm);
+ cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString()));
+ cmd.Parameters.Add(new SqliteParameter(":AssetID", assetID.ToString()));
+
+ IDataReader reader = ExecuteReader(cmd);
+
+ int perms = 0;
+
+ while (reader.Read())
+ {
+ perms |= Convert.ToInt32(reader["inventoryCurrentPermissions"]);
+ }
+
+ reader.Close();
+ CloseReaderCommand(cmd);
+
+ return perms;
+ }
+ }
+}
--
cgit v1.1
From 4799f1ce9220eb9ff65ea81f1476f804b5e85144 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 5 Jan 2010 03:13:19 +0000
Subject: Add the unfinished XInventoryConnector. Intermediate commit, will NOT
compile!
---
.../Connectors/Inventory/XInventoryConnector.cs | 317 +++++++++++++++++++++
1 file changed, 317 insertions(+)
create mode 100644 OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
new file mode 100644
index 0000000..6e1d657
--- /dev/null
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using log4net;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using Nini.Config;
+using OpenSim.Framework;
+using OpenSim.Framework.Console;
+using OpenSim.Framework.Communications;
+using OpenSim.Framework.Servers.HttpServer;
+using OpenSim.Services.Interfaces;
+using OpenSim.Server.Base;
+using OpenMetaverse;
+
+namespace OpenSim.Services.Connectors
+{
+ public class XInventoryServicesConnector : IInventoryService
+ {
+ private static readonly ILog m_log =
+ LogManager.GetLogger(
+ MethodBase.GetCurrentMethod().DeclaringType);
+
+ private string m_ServerURI = String.Empty;
+
+ public XInventoryServicesConnector()
+ {
+ }
+
+ public XInventoryServicesConnector(string serverURI)
+ {
+ m_ServerURI = serverURI.TrimEnd('/');
+ }
+
+ public XInventoryServicesConnector(IConfigSource source)
+ {
+ Initialise(source);
+ }
+
+ public virtual void Initialise(IConfigSource source)
+ {
+ IConfig assetConfig = source.Configs["InventoryService"];
+ if (assetConfig == null)
+ {
+ m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpanSim.ini");
+ throw new Exception("Inventory connector init error");
+ }
+
+ string serviceURI = assetConfig.GetString("InventoryServerURI",
+ String.Empty);
+
+ if (serviceURI == String.Empty)
+ {
+ m_log.Error("[INVENTORY CONNECTOR]: No Server URI named in section InventoryService");
+ throw new Exception("Inventory connector init error");
+ }
+ m_ServerURI = serviceURI;
+ }
+
+ public bool CreateUserInventory(UUID principalID)
+ {
+ Dictionary ret = MakeRequest("CREATEUSERINVENTORY",
+ new Dictionary {
+ { "PRINCIPAL", principalID.ToString() }
+ });
+
+ if (ret == null)
+ return false;
+
+ return bool.Parse(ret["RESULT"].ToString());
+ }
+
+ public List GetInventorySkeleton(UUID userId)
+ {
+ return null;
+ }
+
+ public InventoryFolderBase GetRootFolder(UUID principalID)
+ {
+ return null;
+ }
+
+ public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)
+ {
+ return null;
+ }
+
+ public InventoryCollection GetFolderContent(UUID principalID, UUID folderID)
+ {
+ return null;
+ }
+
+ public List GetFolderItems(UUID principalID, UUID folderID)
+ {
+ return null;
+ }
+
+ public bool AddFolder(InventoryFolderBase folder)
+ {
+ Dictionary ret = MakeRequest("ADDFOLDER",
+ new Dictionary {
+ { "ParentID", folder.ParentID.ToString() },
+ { "Type", folder.Type.ToString() },
+ { "Version", folder.Version.ToString() },
+ { "Name", folder.Name.ToString() },
+ { "Owner", folder.Owner.ToString() },
+ { "ID", folder.ID.ToString() }
+ });
+
+ if (ret == null)
+ return false;
+
+ return bool.Parse(ret["RESULT"].ToString());
+ }
+
+ public bool UpdateFolder(InventoryFolderBase folder)
+ {
+ Dictionary ret = MakeRequest("UPDATEFOLDER",
+ new Dictionary {
+ { "ParentID", folder.ParentID.ToString() },
+ { "Type", folder.Type.ToString() },
+ { "Version", folder.Version.ToString() },
+ { "Name", folder.Name.ToString() },
+ { "Owner", folder.Owner.ToString() },
+ { "ID", folder.ID.ToString() }
+ });
+
+ if (ret == null)
+ return false;
+
+ return bool.Parse(ret["RESULT"].ToString());
+ }
+
+ public bool MoveFolder(InventoryFolderBase folder)
+ {
+ Dictionary ret = MakeRequest("MOVEFOLDER",
+ new Dictionary {
+ { "ParentID", folder.ParentID.ToString() },
+ { "ID", folder.ID.ToString() }
+ });
+
+ if (ret == null)
+ return false;
+
+ return bool.Parse(ret["RESULT"].ToString());
+ }
+
+ public bool DeleteFolders(UUID principalID, List folderIDs)
+ {
+ List slist = new List();
+
+ foreach (UUID f in folderIDs)
+ slist.Add(f.ToString());
+
+ Dictionary ret = MakeRequest("DELETEFOLDERS",
+ new Dictionary {
+ { "PRINCIPAL", principalID.ToString() },
+ { "FOLDERS", slist }
+ });
+
+ if (ret == null)
+ return false;
+
+ return bool.Parse(ret["RESULT"].ToString());
+ }
+
+ public bool PurgeFolder(InventoryFolderBase folder)
+ {
+ Dictionary ret = MakeRequest("PURGEFOLDER",
+ new Dictionary {
+ { "ID", folder.ID.ToString() }
+ });
+
+ if (ret == null)
+ return false;
+
+ return bool.Parse(ret["RESULT"].ToString());
+ }
+
+ public bool AddItem(InventoryItemBase item)
+ {
+ Dictionary ret = MakeRequest("CREATEUSERINVENTORY",
+ new Dictionary {
+ });
+
+ if (ret == null)
+ return false;
+
+ return bool.Parse(ret["RESULT"].ToString());
+ }
+
+ public bool UpdateItem(InventoryItemBase item)
+ {
+ Dictionary ret = MakeRequest("CREATEUSERINVENTORY",
+ new Dictionary {
+ });
+
+ if (ret == null)
+ return false;
+
+ return bool.Parse(ret["RESULT"].ToString());
+ }
+
+ public bool MoveItems(UUID ownerID, List items)
+ {
+ return false;
+ }
+
+ public bool DeleteItems(UUID principalID, List itemIDs)
+ {
+ List slist = new List();
+
+ foreach (UUID f in itemIDs)
+ slist.Add(f.ToString());
+
+ Dictionary ret = MakeRequest("DELETEITEMS",
+ new Dictionary {
+ { "PRINCIPAL", principalID.ToString() },
+ { "ITEMS", slist }
+ });
+
+ if (ret == null)
+ return false;
+
+ return bool.Parse(ret["RESULT"].ToString());
+ }
+
+ public InventoryItemBase GetItem(InventoryItemBase item)
+ {
+ return null;
+ }
+
+ public InventoryFolderBase GetFolder(InventoryFolderBase folder)
+ {
+ return null;
+ }
+
+ public List GetActiveGestures(UUID userId)
+ {
+ return null;
+ }
+
+ public int GetAssetPermissions(UUID principalID, UUID assetID)
+ {
+ Dictionary ret = MakeRequest("GETASSETPERMISSIONS",
+ new Dictionary {
+ { "PRINCIPAL", principalID.ToString() },
+ { "ASSET", assetID.ToString() }
+ });
+
+ if (ret == null)
+ return false;
+
+ return int.Parse(ret["RESULT"].ToString());
+ }
+
+
+ // These are either obsolete or unused
+ //
+ public InventoryCollection GetUserInventory(UUID principalID)
+ {
+ return null;
+ }
+
+ public void GetUserInventory(UUID principalID, InventoryReceiptCallback callback)
+ {
+ }
+
+ public bool HasInventoryForUser(UUID principalID)
+ {
+ return false;
+ }
+
+ // Helpers
+ //
+ private Dictionary MakeRequest(string method,
+ Dictionary sendData)
+ {
+ sendData["METHOD"] = method;
+
+ string reply = SynchronousRestFormsRequester.MakeRequest("POST",
+ m_ServerURI + "/xinventory",
+ ServerUtils.BuildQueryString(sendData));
+
+ Dictionary replyData = ServerUtils.ParseXmlResponse(
+ reply);
+
+ return replyData;
+ }
+ }
+}
--
cgit v1.1
From cbe434149e79304da9251bfe946f43f6a08c1393 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sun, 27 Dec 2009 03:31:53 +0000
Subject: Change the signature of the forms requester data in preparation to
getting to where lists can be sent as requests
---
OpenSim/Server/Base/ServerUtils.cs | 12 +--
.../AuthenticationServerPostHandler.cs | 14 ++--
.../Server/Handlers/Grid/GridServerPostHandler.cs | 92 +++++++++++-----------
.../Handlers/Presence/PresenceServerPostHandler.cs | 8 +-
.../AuthenticationServiceConnector.cs | 6 +-
.../Connectors/Grid/GridServiceConnector.cs | 16 ++--
6 files changed, 74 insertions(+), 74 deletions(-)
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs
index 0964caa..413a078 100644
--- a/OpenSim/Server/Base/ServerUtils.cs
+++ b/OpenSim/Server/Base/ServerUtils.cs
@@ -160,9 +160,9 @@ namespace OpenSim.Server.Base
}
}
- public static Dictionary ParseQueryString(string query)
+ public static Dictionary ParseQueryString(string query)
{
- Dictionary result = new Dictionary();
+ Dictionary result = new Dictionary();
string[] terms = query.Split(new char[] {'&'});
if (terms.Length == 0)
@@ -186,17 +186,17 @@ namespace OpenSim.Server.Base
return result;
}
- public static string BuildQueryString(Dictionary data)
+ public static string BuildQueryString(Dictionary data)
{
string qstring = String.Empty;
- foreach (KeyValuePair kvp in data)
+ foreach (KeyValuePair kvp in data)
{
string part;
- if (kvp.Value != String.Empty)
+ if (kvp.Value.ToString() != String.Empty)
{
part = System.Web.HttpUtility.UrlEncode(kvp.Key) +
- "=" + System.Web.HttpUtility.UrlEncode(kvp.Value);
+ "=" + System.Web.HttpUtility.UrlEncode(kvp.Value.ToString());
}
else
{
diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
index 490a13a..47bc860 100644
--- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerPostHandler.cs
@@ -86,14 +86,14 @@ namespace OpenSim.Server.Handlers.Authentication
private byte[] DoPlainMethods(string body)
{
- Dictionary request =
+ Dictionary request =
ServerUtils.ParseQueryString(body);
int lifetime = 30;
if (request.ContainsKey("LIFETIME"))
{
- lifetime = Convert.ToInt32(request["LIFETIME"]);
+ lifetime = Convert.ToInt32(request["LIFETIME"].ToString());
if (lifetime > 30)
lifetime = 30;
}
@@ -103,12 +103,12 @@ namespace OpenSim.Server.Handlers.Authentication
if (!request.ContainsKey("PRINCIPAL"))
return FailureResult();
- string method = request["METHOD"];
+ string method = request["METHOD"].ToString();
UUID principalID;
string token;
- if (!UUID.TryParse(request["PRINCIPAL"], out principalID))
+ if (!UUID.TryParse(request["PRINCIPAL"].ToString(), out principalID))
return FailureResult();
switch (method)
@@ -117,7 +117,7 @@ namespace OpenSim.Server.Handlers.Authentication
if (!request.ContainsKey("PASSWORD"))
return FailureResult();
- token = m_AuthenticationService.Authenticate(principalID, request["PASSWORD"], lifetime);
+ token = m_AuthenticationService.Authenticate(principalID, request["PASSWORD"].ToString(), lifetime);
if (token != String.Empty)
return SuccessResult(token);
@@ -126,7 +126,7 @@ namespace OpenSim.Server.Handlers.Authentication
if (!request.ContainsKey("TOKEN"))
return FailureResult();
- if (m_AuthenticationService.Verify(principalID, request["TOKEN"], lifetime))
+ if (m_AuthenticationService.Verify(principalID, request["TOKEN"].ToString(), lifetime))
return SuccessResult();
return FailureResult();
@@ -134,7 +134,7 @@ namespace OpenSim.Server.Handlers.Authentication
if (!request.ContainsKey("TOKEN"))
return FailureResult();
- if (m_AuthenticationService.Release(principalID, request["TOKEN"]))
+ if (m_AuthenticationService.Release(principalID, request["TOKEN"].ToString()))
return SuccessResult();
return FailureResult();
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
index 433ed0b..d99b791 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
@@ -69,13 +69,13 @@ namespace OpenSim.Server.Handlers.Grid
try
{
- Dictionary request =
+ Dictionary request =
ServerUtils.ParseQueryString(body);
if (!request.ContainsKey("METHOD"))
return FailureResult();
- string method = request["METHOD"];
+ string method = request["METHOD"].ToString();
switch (method)
{
@@ -117,22 +117,22 @@ namespace OpenSim.Server.Handlers.Grid
#region Method-specific handlers
- byte[] Register(Dictionary request)
+ byte[] Register(Dictionary request)
{
UUID scopeID = UUID.Zero;
if (request.ContainsKey("SCOPEID"))
- UUID.TryParse(request["SCOPEID"], out scopeID);
+ UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to register region");
int versionNumberMin = 0, versionNumberMax = 0;
if (request.ContainsKey("VERSIONMIN"))
- Int32.TryParse(request["VERSIONMIN"], out versionNumberMin);
+ Int32.TryParse(request["VERSIONMIN"].ToString(), out versionNumberMin);
else
m_log.WarnFormat("[GRID HANDLER]: no minimum protocol version in request to register region");
if (request.ContainsKey("VERSIONMAX"))
- Int32.TryParse(request["VERSIONMAX"], out versionNumberMax);
+ Int32.TryParse(request["VERSIONMAX"].ToString(), out versionNumberMax);
else
m_log.WarnFormat("[GRID HANDLER]: no maximum protocol version in request to register region");
@@ -147,8 +147,8 @@ namespace OpenSim.Server.Handlers.Grid
GridRegion rinfo = null;
try
{
- foreach (KeyValuePair kvp in request)
- rinfoData[kvp.Key] = kvp.Value;
+ foreach (KeyValuePair kvp in request)
+ rinfoData[kvp.Key] = kvp.Value.ToString();
rinfo = new GridRegion(rinfoData);
}
catch (Exception e)
@@ -166,11 +166,11 @@ namespace OpenSim.Server.Handlers.Grid
return FailureResult();
}
- byte[] Deregister(Dictionary request)
+ byte[] Deregister(Dictionary request)
{
UUID regionID = UUID.Zero;
- if (request["REGIONID"] != null)
- UUID.TryParse(request["REGIONID"], out regionID);
+ if (request.ContainsKey("REGIONID"))
+ UUID.TryParse(request["REGIONID"].ToString(), out regionID);
else
m_log.WarnFormat("[GRID HANDLER]: no regionID in request to deregister region");
@@ -183,17 +183,17 @@ namespace OpenSim.Server.Handlers.Grid
}
- byte[] GetNeighbours(Dictionary request)
+ byte[] GetNeighbours(Dictionary request)
{
UUID scopeID = UUID.Zero;
- if (request["SCOPEID"] != null)
- UUID.TryParse(request["SCOPEID"], out scopeID);
+ if (request.ContainsKey("SCOPEID"))
+ UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours");
UUID regionID = UUID.Zero;
- if (request["REGIONID"] != null)
- UUID.TryParse(request["REGIONID"], out regionID);
+ if (request.ContainsKey("REGIONID"))
+ UUID.TryParse(request["REGIONID"].ToString(), out regionID);
else
m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours");
@@ -221,17 +221,17 @@ namespace OpenSim.Server.Handlers.Grid
}
- byte[] GetRegionByUUID(Dictionary request)
+ byte[] GetRegionByUUID(Dictionary request)
{
UUID scopeID = UUID.Zero;
- if (request["SCOPEID"] != null)
- UUID.TryParse(request["SCOPEID"], out scopeID);
+ if (request.ContainsKey("SCOPEID"))
+ UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours");
UUID regionID = UUID.Zero;
- if (request["REGIONID"] != null)
- UUID.TryParse(request["REGIONID"], out regionID);
+ if (request.ContainsKey("REGIONID"))
+ UUID.TryParse(request["REGIONID"].ToString(), out regionID);
else
m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours");
@@ -250,21 +250,21 @@ namespace OpenSim.Server.Handlers.Grid
return encoding.GetBytes(xmlString);
}
- byte[] GetRegionByPosition(Dictionary request)
+ byte[] GetRegionByPosition(Dictionary request)
{
UUID scopeID = UUID.Zero;
- if (request["SCOPEID"] != null)
- UUID.TryParse(request["SCOPEID"], out scopeID);
+ if (request.ContainsKey("SCOPEID"))
+ UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by position");
int x = 0, y = 0;
- if (request["X"] != null)
- Int32.TryParse(request["X"], out x);
+ if (request.ContainsKey("X"))
+ Int32.TryParse(request["X"].ToString(), out x);
else
m_log.WarnFormat("[GRID HANDLER]: no X in request to get region by position");
- if (request["Y"] != null)
- Int32.TryParse(request["Y"], out y);
+ if (request.ContainsKey("Y"))
+ Int32.TryParse(request["Y"].ToString(), out y);
else
m_log.WarnFormat("[GRID HANDLER]: no Y in request to get region by position");
@@ -283,17 +283,17 @@ namespace OpenSim.Server.Handlers.Grid
return encoding.GetBytes(xmlString);
}
- byte[] GetRegionByName(Dictionary request)
+ byte[] GetRegionByName(Dictionary request)
{
UUID scopeID = UUID.Zero;
- if (request["SCOPEID"] != null)
- UUID.TryParse(request["SCOPEID"], out scopeID);
+ if (request.ContainsKey("SCOPEID"))
+ UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by name");
string regionName = string.Empty;
- if (request["NAME"] != null)
- regionName = request["NAME"];
+ if (request.ContainsKey("NAME"))
+ regionName = request["NAME"].ToString();
else
m_log.WarnFormat("[GRID HANDLER]: no name in request to get region by name");
@@ -312,23 +312,23 @@ namespace OpenSim.Server.Handlers.Grid
return encoding.GetBytes(xmlString);
}
- byte[] GetRegionsByName(Dictionary request)
+ byte[] GetRegionsByName(Dictionary request)
{
UUID scopeID = UUID.Zero;
- if (request["SCOPEID"] != null)
- UUID.TryParse(request["SCOPEID"], out scopeID);
+ if (request.ContainsKey("SCOPEID"))
+ UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get regions by name");
string regionName = string.Empty;
- if (request["NAME"] != null)
- regionName = request["NAME"];
+ if (request.ContainsKey("NAME"))
+ regionName = request["NAME"].ToString();
else
m_log.WarnFormat("[GRID HANDLER]: no NAME in request to get regions by name");
int max = 0;
- if (request["MAX"] != null)
- Int32.TryParse(request["MAX"], out max);
+ if (request.ContainsKey("MAX"))
+ Int32.TryParse(request["MAX"].ToString(), out max);
else
m_log.WarnFormat("[GRID HANDLER]: no MAX in request to get regions by name");
@@ -355,30 +355,30 @@ namespace OpenSim.Server.Handlers.Grid
return encoding.GetBytes(xmlString);
}
- byte[] GetRegionRange(Dictionary request)
+ byte[] GetRegionRange(Dictionary request)
{
//m_log.DebugFormat("[GRID HANDLER]: GetRegionRange");
UUID scopeID = UUID.Zero;
if (request.ContainsKey("SCOPEID"))
- UUID.TryParse(request["SCOPEID"], out scopeID);
+ UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region range");
int xmin = 0, xmax = 0, ymin = 0, ymax = 0;
if (request.ContainsKey("XMIN"))
- Int32.TryParse(request["XMIN"], out xmin);
+ Int32.TryParse(request["XMIN"].ToString(), out xmin);
else
m_log.WarnFormat("[GRID HANDLER]: no XMIN in request to get region range");
if (request.ContainsKey("XMAX"))
- Int32.TryParse(request["XMAX"], out xmax);
+ Int32.TryParse(request["XMAX"].ToString(), out xmax);
else
m_log.WarnFormat("[GRID HANDLER]: no XMAX in request to get region range");
if (request.ContainsKey("YMIN"))
- Int32.TryParse(request["YMIN"], out ymin);
+ Int32.TryParse(request["YMIN"].ToString(), out ymin);
else
m_log.WarnFormat("[GRID HANDLER]: no YMIN in request to get region range");
if (request.ContainsKey("YMAX"))
- Int32.TryParse(request["YMAX"], out ymax);
+ Int32.TryParse(request["YMAX"].ToString(), out ymax);
else
m_log.WarnFormat("[GRID HANDLER]: no YMAX in request to get region range");
diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
index 2558fa0..b1c6bcf 100644
--- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
@@ -68,13 +68,13 @@ namespace OpenSim.Server.Handlers.Presence
try
{
- Dictionary request =
+ Dictionary request =
ServerUtils.ParseQueryString(body);
if (!request.ContainsKey("METHOD"))
return FailureResult();
- string method = request["METHOD"];
+ string method = request["METHOD"].ToString();
switch (method)
{
@@ -92,12 +92,12 @@ namespace OpenSim.Server.Handlers.Presence
}
- byte[] Report(Dictionary request)
+ byte[] Report(Dictionary request)
{
PresenceInfo info = new PresenceInfo();
info.Data = new Dictionary();
- if (request["PrincipalID"] == null || request["RegionID"] == null)
+ if (!request.ContainsKey("PrincipalID") || !request.ContainsKey("RegionID"))
return FailureResult();
if (!UUID.TryParse(request["PrincipalID"].ToString(),
diff --git a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs
index 50e817e..19bb3e2 100644
--- a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs
@@ -84,7 +84,7 @@ namespace OpenSim.Services.Connectors
public string Authenticate(UUID principalID, string password, int lifetime)
{
- Dictionary sendData = new Dictionary();
+ Dictionary sendData = new Dictionary();
sendData["LIFETIME"] = lifetime.ToString();
sendData["PRINCIPAL"] = principalID.ToString();
sendData["PASSWORD"] = password;
@@ -106,7 +106,7 @@ namespace OpenSim.Services.Connectors
public bool Verify(UUID principalID, string token, int lifetime)
{
- Dictionary sendData = new Dictionary();
+ Dictionary sendData = new Dictionary();
sendData["LIFETIME"] = lifetime.ToString();
sendData["PRINCIPAL"] = principalID.ToString();
sendData["TOKEN"] = token;
@@ -128,7 +128,7 @@ namespace OpenSim.Services.Connectors
public bool Release(UUID principalID, string token)
{
- Dictionary sendData = new Dictionary();
+ Dictionary sendData = new Dictionary();
sendData["PRINCIPAL"] = principalID.ToString();
sendData["TOKEN"] = token;
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
index 02f2b79..99aa3fb 100644
--- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
@@ -89,7 +89,7 @@ namespace OpenSim.Services.Connectors
public virtual bool RegisterRegion(UUID scopeID, GridRegion regionInfo)
{
Dictionary rinfo = regionInfo.ToKeyValuePairs();
- Dictionary sendData = new Dictionary();
+ Dictionary sendData = new Dictionary();
foreach (KeyValuePair kvp in rinfo)
sendData[kvp.Key] = (string)kvp.Value;
@@ -130,7 +130,7 @@ namespace OpenSim.Services.Connectors
public virtual bool DeregisterRegion(UUID regionID)
{
- Dictionary sendData = new Dictionary();
+ Dictionary sendData = new Dictionary();
sendData["REGIONID"] = regionID.ToString();
@@ -162,7 +162,7 @@ namespace OpenSim.Services.Connectors
public virtual List GetNeighbours(UUID scopeID, UUID regionID)
{
- Dictionary sendData = new Dictionary();
+ Dictionary sendData = new Dictionary();
sendData["SCOPEID"] = scopeID.ToString();
sendData["REGIONID"] = regionID.ToString();
@@ -212,7 +212,7 @@ namespace OpenSim.Services.Connectors
public virtual GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
{
- Dictionary sendData = new Dictionary();
+ Dictionary sendData = new Dictionary();
sendData["SCOPEID"] = scopeID.ToString();
sendData["REGIONID"] = regionID.ToString();
@@ -258,7 +258,7 @@ namespace OpenSim.Services.Connectors
public virtual GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
{
- Dictionary sendData = new Dictionary();
+ Dictionary sendData = new Dictionary();
sendData["SCOPEID"] = scopeID.ToString();
sendData["X"] = x.ToString();
@@ -303,7 +303,7 @@ namespace OpenSim.Services.Connectors
public virtual GridRegion GetRegionByName(UUID scopeID, string regionName)
{
- Dictionary sendData = new Dictionary();
+ Dictionary sendData = new Dictionary();
sendData["SCOPEID"] = scopeID.ToString();
sendData["NAME"] = regionName;
@@ -344,7 +344,7 @@ namespace OpenSim.Services.Connectors
public virtual List GetRegionsByName(UUID scopeID, string name, int maxNumber)
{
- Dictionary sendData = new Dictionary();
+ Dictionary sendData = new Dictionary();
sendData["SCOPEID"] = scopeID.ToString();
sendData["NAME"] = name;
@@ -396,7 +396,7 @@ namespace OpenSim.Services.Connectors
public virtual List GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
{
- Dictionary sendData = new Dictionary();
+ Dictionary sendData = new Dictionary();
sendData["SCOPEID"] = scopeID.ToString();
sendData["XMIN"] = xmin.ToString();
--
cgit v1.1
From be41ba66700e46503001dfb4c2c87f9b2aad21c6 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sun, 27 Dec 2009 21:46:16 +0000
Subject: Allow lists to be embedded in query strings
---
OpenSim/Server/Base/ServerUtils.cs | 63 ++++++++++++++++++++++++++++++++------
1 file changed, 53 insertions(+), 10 deletions(-)
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs
index 413a078..a5d28a4 100644
--- a/OpenSim/Server/Base/ServerUtils.cs
+++ b/OpenSim/Server/Base/ServerUtils.cs
@@ -180,7 +180,31 @@ namespace OpenSim.Server.Base
if (elems.Length > 1)
value = System.Web.HttpUtility.UrlDecode(elems[1]);
- result[name] = value;
+ if (name.EndsWith("[]"))
+ {
+ if (result.ContainsKey(name))
+ {
+ if (!(result[name] is List))
+ continue;
+
+ List l = (List)result[name];
+
+ l.Add(value);
+ }
+ else
+ {
+ List newList = new List();
+
+ newList.Add(value);
+
+ result[name] = newList;
+ }
+ }
+ else
+ {
+ if (!result.ContainsKey(name))
+ result[name] = value;
+ }
}
return result;
@@ -190,23 +214,42 @@ namespace OpenSim.Server.Base
{
string qstring = String.Empty;
+ string part;
+
foreach (KeyValuePair kvp in data)
{
- string part;
- if (kvp.Value.ToString() != String.Empty)
+ if (kvp.Value is List)
{
- part = System.Web.HttpUtility.UrlEncode(kvp.Key) +
- "=" + System.Web.HttpUtility.UrlEncode(kvp.Value.ToString());
+ List l = (List)kvp.Value;
+
+ foreach (string s in l)
+ {
+ part = System.Web.HttpUtility.UrlEncode(kvp.Key) +
+ "[]=" + System.Web.HttpUtility.UrlEncode(s);
+
+ if (qstring != String.Empty)
+ qstring += "&";
+
+ qstring += part;
+ }
}
else
{
- part = System.Web.HttpUtility.UrlEncode(kvp.Key);
- }
+ if (kvp.Value.ToString() != String.Empty)
+ {
+ part = System.Web.HttpUtility.UrlEncode(kvp.Key) +
+ "=" + System.Web.HttpUtility.UrlEncode(kvp.Value.ToString());
+ }
+ else
+ {
+ part = System.Web.HttpUtility.UrlEncode(kvp.Key);
+ }
- if (qstring != String.Empty)
- qstring += "&";
+ if (qstring != String.Empty)
+ qstring += "&";
- qstring += part;
+ qstring += part;
+ }
}
return qstring;
--
cgit v1.1
From aca01f541552b0f6e7521e98f5e8350175b89334 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 5 Jan 2010 04:22:03 +0000
Subject: Add the XInventoryServicesConnector, a new inventory connector
without the cruft of the old one that makes inventory crash on folder
creation. This is just the connector part, the handler is still ont he todo
list.
---
.../Handlers/Presence/PresenceServerPostHandler.cs | 4 +-
.../Connectors/Inventory/XInventoryConnector.cs | 198 +++++++++++++++++++--
2 files changed, 187 insertions(+), 15 deletions(-)
diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
index b1c6bcf..b5ae54a 100644
--- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs
@@ -108,14 +108,14 @@ namespace OpenSim.Server.Handlers.Presence
out info.RegionID))
return FailureResult();
- foreach (KeyValuePair kvp in request)
+ foreach (KeyValuePair kvp in request)
{
if (kvp.Key == "METHOD" ||
kvp.Key == "PrincipalID" ||
kvp.Key == "RegionID")
continue;
- info.Data[kvp.Key] = kvp.Value;
+ info.Data[kvp.Key] = kvp.Value.ToString();
}
if (m_PresenceService.Report(info))
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
index 6e1d657..aac1a83 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
@@ -96,19 +96,55 @@ namespace OpenSim.Services.Connectors
return bool.Parse(ret["RESULT"].ToString());
}
- public List GetInventorySkeleton(UUID userId)
+ public List GetInventorySkeleton(UUID principalID)
{
- return null;
+ Dictionary ret = MakeRequest("GETINVENTORYSKELETON",
+ new Dictionary {
+ { "PRINCIPAL", principalID.ToString() }
+ });
+
+ if (ret == null)
+ return null;
+
+ List folders = new List();
+
+ foreach (Object o in ret.Values)
+ folders.Add(BuildFolder((Dictionary)o));
+
+ return folders;
}
public InventoryFolderBase GetRootFolder(UUID principalID)
{
- return null;
+ Dictionary ret = MakeRequest("GETROOTFOLDER",
+ new Dictionary {
+ { "PRINCIPAL", principalID.ToString() }
+ });
+
+ if (ret == null)
+ return null;
+
+ if (ret.Count == 0)
+ return null;
+
+ return BuildFolder(ret);
}
public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)
{
- return null;
+ Dictionary ret = MakeRequest("GETFOLDERFORTYPE",
+ new Dictionary {
+ { "PRINCIPAL", principalID.ToString() },
+ { "TYPE", ((int)type).ToString() }
+ });
+
+ if (ret == null)
+ return null;
+
+ if (ret.Count == 0)
+ return null;
+
+ return BuildFolder(ret);
}
public InventoryCollection GetFolderContent(UUID principalID, UUID folderID)
@@ -205,8 +241,28 @@ namespace OpenSim.Services.Connectors
public bool AddItem(InventoryItemBase item)
{
- Dictionary ret = MakeRequest("CREATEUSERINVENTORY",
+ Dictionary ret = MakeRequest("ADDITEM",
new Dictionary {
+ { "AssetID", item.AssetID.ToString() },
+ { "AssetType", item.AssetType.ToString() },
+ { "Name", item.Name.ToString() },
+ { "Owner", item.Owner.ToString() },
+ { "ID", item.ID.ToString() },
+ { "InvType", item.InvType.ToString() },
+ { "Folder", item.Folder.ToString() },
+ { "CreatorId", item.CreatorId.ToString() },
+ { "Description", item.Description.ToString() },
+ { "NextPermissions", item.NextPermissions.ToString() },
+ { "CurrentPermissions", item.CurrentPermissions.ToString() },
+ { "BasePermissions", item.BasePermissions.ToString() },
+ { "EveryOnePermissions", item.EveryOnePermissions.ToString() },
+ { "GroupPermissions", item.GroupPermissions.ToString() },
+ { "GroupID", item.GroupID.ToString() },
+ { "GroupOwned", item.GroupOwned.ToString() },
+ { "SalePrice", item.SalePrice.ToString() },
+ { "SaleType", item.SaleType.ToString() },
+ { "Flags", item.Flags.ToString() },
+ { "CreationDate", item.CreationDate.ToString() }
});
if (ret == null)
@@ -217,8 +273,28 @@ namespace OpenSim.Services.Connectors
public bool UpdateItem(InventoryItemBase item)
{
- Dictionary ret = MakeRequest("CREATEUSERINVENTORY",
+ Dictionary ret = MakeRequest("UPDATEITEM",
new Dictionary {
+ { "AssetID", item.AssetID.ToString() },
+ { "AssetType", item.AssetType.ToString() },
+ { "Name", item.Name.ToString() },
+ { "Owner", item.Owner.ToString() },
+ { "ID", item.ID.ToString() },
+ { "InvType", item.InvType.ToString() },
+ { "Folder", item.Folder.ToString() },
+ { "CreatorId", item.CreatorId.ToString() },
+ { "Description", item.Description.ToString() },
+ { "NextPermissions", item.NextPermissions.ToString() },
+ { "CurrentPermissions", item.CurrentPermissions.ToString() },
+ { "BasePermissions", item.BasePermissions.ToString() },
+ { "EveryOnePermissions", item.EveryOnePermissions.ToString() },
+ { "GroupPermissions", item.GroupPermissions.ToString() },
+ { "GroupID", item.GroupID.ToString() },
+ { "GroupOwned", item.GroupOwned.ToString() },
+ { "SalePrice", item.SalePrice.ToString() },
+ { "SaleType", item.SaleType.ToString() },
+ { "Flags", item.Flags.ToString() },
+ { "CreationDate", item.CreationDate.ToString() }
});
if (ret == null)
@@ -227,9 +303,28 @@ namespace OpenSim.Services.Connectors
return bool.Parse(ret["RESULT"].ToString());
}
- public bool MoveItems(UUID ownerID, List items)
+ public bool MoveItems(UUID principalID, List items)
{
- return false;
+ List idlist = new List();
+ List destlist = new List();
+
+ foreach (InventoryItemBase item in items)
+ {
+ idlist.Add(item.ID.ToString());
+ destlist.Add(item.Folder.ToString());
+ }
+
+ Dictionary ret = MakeRequest("MOVEITEMS",
+ new Dictionary {
+ { "PrincipalID", principalID.ToString() },
+ { "IDLIST", idlist },
+ { "DESTLIST", destlist }
+ });
+
+ if (ret == null)
+ return false;
+
+ return bool.Parse(ret["RESULT"].ToString());
}
public bool DeleteItems(UUID principalID, List itemIDs)
@@ -253,17 +348,52 @@ namespace OpenSim.Services.Connectors
public InventoryItemBase GetItem(InventoryItemBase item)
{
- return null;
+ Dictionary ret = MakeRequest("GETITEM",
+ new Dictionary {
+ { "ID", item.ID.ToString() }
+ });
+
+ if (ret == null)
+ return null;
+
+ if (ret.Count == 0)
+ return null;
+
+ return BuildItem(ret);
}
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
{
- return null;
+ Dictionary ret = MakeRequest("GETFOLDER",
+ new Dictionary {
+ { "ID", folder.ID.ToString() }
+ });
+
+ if (ret == null)
+ return null;
+
+ if (ret.Count == 0)
+ return null;
+
+ return BuildFolder(ret);
}
- public List GetActiveGestures(UUID userId)
+ public List GetActiveGestures(UUID principalID)
{
- return null;
+ Dictionary ret = MakeRequest("GETACTIVEGESTURES",
+ new Dictionary {
+ { "PRINCIPAL", principalID.ToString() }
+ });
+
+ if (ret == null)
+ return null;
+
+ List items = new List();
+
+ foreach (Object o in ret.Values)
+ items.Add(BuildItem((Dictionary)o));
+
+ return items;
}
public int GetAssetPermissions(UUID principalID, UUID assetID)
@@ -275,7 +405,7 @@ namespace OpenSim.Services.Connectors
});
if (ret == null)
- return false;
+ return 0;
return int.Parse(ret["RESULT"].ToString());
}
@@ -313,5 +443,47 @@ namespace OpenSim.Services.Connectors
return replyData;
}
+
+ InventoryFolderBase BuildFolder(Dictionary data)
+ {
+ InventoryFolderBase folder = new InventoryFolderBase();
+
+ folder.ParentID = new UUID(data["ParentID"].ToString());
+ folder.Type = short.Parse(data["Type"].ToString());
+ folder.Version = ushort.Parse(data["Version"].ToString());
+ folder.Name = data["Name"].ToString();
+ folder.Owner = new UUID(data["Owner"].ToString());
+ folder.ID = new UUID(data["ID"].ToString());
+
+ return folder;
+ }
+
+ InventoryItemBase BuildItem(Dictionary data)
+ {
+ InventoryItemBase item = new InventoryItemBase();
+
+ item.AssetID = new UUID(data["AssetID"].ToString());
+ item.AssetType = int.Parse(data["AssetType"].ToString());
+ item.Name = data["Name"].ToString();
+ item.Owner = new UUID(data["Owner"].ToString());
+ item.ID = new UUID(data["ID"].ToString());
+ item.InvType = int.Parse(data["InvType"].ToString());
+ item.Folder = new UUID(data["Folder"].ToString());
+ item.CreatorId = data["CreatorId"].ToString();
+ item.Description = data["Description"].ToString();
+ item.NextPermissions = uint.Parse(data["NextPermissions"].ToString());
+ item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString());
+ item.BasePermissions = uint.Parse(data["BasePermissions"].ToString());
+ item.EveryOnePermissions = uint.Parse(data["EveryOnePermissions"].ToString());
+ item.GroupPermissions = uint.Parse(data["GroupPermissions"].ToString());
+ item.GroupID = new UUID(data["GroupID"].ToString());
+ item.GroupOwned = bool.Parse(data["GroupOwned"].ToString());
+ item.SalePrice = int.Parse(data["SalePrice"].ToString());
+ item.SaleType = byte.Parse(data["SaleType"].ToString());
+ item.Flags = uint.Parse(data["Flags"].ToString());
+ item.CreationDate = int.Parse(data["CreationDate"].ToString());
+
+ return item;
+ }
}
}
--
cgit v1.1
From a542871c1590e9d6d42fb3b1e099a8d6204e8e4d Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 5 Jan 2010 15:39:53 +0000
Subject: Allow estate managers (if estate_owner_is_god is set) to actually
enter god mode. Allow god modification of objects if the object owner is the
same god that wants to modify, this allows you to regain perms on your own
objects after IAR import messed them up.
---
OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index e837e9a..f66f01f 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -596,7 +596,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return objectOwnerMask;
// Estate users should be able to edit anything in the sim
- if (IsEstateManager(user) && m_RegionOwnerIsGod && !IsAdministrator(objectOwner))
+ if (IsEstateManager(user) && m_RegionOwnerIsGod && (!IsAdministrator(objectOwner)) || objectOwner == user)
return objectOwnerMask;
// Admin should be able to edit anything in the sim (including admin objects)
@@ -888,6 +888,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
+ if (IsEstateManager(user) && m_RegionOwnerIsGod)
+ return true;
+
return IsAdministrator(user);
}
--
cgit v1.1
From 68eba8973c0d7aaaa2947bc7092edfa58e07f1e9 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Wed, 6 Jan 2010 19:16:43 +0000
Subject: Adding a skeleton for the XInventoryInConnector, counterpart to the
already done XInventoryConnector. No functionality yet.
---
.../Handlers/Inventory/XInventoryInConnector.cs | 167 +++++++++++++++++++++
1 file changed, 167 insertions(+)
create mode 100644 OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
new file mode 100644
index 0000000..8c6eca7
--- /dev/null
+++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Reflection;
+using System.Text;
+using System.Xml;
+using System.Collections.Generic;
+using System.IO;
+using Nini.Config;
+using OpenSim.Framework;
+using OpenSim.Server.Base;
+using OpenSim.Services.Interfaces;
+using OpenSim.Framework.Servers.HttpServer;
+using OpenSim.Server.Handlers.Base;
+using log4net;
+
+namespace OpenSim.Server.Handlers.Asset
+{
+ public class XInventoryInConnector : ServiceConnector
+ {
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ private IInventoryService m_InventoryService;
+ private string m_ConfigName = "InventoryService";
+
+ public XInventoryInConnector(IConfigSource config, IHttpServer server, string configName) :
+ base(config, server, configName)
+ {
+ if (configName != String.Empty)
+ m_ConfigName = configName;
+
+ IConfig serverConfig = config.Configs[m_ConfigName];
+ if (serverConfig == null)
+ throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
+
+ string inventoryService = serverConfig.GetString("LocalServiceModule",
+ String.Empty);
+
+ if (inventoryService == String.Empty)
+ throw new Exception("No InventoryService in config file");
+
+ Object[] args = new Object[] { config };
+ m_InventoryService =
+ ServerUtils.LoadPlugin(inventoryService, args);
+
+ server.AddStreamHandler(new XInventoryConnectorPostHandler(m_InventoryService));
+ }
+ }
+
+ public class XInventoryConnectorPostHandler : BaseStreamHandler
+ {
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ private IInventoryService m_InventoryService;
+
+ public XInventoryConnectorPostHandler(IInventoryService service) :
+ base("POST", "/xinventory")
+ {
+ m_InventoryService = service;
+ }
+
+ public override byte[] Handle(string path, Stream requestData,
+ OSHttpRequest httpRequest, OSHttpResponse httpResponse)
+ {
+ StreamReader sr = new StreamReader(requestData);
+ string body = sr.ReadToEnd();
+ sr.Close();
+ body = body.Trim();
+
+ //m_log.DebugFormat("[XXX]: query String: {0}", body);
+
+ try
+ {
+ Dictionary request =
+ ServerUtils.ParseQueryString(body);
+
+ if (!request.ContainsKey("METHOD"))
+ return FailureResult();
+
+ string method = request["METHOD"].ToString();
+ request.Remove("METHOD");
+
+ switch (method)
+ {
+ case "TEST":
+ return HandleTest(request);
+ }
+ m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method);
+ }
+ catch (Exception e)
+ {
+ m_log.Debug("[XINVENTORY HANDLER]: Exception {0}" + e);
+ }
+
+ return FailureResult();
+ }
+
+ private byte[] FailureResult()
+ {
+ XmlDocument doc = new XmlDocument();
+
+ XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
+ "", "");
+
+ doc.AppendChild(xmlnode);
+
+ XmlElement rootElement = doc.CreateElement("", "ServerResponse",
+ "");
+
+ doc.AppendChild(rootElement);
+
+ XmlElement result = doc.CreateElement("", "RESULT", "");
+ result.AppendChild(doc.CreateTextNode("False"));
+
+ rootElement.AppendChild(result);
+
+ return DocToBytes(doc);
+ }
+
+ private byte[] DocToBytes(XmlDocument doc)
+ {
+ MemoryStream ms = new MemoryStream();
+ XmlTextWriter xw = new XmlTextWriter(ms, null);
+ xw.Formatting = Formatting.Indented;
+ doc.WriteTo(xw);
+ xw.Flush();
+
+ return ms.ToArray();
+ }
+
+ byte[] HandleTest(Dictionary request)
+ {
+ Dictionary result = new Dictionary();
+
+ string xmlString = ServerUtils.BuildXmlResponse(result);
+ //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
+ UTF8Encoding encoding = new UTF8Encoding();
+ return encoding.GetBytes(xmlString);
+ }
+
+ }
+}
--
cgit v1.1
From 6d061d9f398adfa193f25c43604b517ad0d756a2 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Wed, 6 Jan 2010 22:00:19 +0000
Subject: Complete the XInventoryConnector. Flesh out the skeleton for the
XInventoryInConnector
---
.../Handlers/Inventory/XInventoryInConnector.cs | 225 ++++++++++++++++++++-
.../Connectors/Inventory/XInventoryConnector.cs | 50 ++++-
2 files changed, 268 insertions(+), 7 deletions(-)
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
index 8c6eca7..b48e30e 100644
--- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
+++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
@@ -92,7 +92,7 @@ namespace OpenSim.Server.Handlers.Asset
sr.Close();
body = body.Trim();
- //m_log.DebugFormat("[XXX]: query String: {0}", body);
+ m_log.DebugFormat("[XXX]: query String: {0}", body);
try
{
@@ -107,8 +107,44 @@ namespace OpenSim.Server.Handlers.Asset
switch (method)
{
- case "TEST":
- return HandleTest(request);
+ case "CREATEUSERINVENTORY":
+ return HandleCreateUserInventory(request);
+ case "GETINVENTORYSKELETON":
+ return HandleGetInventorySkeleton(request);
+ case "GETROOTFOLDER":
+ return HandleGetRootFolder(request);
+ case "GETFOLDERFORTYPE":
+ return HandleGetFolderForType(request);
+ case "GETFOLDERCONTENT":
+ return HandleGetFolderContent(request);
+ case "GETFOLDERITEMS":
+ return HandleGetFolderItems(request);
+ case "ADDFOLDER":
+ return HandleAddFolder(request);
+ case "UPDATEFOLDER":
+ return HandleUpdateFolder(request);
+ case "MOVEFOLDER":
+ return HandleMoveFolder(request);
+ case "DELETEFOLDERS":
+ return HandleDeleteFolders(request);
+ case "PURGEFOLDER":
+ return HandlePurgeFolder(request);
+ case "ADDITEM":
+ return HandleAddItem(request);
+ case "UPDATEITEM":
+ return HandleUpdateItem(request);
+ case "MOVEITEMS":
+ return HandleMoveItems(request);
+ case "DELETEITEMS":
+ return HandleDeleteItems(request);
+ case "GETITEM":
+ return HandleGetItem(request);
+ case "GETFOLDER":
+ return HandleGetFolder(request);
+ case "GETACTIVEGESTURES":
+ return HandleGetActiveGestures(request);
+ case "GETASSETPERMISSIONS":
+ return HandleGetAssetPermissions(request);
}
m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method);
}
@@ -153,15 +189,194 @@ namespace OpenSim.Server.Handlers.Asset
return ms.ToArray();
}
- byte[] HandleTest(Dictionary request)
+ byte[] HandleCreateUserInventory(Dictionary request)
{
Dictionary result = new Dictionary();
string xmlString = ServerUtils.BuildXmlResponse(result);
- //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
+ m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
}
+ byte[] HandleGetInventorySkeleton(Dictionary request)
+ {
+ Dictionary result = new Dictionary();
+
+ string xmlString = ServerUtils.BuildXmlResponse(result);
+ m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
+ UTF8Encoding encoding = new UTF8Encoding();
+ return encoding.GetBytes(xmlString);
+ }
+
+ byte[] HandleGetRootFolder(Dictionary request)
+ {
+ Dictionary result = new Dictionary();
+
+ string xmlString = ServerUtils.BuildXmlResponse(result);
+ m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
+ UTF8Encoding encoding = new UTF8Encoding();
+ return encoding.GetBytes(xmlString);
+ }
+
+ byte[] HandleGetFolderForType(Dictionary request)
+ {
+ Dictionary result = new Dictionary();
+
+ string xmlString = ServerUtils.BuildXmlResponse(result);
+ m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
+ UTF8Encoding encoding = new UTF8Encoding();
+ return encoding.GetBytes(xmlString);
+ }
+
+ byte[] HandleGetFolderContent(Dictionary request)
+ {
+ Dictionary result = new Dictionary();
+
+ string xmlString = ServerUtils.BuildXmlResponse(result);
+ m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
+ UTF8Encoding encoding = new UTF8Encoding();
+ return encoding.GetBytes(xmlString);
+ }
+
+ byte[] HandleGetFolderItems(Dictionary request)
+ {
+ Dictionary result = new Dictionary();
+
+ string xmlString = ServerUtils.BuildXmlResponse(result);
+ m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
+ UTF8Encoding encoding = new UTF8Encoding();
+ return encoding.GetBytes(xmlString);
+ }
+
+ byte[] HandleAddFolder(Dictionary request)
+ {
+ Dictionary result = new Dictionary();
+
+ string xmlString = ServerUtils.BuildXmlResponse(result);
+ m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
+ UTF8Encoding encoding = new UTF8Encoding();
+ return encoding.GetBytes(xmlString);
+ }
+
+ byte[] HandleUpdateFolder(Dictionary request)
+ {
+ Dictionary result = new Dictionary();
+
+ string xmlString = ServerUtils.BuildXmlResponse(result);
+ m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
+ UTF8Encoding encoding = new UTF8Encoding();
+ return encoding.GetBytes(xmlString);
+ }
+
+ byte[] HandleMoveFolder(Dictionary request)
+ {
+ Dictionary result = new Dictionary();
+
+ string xmlString = ServerUtils.BuildXmlResponse(result);
+ m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
+ UTF8Encoding encoding = new UTF8Encoding();
+ return encoding.GetBytes(xmlString);
+ }
+
+ byte[] HandleDeleteFolders(Dictionary request)
+ {
+ Dictionary result = new Dictionary();
+
+ string xmlString = ServerUtils.BuildXmlResponse(result);
+ m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
+ UTF8Encoding encoding = new UTF8Encoding();
+ return encoding.GetBytes(xmlString);
+ }
+
+ byte[] HandlePurgeFolder(Dictionary request)
+ {
+ Dictionary result = new Dictionary();
+
+ string xmlString = ServerUtils.BuildXmlResponse(result);
+ m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
+ UTF8Encoding encoding = new UTF8Encoding();
+ return encoding.GetBytes(xmlString);
+ }
+
+ byte[] HandleAddItem(Dictionary request)
+ {
+ Dictionary result = new Dictionary();
+
+ string xmlString = ServerUtils.BuildXmlResponse(result);
+ m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
+ UTF8Encoding encoding = new UTF8Encoding();
+ return encoding.GetBytes(xmlString);
+ }
+
+ byte[] HandleUpdateItem(Dictionary request)
+ {
+ Dictionary result = new Dictionary();
+
+ string xmlString = ServerUtils.BuildXmlResponse(result);
+ m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
+ UTF8Encoding encoding = new UTF8Encoding();
+ return encoding.GetBytes(xmlString);
+ }
+
+ byte[] HandleMoveItems(Dictionary request)
+ {
+ Dictionary result = new Dictionary();
+
+ string xmlString = ServerUtils.BuildXmlResponse(result);
+ m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
+ UTF8Encoding encoding = new UTF8Encoding();
+ return encoding.GetBytes(xmlString);
+ }
+
+ byte[] HandleDeleteItems(Dictionary request)
+ {
+ Dictionary result = new Dictionary();
+
+ string xmlString = ServerUtils.BuildXmlResponse(result);
+ m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
+ UTF8Encoding encoding = new UTF8Encoding();
+ return encoding.GetBytes(xmlString);
+ }
+
+ byte[] HandleGetItem(Dictionary request)
+ {
+ Dictionary result = new Dictionary();
+
+ string xmlString = ServerUtils.BuildXmlResponse(result);
+ m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
+ UTF8Encoding encoding = new UTF8Encoding();
+ return encoding.GetBytes(xmlString);
+ }
+
+ byte[] HandleGetFolder(Dictionary request)
+ {
+ Dictionary result = new Dictionary();
+
+ string xmlString = ServerUtils.BuildXmlResponse(result);
+ m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
+ UTF8Encoding encoding = new UTF8Encoding();
+ return encoding.GetBytes(xmlString);
+ }
+
+ byte[] HandleGetActiveGestures(Dictionary request)
+ {
+ Dictionary result = new Dictionary();
+
+ string xmlString = ServerUtils.BuildXmlResponse(result);
+ m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
+ UTF8Encoding encoding = new UTF8Encoding();
+ return encoding.GetBytes(xmlString);
+ }
+
+ byte[] HandleGetAssetPermissions(Dictionary request)
+ {
+ Dictionary result = new Dictionary();
+
+ string xmlString = ServerUtils.BuildXmlResponse(result);
+ m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
+ UTF8Encoding encoding = new UTF8Encoding();
+ return encoding.GetBytes(xmlString);
+ }
}
}
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
index aac1a83..40acd6d 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
@@ -149,12 +149,58 @@ namespace OpenSim.Services.Connectors
public InventoryCollection GetFolderContent(UUID principalID, UUID folderID)
{
- return null;
+ Dictionary ret = MakeRequest("GETFOLDERCONTENT",
+ new Dictionary