XInventory connector/handler showing signs of life. Tested, but needs more testing.

slimupdates
Diva Canto 2010-04-27 11:01:56 -07:00
parent a92ca3c2c9
commit 3f9d38538e
5 changed files with 139 additions and 69 deletions

View File

@ -45,6 +45,7 @@
<RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.HGAssetBroker" /> <RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.HGAssetBroker" />
<RegionModule id="LocalInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.LocalInventoryServicesConnector" /> <RegionModule id="LocalInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.LocalInventoryServicesConnector" />
<RegionModule id="RemoteInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteInventoryServicesConnector" /> <RegionModule id="RemoteInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteInventoryServicesConnector" />
<RegionModule id="RemoteXInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteXInventoryServicesConnector" />
<RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" /> <RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" />
<RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" /> <RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" />
<RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" /> <RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" />

View File

@ -183,6 +183,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
public override InventoryCollection GetFolderContent(UUID userID, UUID folderID) public override InventoryCollection GetFolderContent(UUID userID, UUID folderID)
{ {
m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolderContent {0}", folderID);
try try
{ {
return m_RemoteConnector.GetFolderContent(userID, folderID); return m_RemoteConnector.GetFolderContent(userID, folderID);
@ -295,6 +296,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
public override InventoryFolderBase GetFolder(InventoryFolderBase folder) public override InventoryFolderBase GetFolder(InventoryFolderBase folder)
{ {
m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID);
if (folder == null) if (folder == null)
return null; return null;

View File

@ -228,9 +228,17 @@ namespace OpenSim.Server.Handlers.Asset
List<InventoryFolderBase> folders = m_InventoryService.GetInventorySkeleton(new UUID(request["PRINCIPAL"].ToString())); List<InventoryFolderBase> folders = m_InventoryService.GetInventorySkeleton(new UUID(request["PRINCIPAL"].ToString()));
Dictionary<string, object> sfolders = new Dictionary<string, object>();
if (folders != null) if (folders != null)
{
int i = 0;
foreach (InventoryFolderBase f in folders) foreach (InventoryFolderBase f in folders)
result[f.ID.ToString()] = EncodeFolder(f); {
sfolders["folder_" + i.ToString()] = EncodeFolder(f);
i++;
}
}
result["FOLDERS"] = sfolders;
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
@ -246,7 +254,7 @@ namespace OpenSim.Server.Handlers.Asset
UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); UUID.TryParse(request["PRINCIPAL"].ToString(), out principal);
InventoryFolderBase rfolder = m_InventoryService.GetRootFolder(principal); InventoryFolderBase rfolder = m_InventoryService.GetRootFolder(principal);
if (rfolder != null) if (rfolder != null)
result[rfolder.ID.ToString()] = EncodeFolder(rfolder); result["folder"] = EncodeFolder(rfolder);
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
@ -263,7 +271,7 @@ namespace OpenSim.Server.Handlers.Asset
Int32.TryParse(request["TYPE"].ToString(), out type); Int32.TryParse(request["TYPE"].ToString(), out type);
InventoryFolderBase folder = m_InventoryService.GetFolderForType(principal, (AssetType)type); InventoryFolderBase folder = m_InventoryService.GetFolderForType(principal, (AssetType)type);
if (folder != null) if (folder != null)
result[folder.ID.ToString()] = EncodeFolder(folder); result["folder"] = EncodeFolder(folder);
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
@ -283,13 +291,21 @@ namespace OpenSim.Server.Handlers.Asset
if (icoll != null) if (icoll != null)
{ {
Dictionary<string, object> folders = new Dictionary<string, object>(); Dictionary<string, object> folders = new Dictionary<string, object>();
int i = 0;
foreach (InventoryFolderBase f in icoll.Folders) foreach (InventoryFolderBase f in icoll.Folders)
folders[f.ID.ToString()] = EncodeFolder(f); {
folders["folder_" + i.ToString()] = EncodeFolder(f);
i++;
}
result["FOLDERS"] = folders; result["FOLDERS"] = folders;
i = 0;
Dictionary<string, object> items = new Dictionary<string, object>(); Dictionary<string, object> items = new Dictionary<string, object>();
foreach (InventoryItemBase i in icoll.Items) foreach (InventoryItemBase it in icoll.Items)
items[i.ID.ToString()] = EncodeItem(i); {
items["item_" + i.ToString()] = EncodeItem(it);
i++;
}
result["ITEMS"] = items; result["ITEMS"] = items;
} }
@ -308,9 +324,18 @@ namespace OpenSim.Server.Handlers.Asset
UUID.TryParse(request["FOLDER"].ToString(), out folderID); UUID.TryParse(request["FOLDER"].ToString(), out folderID);
List<InventoryItemBase> items = m_InventoryService.GetFolderItems(principal, folderID); List<InventoryItemBase> items = m_InventoryService.GetFolderItems(principal, folderID);
Dictionary<string, object> sitems = new Dictionary<string, object>();
if (items != null) if (items != null)
{
int i = 0;
foreach (InventoryItemBase item in items) foreach (InventoryItemBase item in items)
result[item.ID.ToString()] = EncodeItem(item); {
sitems["item_" + i.ToString()] = EncodeItem(item);
i++;
}
}
result["ITEMS"] = sitems;
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
@ -483,7 +508,7 @@ namespace OpenSim.Server.Handlers.Asset
InventoryItemBase item = new InventoryItemBase(id); InventoryItemBase item = new InventoryItemBase(id);
item = m_InventoryService.GetItem(item); item = m_InventoryService.GetItem(item);
if (item != null) if (item != null)
result[item.ID.ToString()] = EncodeItem(item); result["item"] = EncodeItem(item);
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
@ -500,7 +525,7 @@ namespace OpenSim.Server.Handlers.Asset
InventoryFolderBase folder = new InventoryFolderBase(id); InventoryFolderBase folder = new InventoryFolderBase(id);
folder = m_InventoryService.GetFolder(folder); folder = m_InventoryService.GetFolder(folder);
if (folder != null) if (folder != null)
result[folder.ID.ToString()] = EncodeFolder(folder); result["folder"] = EncodeFolder(folder);
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
@ -515,9 +540,17 @@ namespace OpenSim.Server.Handlers.Asset
UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); UUID.TryParse(request["PRINCIPAL"].ToString(), out principal);
List<InventoryItemBase> gestures = m_InventoryService.GetActiveGestures(principal); List<InventoryItemBase> gestures = m_InventoryService.GetActiveGestures(principal);
Dictionary<string, object> items = new Dictionary<string, object>();
if (gestures != null) if (gestures != null)
{
int i = 0;
foreach (InventoryItemBase item in gestures) foreach (InventoryItemBase item in gestures)
result[item.ID.ToString()] = EncodeItem(item); {
items["item_" + i.ToString()] = EncodeItem(item);
i++;
}
}
result["ITEMS"] = items;
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
@ -549,10 +582,16 @@ namespace OpenSim.Server.Handlers.Asset
UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); UUID.TryParse(request["PRINCIPAL"].ToString(), out principal);
Dictionary<AssetType, InventoryFolderBase> sfolders = GetSystemFolders(principal); Dictionary<AssetType, InventoryFolderBase> sfolders = GetSystemFolders(principal);
m_log.DebugFormat("[XXX]: SystemFolders got {0} folders", sfolders.Count);
if (sfolders != null) Dictionary<string, object> folders = new Dictionary<string, object>();
int i = 0;
foreach (KeyValuePair<AssetType, InventoryFolderBase> kvp in sfolders) foreach (KeyValuePair<AssetType, InventoryFolderBase> kvp in sfolders)
result[kvp.Key.ToString()] = EncodeFolder(kvp.Value); {
folders["folder_" + i.ToString()] = EncodeFolder(kvp.Value);
i++;
}
result["FOLDERS"] = folders;
string xmlString = ServerUtils.BuildXmlResponse(result); string xmlString = ServerUtils.BuildXmlResponse(result);
m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
@ -589,7 +628,7 @@ namespace OpenSim.Server.Handlers.Asset
ret["Flags"] = item.Flags.ToString(); ret["Flags"] = item.Flags.ToString();
ret["Folder"] = item.Folder.ToString(); ret["Folder"] = item.Folder.ToString();
ret["GroupID"] = item.GroupID.ToString(); ret["GroupID"] = item.GroupID.ToString();
ret["GroupedOwned"] = item.GroupOwned.ToString(); ret["GroupOwned"] = item.GroupOwned.ToString();
ret["GroupPermissions"] = item.GroupPermissions.ToString(); ret["GroupPermissions"] = item.GroupPermissions.ToString();
ret["ID"] = item.ID.ToString(); ret["ID"] = item.ID.ToString();
ret["InvType"] = item.InvType.ToString(); ret["InvType"] = item.InvType.ToString();
@ -664,7 +703,7 @@ namespace OpenSim.Server.Handlers.Asset
return folders; return folders;
} }
} }
m_log.WarnFormat("[INVENTORY SERVICE]: System folders for {0} not found", userID); m_log.WarnFormat("[XINVENTORY SERVICE]: System folders for {0} not found", userID);
return new Dictionary<AssetType, InventoryFolderBase>(); return new Dictionary<AssetType, InventoryFolderBase>();
} }
#endregion #endregion

