* Rex merge, OGS1 Merged fairly cleanly.

afrisby-3
Adam Frisby 2008-02-23 03:36:50 +00:00
parent fe50f2e6b9
commit d6e571517f
6 changed files with 2489 additions and 2095 deletions

View File

@ -1,49 +1,49 @@
/*
* 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 OpenSim 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 OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Servers;
namespace OpenSim.Region.Communications.OGS1
{
public class CommunicationsOGS1 : CommunicationsManager
{
public CommunicationsOGS1(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache)
: base(serversInfo, httpServer, assetCache, false)
{
OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer);
m_gridService = gridInterComms;
m_interRegion = gridInterComms;
m_inventoryService = new OGS1InventoryService(serversInfo.InventoryURL);
m_userService = new OGS1UserServices(this);
}
}
}
/*
* 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 OpenSim 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 OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Servers;
namespace OpenSim.Region.Communications.OGS1
{
public class CommunicationsOGS1 : CommunicationsManager
{
public CommunicationsOGS1(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache)
: base(serversInfo, httpServer, assetCache, false)
{
OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer);
m_gridService = gridInterComms;
m_interRegion = gridInterComms;
m_inventoryService = new OGS1InventoryService(serversInfo.InventoryURL);
m_userService = new OGS1UserServices(this);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,219 +1,262 @@
/*
* 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 OpenSim 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.Runtime.Remoting;
using libsecondlife;
using OpenSim.Framework;
namespace OpenSim.Region.Communications.OGS1
{
public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData);
public delegate bool ExpectArrival(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying);
public delegate bool InformRegionPrimGroup(ulong regionHandle, LLUUID primID, LLVector3 Positon, bool isPhysical);
public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData);
public delegate bool RegionUp(SearializableRegionInfo region, ulong regionhandle);
public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate childUpdate);
public sealed class InterRegionSingleton
{
private static readonly InterRegionSingleton instance = new InterRegionSingleton();
public event InformRegionChild OnChildAgent;
public event ExpectArrival OnArrival;
public event InformRegionPrimGroup OnPrimGroupNear;
public event PrimGroupArrival OnPrimGroupArrival;
public event RegionUp OnRegionUp;
public event ChildAgentUpdate OnChildAgentUpdate;
static InterRegionSingleton()
{
}
private InterRegionSingleton()
{
}
public static InterRegionSingleton Instance
{
get { return instance; }
}
public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
if (OnChildAgent != null)
{
return OnChildAgent(regionHandle, agentData);
}
return false;
}
public bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle)
{
if (OnRegionUp != null)
{
return OnRegionUp(sregion, regionhandle);
}
return false;
}
public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentUpdate)
{
if (OnChildAgentUpdate != null)
{
return OnChildAgentUpdate(regionHandle, cAgentUpdate);
}
return false;
}
public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
{
if (OnArrival != null)
{
return OnArrival(regionHandle, agentID, position, isFlying);
}
return false;
}
public bool InformRegionPrim(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical)
{
if (OnPrimGroupNear != null)
{
return OnPrimGroupNear(regionHandle, primID, position, isPhysical);
}
return false;
}
public bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, string objData)
{
if (OnPrimGroupArrival != null)
{
return OnPrimGroupArrival(regionHandle, primID, objData);
}
return false;
}
}
public class OGS1InterRegionRemoting : MarshalByRefObject
{
public OGS1InterRegionRemoting()
{
}
public bool InformRegionOfChildAgent(ulong regionHandle, sAgentCircuitData agentData)
{
try
{
return
InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, new AgentCircuitData(agentData));
}
catch (RemotingException e)
{
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false;
}
}
public bool RegionUp(SearializableRegionInfo region, ulong regionhandle)
{
try
{
return InterRegionSingleton.Instance.RegionUp(region, regionhandle);
}
catch (RemotingException e)
{
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false;
}
}
public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{
try
{
return InterRegionSingleton.Instance.ChildAgentUpdate(regionHandle, cAgentData);
}
catch (RemotingException e)
{
Console.WriteLine("Remoting Error: Unable to send Child agent update to remote region.\n" + e.ToString());
return false;
}
}
public bool ExpectAvatarCrossing(ulong regionHandle, Guid agentID, sLLVector3 position, bool isFlying)
{
try
{
return
InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, new LLUUID(agentID),
new LLVector3(position.x, position.y, position.z),
isFlying);
}
catch (RemotingException e)
{
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false;
}
}
public bool InformRegionPrim(ulong regionHandle, Guid SceneObjectGroupID, sLLVector3 position, bool isPhysical)
{
try
{
return
InterRegionSingleton.Instance.InformRegionPrim(regionHandle, new LLUUID(SceneObjectGroupID),
new LLVector3(position.x, position.y, position.z),
isPhysical);
}
catch (RemotingException e)
{
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false;
}
}
public bool InformRegionOfPrimCrossing(ulong regionHandle, Guid primID, string objData)
{
try
{
return InterRegionSingleton.Instance.ExpectPrimCrossing(regionHandle, new LLUUID(primID), objData);
}
catch (RemotingException e)
{
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false;
}
}
}
}
/*
* 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 OpenSim 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.Runtime.Remoting;
using libsecondlife;
using OpenSim.Framework;
namespace OpenSim.Region.Communications.OGS1
{
public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData);
public delegate bool ExpectArrival(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying);
public delegate bool InformRegionPrimGroup(ulong regionHandle, LLUUID primID, LLVector3 Positon, bool isPhysical);
public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData);
public delegate bool RegionUp(SearializableRegionInfo region, ulong regionhandle);
public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate childUpdate);
public delegate bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID);
public sealed class InterRegionSingleton
{
private static readonly InterRegionSingleton instance = new InterRegionSingleton();
public event InformRegionChild OnChildAgent;
public event ExpectArrival OnArrival;
public event InformRegionPrimGroup OnPrimGroupNear;
public event PrimGroupArrival OnPrimGroupArrival;
public event RegionUp OnRegionUp;
public event ChildAgentUpdate OnChildAgentUpdate;
public event TellRegionToCloseChildConnection OnTellRegionToCloseChildConnection;
private InformRegionChild handler001 = null; // OnChildAgent;
private ExpectArrival handler002 = null; // OnArrival;
private InformRegionPrimGroup handler003 = null; // OnPrimGroupNear;
private PrimGroupArrival handler004 = null; // OnPrimGroupArrival;
private RegionUp handler005 = null; // OnRegionUp;
private ChildAgentUpdate handler006 = null; // OnChildAgentUpdate;
private TellRegionToCloseChildConnection handler007 = null; // OnTellRegionToCloseChildConnection;
static InterRegionSingleton()
{
}
private InterRegionSingleton()
{
}
public static InterRegionSingleton Instance
{
get { return instance; }
}
public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
{
handler001 = OnChildAgent;
if (handler001 != null)
{
return handler001(regionHandle, agentData);
}
return false;
}
public bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle)
{
handler005 = OnRegionUp;
if (handler005 != null)
{
return handler005(sregion, regionhandle);
}
return false;
}
public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentUpdate)
{
handler006 = OnChildAgentUpdate;
if (handler006 != null)
{
return handler006(regionHandle, cAgentUpdate);
}
return false;
}
public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
{
handler002 = OnArrival;
if (handler002 != null)
{
return handler002(regionHandle, agentID, position, isFlying);
}
return false;
}
public bool InformRegionPrim(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical)
{
handler003 = OnPrimGroupNear;
if (handler003 != null)
{
return handler003(regionHandle, primID, position, isPhysical);
}
return false;
}
public bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, string objData)
{
handler004 = OnPrimGroupArrival;
if (handler004 != null)
{
return handler004(regionHandle, primID, objData);
}
return false;
}
public bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID)
{
handler007 = OnTellRegionToCloseChildConnection;
if (handler007 != null)
{
return handler007(regionHandle, agentID);
}
return false;
}
}
public class OGS1InterRegionRemoting : MarshalByRefObject
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public OGS1InterRegionRemoting()
{
}
public bool InformRegionOfChildAgent(ulong regionHandle, sAgentCircuitData agentData)
{
try
{
return
InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, new AgentCircuitData(agentData));
}
catch (RemotingException e)
{
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false;
}
}
public bool RegionUp(SearializableRegionInfo region, ulong regionhandle)
{
try
{
return InterRegionSingleton.Instance.RegionUp(region, regionhandle);
}
catch (RemotingException e)
{
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false;
}
}
public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{
try
{
return InterRegionSingleton.Instance.ChildAgentUpdate(regionHandle, cAgentData);
}
catch (RemotingException e)
{
Console.WriteLine("Remoting Error: Unable to send Child agent update to remote region.\n" + e.ToString());
return false;
}
}
public bool ExpectAvatarCrossing(ulong regionHandle, Guid agentID, sLLVector3 position, bool isFlying)
{
try
{
return
InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, new LLUUID(agentID),
new LLVector3(position.x, position.y, position.z),
isFlying);
}
catch (RemotingException e)
{
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false;
}
}
public bool InformRegionPrim(ulong regionHandle, Guid SceneObjectGroupID, sLLVector3 position, bool isPhysical)
{
try
{
return
InterRegionSingleton.Instance.InformRegionPrim(regionHandle, new LLUUID(SceneObjectGroupID),
new LLVector3(position.x, position.y, position.z),
isPhysical);
}
catch (RemotingException e)
{
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false;
}
}
public bool InformRegionOfPrimCrossing(ulong regionHandle, Guid primID, string objData)
{
try
{
return InterRegionSingleton.Instance.ExpectPrimCrossing(regionHandle, new LLUUID(primID), objData);
}
catch (RemotingException e)
{
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false;
}
}
public bool TellRegionToCloseChildConnection(ulong regionHandle, Guid agentID)
{
try
{
return InterRegionSingleton.Instance.TellRegionToCloseChildConnection(regionHandle, new LLUUID(agentID));
}
catch (RemotingException)
{
m_log.Info("[INTERREGION]: Remoting Error: Unable to connect to remote region: " + regionHandle.ToString());
return false;
}
}
}
}

View File

@ -1,191 +1,208 @@
/*
* 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 OpenSim 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 libsecondlife;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Console;
using OpenSim.Framework.Servers;
namespace OpenSim.Region.Communications.OGS1
{
public class OGS1InventoryService : IInventoryServices
{
private string _inventoryServerUrl;
private Dictionary<LLUUID, InventoryRequest> m_RequestingInventory = new Dictionary<LLUUID, InventoryRequest>();
public OGS1InventoryService(string inventoryServerUrl)
{
_inventoryServerUrl = inventoryServerUrl;
}
#region IInventoryServices Members
// See IInventoryServices
public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
InventoryItemInfo itemCallBack)
{
if (!m_RequestingInventory.ContainsKey(userID))
{
InventoryRequest request = new InventoryRequest(userID, folderCallBack, itemCallBack);
m_RequestingInventory.Add(userID, request);
RequestInventory(userID);
}
}
/// <summary>
/// Request the entire user's inventory (folders and items) from the inventory server.
///
/// XXX May want to change this so that we don't end up shuffling over data which might prove
/// entirely unnecessary.
/// </summary>
/// <param name="userID"></param>
private void RequestInventory(LLUUID userID)
{
try
{
MainLog.Instance.Verbose(
"INVENTORY", "Requesting inventory from {0}/GetInventory/ for user {1}",
_inventoryServerUrl, userID);
RestObjectPosterResponse<InventoryCollection> requester
= new RestObjectPosterResponse<InventoryCollection>();
requester.ResponseCallback = InventoryResponse;
requester.BeginPostObject<Guid>(_inventoryServerUrl + "/GetInventory/", userID.UUID);
}
catch (Exception e)
{
MainLog.Instance.Error("INVENTORY", e.ToString());
}
}
/// <summary>
/// Callback used by the inventory server GetInventory request
/// </summary>
/// <param name="userID"></param>
private void InventoryResponse(InventoryCollection response)
{
LLUUID userID = response.UserID;
if (m_RequestingInventory.ContainsKey(userID))
{
MainLog.Instance.Verbose("INVENTORY",
"Received inventory response for user {0} containing {1} folders and {2} items",
userID, response.Folders.Count, response.AllItems.Count);
InventoryFolderImpl rootFolder = null;
InventoryRequest request = m_RequestingInventory[userID];
foreach (InventoryFolderBase folder in response.Folders)
{
if (folder.parentID == LLUUID.Zero)
{
InventoryFolderImpl newfolder = new InventoryFolderImpl(folder);
rootFolder = newfolder;
request.FolderCallBack(userID, newfolder);
}
}
if (rootFolder != null)
{
foreach (InventoryFolderBase folder in response.Folders)
{
if (folder.folderID != rootFolder.folderID)
{
InventoryFolderImpl newfolder = new InventoryFolderImpl(folder);
request.FolderCallBack(userID, newfolder);
}
}
foreach (InventoryItemBase item in response.AllItems)
{
request.ItemCallBack(userID, item);
}
}
m_RequestingInventory.Remove(userID);
}
else
{
MainLog.Instance.Warn(
"INVENTORY",
"Received inventory response for {0} for which we do not have a record of requesting!",
userID);
}
}
public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
{
SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
"POST", _inventoryServerUrl + "/NewFolder/", folder);
}
public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder)
{
SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
"POST", _inventoryServerUrl + "/MoveFolder/", folder);
}
public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
{
SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
"POST", _inventoryServerUrl + "/NewItem/", item);
}
public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
{
SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
"POST", _inventoryServerUrl + "/DeleteItem/", item);
}
public void CreateNewUserInventory(LLUUID user)
{
}
public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID)
{
return new List<InventoryFolderBase>();
}
#endregion
public class InventoryRequest
{
public LLUUID UserID;
public InventoryFolderInfo FolderCallBack;
public InventoryItemInfo ItemCallBack;
public InventoryRequest(LLUUID userId, InventoryFolderInfo folderCall, InventoryItemInfo itemCall)
{
UserID = userId;
FolderCallBack = folderCall;
ItemCallBack = itemCall;
}
}
}
}
/*
* 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 OpenSim 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 libsecondlife;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Console;
using OpenSim.Framework.Servers;
namespace OpenSim.Region.Communications.OGS1
{
public class OGS1InventoryService : IInventoryServices
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private string _inventoryServerUrl;
private Dictionary<LLUUID, InventoryRequest> m_RequestingInventory = new Dictionary<LLUUID, InventoryRequest>();
public OGS1InventoryService(string inventoryServerUrl)
{
_inventoryServerUrl = inventoryServerUrl;
}
#region IInventoryServices Members
// See IInventoryServices
public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
InventoryItemInfo itemCallBack)
{
if (!m_RequestingInventory.ContainsKey(userID))
{
InventoryRequest request = new InventoryRequest(userID, folderCallBack, itemCallBack);
m_RequestingInventory.Add(userID, request);
RequestInventory(userID);
}
}
/// <summary>
/// Request the entire user's inventory (folders and items) from the inventory server.
///
/// XXX May want to change this so that we don't end up shuffling over data which might prove
/// entirely unnecessary.
/// </summary>
/// <param name="userID"></param>
private void RequestInventory(LLUUID userID)
{
try
{
m_log.InfoFormat(
"[INVENTORY]: Requesting inventory from {0}/GetInventory/ for user {1}",
_inventoryServerUrl, userID);
RestObjectPosterResponse<InventoryCollection> requester
= new RestObjectPosterResponse<InventoryCollection>();
requester.ResponseCallback = InventoryResponse;
requester.BeginPostObject<Guid>(_inventoryServerUrl + "/GetInventory/", userID.UUID);
}
catch (Exception e)
{
m_log.Error("[INVENTORY]: " + e.ToString());
}
}
/// <summary>
/// Callback used by the inventory server GetInventory request
/// </summary>
/// <param name="userID"></param>
private void InventoryResponse(InventoryCollection response)
{
LLUUID userID = response.UserID;
if (m_RequestingInventory.ContainsKey(userID))
{
m_log.InfoFormat("[INVENTORY]: " +
"Received inventory response for user {0} containing {1} folders and {2} items",
userID, response.Folders.Count, response.AllItems.Count);
InventoryFolderImpl rootFolder = null;
InventoryRequest request = m_RequestingInventory[userID];
foreach (InventoryFolderBase folder in response.Folders)
{
if (folder.parentID == LLUUID.Zero)
{
InventoryFolderImpl newfolder = new InventoryFolderImpl(folder);
rootFolder = newfolder;
request.FolderCallBack(userID, newfolder);
}
}
if (rootFolder != null)
{
foreach (InventoryFolderBase folder in response.Folders)
{
if (folder.folderID != rootFolder.folderID)
{
InventoryFolderImpl newfolder = new InventoryFolderImpl(folder);
request.FolderCallBack(userID, newfolder);
}
}
foreach (InventoryItemBase item in response.AllItems)
{
request.ItemCallBack(userID, item);
}
}
m_RequestingInventory.Remove(userID);
}
else
{
m_log.WarnFormat(
"[INVENTORY]: " +
"Received inventory response for {0} for which we do not have a record of requesting!",
userID);
}
}
public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
{
SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
"POST", _inventoryServerUrl + "/NewFolder/", folder);
}
public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder)
{
SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
"POST", _inventoryServerUrl + "/MoveFolder/", folder);
}
public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
{
SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
"POST", _inventoryServerUrl + "/NewItem/", item);
}
public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
{
SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
"POST", _inventoryServerUrl + "/DeleteItem/", item);
}
public bool HasInventoryForUser(LLUUID userID)
{
return false;
}
public InventoryFolderBase RequestRootFolder(LLUUID userID)
{
return null;
}
public virtual InventoryFolderBase RequestNamedFolder(LLUUID userID, string folderName)
{
return null;
}
public void CreateNewUserInventory(LLUUID user)
{
}
public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID)
{
return new List<InventoryFolderBase>();
}
#endregion
public class InventoryRequest
{
public LLUUID UserID;
public InventoryFolderInfo FolderCallBack;
public InventoryItemInfo ItemCallBack;
public InventoryRequest(LLUUID userId, InventoryFolderInfo folderCall, InventoryItemInfo itemCall)
{
UserID = userId;
FolderCallBack = folderCall;
ItemCallBack = itemCall;
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,38 +1,66 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly : AssemblyTitle("OpenGrid.Framework.Communications.OGS1")]
[assembly : AssemblyDescription("")]
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("")]
[assembly : AssemblyProduct("OpenGrid.Framework.Communications.OGS1")]
[assembly : AssemblyCopyright("Copyright © 2007")]
[assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly : Guid("a8b2b39b-c83b-41e2-b0b5-7ccfc1fddae7")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly : AssemblyVersion("1.0.0.0")]
[assembly : AssemblyFileVersion("1.0.0.0")]
/*
* 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 OpenSim 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.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly : AssemblyTitle("OpenGrid.Framework.Communications.OGS1")]
[assembly : AssemblyDescription("")]
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("")]
[assembly : AssemblyProduct("OpenGrid.Framework.Communications.OGS1")]
[assembly : AssemblyCopyright("Copyright © OpenSimulator.org Developers 2007-2008")]
[assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly : Guid("a8b2b39b-c83b-41e2-b0b5-7ccfc1fddae7")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly : AssemblyVersion("1.0.0.0")]
[assembly : AssemblyFileVersion("1.0.0.0")]