Complete the XInventoryConnector. Flesh out the skeleton for the
XInventoryInConnectormysql-performance
parent
68eba8973c
commit
6d061d9f39
|
@ -92,7 +92,7 @@ namespace OpenSim.Server.Handlers.Asset
|
||||||
sr.Close();
|
sr.Close();
|
||||||
body = body.Trim();
|
body = body.Trim();
|
||||||
|
|
||||||
//m_log.DebugFormat("[XXX]: query String: {0}", body);
|
m_log.DebugFormat("[XXX]: query String: {0}", body);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -107,8 +107,44 @@ namespace OpenSim.Server.Handlers.Asset
|
||||||
|
|
||||||
switch (method)
|
switch (method)
|
||||||
{
|
{
|
||||||
case "TEST":
|
case "CREATEUSERINVENTORY":
|
||||||
return HandleTest(request);
|
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);
|
m_log.DebugFormat("[XINVENTORY HANDLER]: unknown method request: {0}", method);
|
||||||
}
|
}
|
||||||
|
@ -153,15 +189,194 @@ namespace OpenSim.Server.Handlers.Asset
|
||||||
return ms.ToArray();
|
return ms.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] HandleTest(Dictionary<string,object> request)
|
byte[] HandleCreateUserInventory(Dictionary<string,object> request)
|
||||||
{
|
{
|
||||||
Dictionary<string,object> result = new Dictionary<string,object>();
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
|
||||||
string xmlString = ServerUtils.BuildXmlResponse(result);
|
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();
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
return encoding.GetBytes(xmlString);
|
return encoding.GetBytes(xmlString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
byte[] HandleGetInventorySkeleton(Dictionary<string,object> request)
|
||||||
|
{
|
||||||
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] HandleGetRootFolder(Dictionary<string,object> request)
|
||||||
|
{
|
||||||
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] HandleGetFolderForType(Dictionary<string,object> request)
|
||||||
|
{
|
||||||
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] HandleGetFolderContent(Dictionary<string,object> request)
|
||||||
|
{
|
||||||
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] HandleGetFolderItems(Dictionary<string,object> request)
|
||||||
|
{
|
||||||
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] HandleAddFolder(Dictionary<string,object> request)
|
||||||
|
{
|
||||||
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] HandleUpdateFolder(Dictionary<string,object> request)
|
||||||
|
{
|
||||||
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] HandleMoveFolder(Dictionary<string,object> request)
|
||||||
|
{
|
||||||
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] HandleDeleteFolders(Dictionary<string,object> request)
|
||||||
|
{
|
||||||
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] HandlePurgeFolder(Dictionary<string,object> request)
|
||||||
|
{
|
||||||
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] HandleAddItem(Dictionary<string,object> request)
|
||||||
|
{
|
||||||
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] HandleUpdateItem(Dictionary<string,object> request)
|
||||||
|
{
|
||||||
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] HandleMoveItems(Dictionary<string,object> request)
|
||||||
|
{
|
||||||
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] HandleDeleteItems(Dictionary<string,object> request)
|
||||||
|
{
|
||||||
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] HandleGetItem(Dictionary<string,object> request)
|
||||||
|
{
|
||||||
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] HandleGetFolder(Dictionary<string,object> request)
|
||||||
|
{
|
||||||
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] HandleGetActiveGestures(Dictionary<string,object> request)
|
||||||
|
{
|
||||||
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] HandleGetAssetPermissions(Dictionary<string,object> request)
|
||||||
|
{
|
||||||
|
Dictionary<string,object> result = new Dictionary<string,object>();
|
||||||
|
|
||||||
|
string xmlString = ServerUtils.BuildXmlResponse(result);
|
||||||
|
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
|
||||||
|
UTF8Encoding encoding = new UTF8Encoding();
|
||||||
|
return encoding.GetBytes(xmlString);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,12 +149,58 @@ namespace OpenSim.Services.Connectors
|
||||||
|
|
||||||
public InventoryCollection GetFolderContent(UUID principalID, UUID folderID)
|
public InventoryCollection GetFolderContent(UUID principalID, UUID folderID)
|
||||||
{
|
{
|
||||||
|
Dictionary<string,object> ret = MakeRequest("GETFOLDERCONTENT",
|
||||||
|
new Dictionary<string,object> {
|
||||||
|
{ "PRINCIPAL", principalID.ToString() },
|
||||||
|
{ "FOLDER", folderID.ToString() }
|
||||||
|
});
|
||||||
|
|
||||||
|
if (ret == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
if (ret.Count == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
|
||||||
|
InventoryCollection inventory = new InventoryCollection();
|
||||||
|
inventory.Folders = new List<InventoryFolderBase>();
|
||||||
|
inventory.Items = new List<InventoryItemBase>();
|
||||||
|
inventory.UserID = principalID;
|
||||||
|
|
||||||
|
Dictionary<string,object> folders =
|
||||||
|
(Dictionary<string,object>)ret["FOLDERS"];
|
||||||
|
Dictionary<string,object> items =
|
||||||
|
(Dictionary<string,object>)ret["ITEMS"];
|
||||||
|
|
||||||
|
foreach (Object o in folders.Values)
|
||||||
|
inventory.Folders.Add(BuildFolder((Dictionary<string,object>)o));
|
||||||
|
foreach (Object o in items.Values)
|
||||||
|
inventory.Items.Add(BuildItem((Dictionary<string,object>)o));
|
||||||
|
|
||||||
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID)
|
public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID)
|
||||||
{
|
{
|
||||||
|
Dictionary<string,object> ret = MakeRequest("GETFOLDERCONTENT",
|
||||||
|
new Dictionary<string,object> {
|
||||||
|
{ "PRINCIPAL", principalID.ToString() },
|
||||||
|
{ "FOLDER", folderID.ToString() }
|
||||||
|
});
|
||||||
|
|
||||||
|
if (ret == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
if (ret.Count == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
|
||||||
|
List<InventoryItemBase> items = new List<InventoryItemBase>();
|
||||||
|
|
||||||
|
foreach (Object o in ret.Values)
|
||||||
|
items.Add(BuildItem((Dictionary<string,object>)o));
|
||||||
|
|
||||||
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddFolder(InventoryFolderBase folder)
|
public bool AddFolder(InventoryFolderBase folder)
|
||||||
|
|
Loading…
Reference in New Issue