View File

@ -112,8 +112,15 @@ namespace OpenSim.Services.Connectors
List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
try
{
foreach (Object o in ret.Values) foreach (Object o in ret.Values)
folders.Add(BuildFolder((Dictionary<string, object>)o)); folders.Add(BuildFolder((Dictionary<string, object>)o));
}
catch (Exception e)
{
m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception unwrapping folder list: {0}", e.Message);
}
return folders; return folders;
} }
@ -130,7 +137,7 @@ namespace OpenSim.Services.Connectors
if (ret.Count == 0) if (ret.Count == 0)
return null; return null;
return BuildFolder(ret); return BuildFolder((Dictionary<string, object>)ret["folder"]);
} }
public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)
@ -146,7 +153,7 @@ namespace OpenSim.Services.Connectors
if (ret.Count == 0) if (ret.Count == 0)
return null; return null;
return BuildFolder(ret); return BuildFolder((Dictionary<string, object>)ret["folder"]);
} }
public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) public InventoryCollection GetFolderContent(UUID principalID, UUID folderID)
@ -173,10 +180,17 @@ namespace OpenSim.Services.Connectors
Dictionary<string,object> items = Dictionary<string,object> items =
(Dictionary<string,object>)ret["ITEMS"]; (Dictionary<string,object>)ret["ITEMS"];
foreach (Object o in folders.Values) try
{
foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i
inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o)); inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o));
foreach (Object o in items.Values) foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i
inventory.Items.Add(BuildItem((Dictionary<string, object>)o)); inventory.Items.Add(BuildItem((Dictionary<string, object>)o));
}
catch (Exception e)
{
m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception unwrapping content list: {0}", e.Message);
}
return inventory; return inventory;
} }
@ -194,13 +208,12 @@ namespace OpenSim.Services.Connectors
if (ret.Count == 0) if (ret.Count == 0)
return null; return null;
Dictionary<string, object> items = (Dictionary<string, object>)ret["ITEMS"];
List<InventoryItemBase> fitems = new List<InventoryItemBase>();
foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i
fitems.Add(BuildItem((Dictionary<string, object>)o));
List<InventoryItemBase> items = new List<InventoryItemBase>(); return fitems;
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)
@ -405,7 +418,7 @@ namespace OpenSim.Services.Connectors
if (ret.Count == 0) if (ret.Count == 0)
return null; return null;
return BuildItem(ret); return BuildItem((Dictionary<string, object>)ret["item"]);
} }
public InventoryFolderBase GetFolder(InventoryFolderBase folder) public InventoryFolderBase GetFolder(InventoryFolderBase folder)
@ -420,7 +433,7 @@ namespace OpenSim.Services.Connectors
if (ret.Count == 0) if (ret.Count == 0)
return null; return null;
return BuildFolder(ret); return BuildFolder((Dictionary<string, object>)ret["folder"]);
} }
public List<InventoryItemBase> GetActiveGestures(UUID principalID) public List<InventoryItemBase> GetActiveGestures(UUID principalID)
@ -435,7 +448,7 @@ namespace OpenSim.Services.Connectors
List<InventoryItemBase> items = new List<InventoryItemBase>(); List<InventoryItemBase> items = new List<InventoryItemBase>();
foreach (Object o in ret.Values) foreach (Object o in ret.Values) // getting the values directly, we don't care about the keys item_i
items.Add(BuildItem((Dictionary<string, object>)o)); items.Add(BuildItem((Dictionary<string, object>)o));
return items; return items;
@ -469,13 +482,14 @@ namespace OpenSim.Services.Connectors
try try
{ {
foreach (KeyValuePair<string, object> kvp in ret) Dictionary<string, object> folders = (Dictionary<string, object>)ret["FOLDERS"];
foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i
{ {
InventoryFolderBase folder = BuildFolder((Dictionary<string, object>)(kvp.Value)); InventoryFolderBase folder = BuildFolder((Dictionary<string, object>)o);
short type = 0; sfolders.Add((AssetType)folder.Type, folder);
if (Int16.TryParse(kvp.Key, out type))
sfolders.Add((AssetType)type, folder);
} }
} }
catch (Exception e) catch (Exception e)
{ {
@ -522,12 +536,19 @@ namespace OpenSim.Services.Connectors
{ {
InventoryFolderBase folder = new InventoryFolderBase(); InventoryFolderBase folder = new InventoryFolderBase();
try
{
folder.ParentID = new UUID(data["ParentID"].ToString()); folder.ParentID = new UUID(data["ParentID"].ToString());
folder.Type = short.Parse(data["Type"].ToString()); folder.Type = short.Parse(data["Type"].ToString());
folder.Version = ushort.Parse(data["Version"].ToString()); folder.Version = ushort.Parse(data["Version"].ToString());
folder.Name = data["Name"].ToString(); folder.Name = data["Name"].ToString();
folder.Owner = new UUID(data["Owner"].ToString()); folder.Owner = new UUID(data["Owner"].ToString());
folder.ID = new UUID(data["ID"].ToString()); folder.ID = new UUID(data["ID"].ToString());
}
catch (Exception e)
{
m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception building folder: {0}", e.Message);
}
return folder; return folder;
} }
@ -536,6 +557,8 @@ namespace OpenSim.Services.Connectors
{ {
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
try
{
item.AssetID = new UUID(data["AssetID"].ToString()); item.AssetID = new UUID(data["AssetID"].ToString());
item.AssetType = int.Parse(data["AssetType"].ToString()); item.AssetType = int.Parse(data["AssetType"].ToString());
item.Name = data["Name"].ToString(); item.Name = data["Name"].ToString();
@ -556,6 +579,11 @@ namespace OpenSim.Services.Connectors
item.SaleType = byte.Parse(data["SaleType"].ToString()); item.SaleType = byte.Parse(data["SaleType"].ToString());
item.Flags = uint.Parse(data["Flags"].ToString()); item.Flags = uint.Parse(data["Flags"].ToString());
item.CreationDate = int.Parse(data["CreationDate"].ToString()); item.CreationDate = int.Parse(data["CreationDate"].ToString());
}
catch (Exception e)
{
m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception building item: {0}", e.Message);
}
return item; return item;
} }

View File

@ -184,7 +184,7 @@ namespace OpenSim.Services.InventoryService
foreach (XInventoryFolder x in allFolders) foreach (XInventoryFolder x in allFolders)
{ {
m_log.DebugFormat("[INVENTORY]: Adding folder {0} to skeleton", x.folderName); m_log.DebugFormat("[XINVENTORY]: Adding folder {0} to skeleton", x.folderName);
folders.Add(ConvertToOpenSim(x)); folders.Add(ConvertToOpenSim(x));
} }
@ -221,7 +221,7 @@ namespace OpenSim.Services.InventoryService
// connector. So we disregard the principal and look // connector. So we disregard the principal and look
// by ID. // by ID.
// //
m_log.DebugFormat("[INVENTORY]: Fetch contents for folder {0}", folderID.ToString()); m_log.DebugFormat("[XINVENTORY]: Fetch contents for folder {0}", folderID.ToString());
InventoryCollection inventory = new InventoryCollection(); InventoryCollection inventory = new InventoryCollection();
inventory.UserID = principalID; inventory.UserID = principalID;
inventory.Folders = new List<InventoryFolderBase>(); inventory.Folders = new List<InventoryFolderBase>();
@ -233,7 +233,7 @@ namespace OpenSim.Services.InventoryService
foreach (XInventoryFolder x in folders) foreach (XInventoryFolder x in folders)
{ {
m_log.DebugFormat("[INVENTORY]: Adding folder {0} to response", x.folderName); m_log.DebugFormat("[XINVENTORY]: Adding folder {0} to response", x.folderName);
inventory.Folders.Add(ConvertToOpenSim(x)); inventory.Folders.Add(ConvertToOpenSim(x));
} }
@ -243,7 +243,7 @@ namespace OpenSim.Services.InventoryService
foreach (XInventoryItem i in items) foreach (XInventoryItem i in items)
{ {
m_log.DebugFormat("[INVENTORY]: Adding item {0} to response", i.inventoryName); m_log.DebugFormat("[XINVENTORY]: Adding item {0} to response", i.inventoryName);
inventory.Items.Add(ConvertToOpenSim(i)); inventory.Items.Add(ConvertToOpenSim(i));
} }