Complete the XInventoryConnector. Flesh out the skeleton for the

XInventoryInConnector
mysql-performance
Melanie 2010-01-06 22:00:19 +00:00
parent 68eba8973c
commit 6d061d9f39
2 changed files with 268 additions and 7 deletions

View File

@ -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<string,object> request)
byte[] HandleCreateUserInventory(Dictionary<string,object> request)
{
Dictionary<string,object> result = new Dictionary<string,object>();
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<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);
}
}
}

View File

@ -149,12 +149,58 @@ namespace OpenSim.Services.Connectors
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;
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)
{
Dictionary<string,object> ret = MakeRequest("GETFOLDERCONTENT",
new Dictionary<string,object> {
{ "PRINCIPAL", principalID.ToString() },
{ "FOLDER", folderID.ToString() }
});
if (ret == 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)