* 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/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
namespace OpenSim.Region.Communications.OGS1 namespace OpenSim.Region.Communications.OGS1
{ {
public class CommunicationsOGS1 : CommunicationsManager public class CommunicationsOGS1 : CommunicationsManager
{ {
public CommunicationsOGS1(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache) public CommunicationsOGS1(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache)
: base(serversInfo, httpServer, assetCache, false) : base(serversInfo, httpServer, assetCache, false)
{ {
OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer); OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer);
m_gridService = gridInterComms; m_gridService = gridInterComms;
m_interRegion = gridInterComms; m_interRegion = gridInterComms;
m_inventoryService = new OGS1InventoryService(serversInfo.InventoryURL); m_inventoryService = new OGS1InventoryService(serversInfo.InventoryURL);
m_userService = new OGS1UserServices(this); 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/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Runtime.Remoting; using System.Runtime.Remoting;
using libsecondlife; using libsecondlife;
using OpenSim.Framework; using OpenSim.Framework;
namespace OpenSim.Region.Communications.OGS1 namespace OpenSim.Region.Communications.OGS1
{ {
public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData); public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData);
public delegate bool ExpectArrival(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); 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 InformRegionPrimGroup(ulong regionHandle, LLUUID primID, LLVector3 Positon, bool isPhysical);
public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData); public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData);
public delegate bool RegionUp(SearializableRegionInfo region, ulong regionhandle); public delegate bool RegionUp(SearializableRegionInfo region, ulong regionhandle);
public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate childUpdate); public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate childUpdate);
public sealed class InterRegionSingleton public delegate bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID);
{
private static readonly InterRegionSingleton instance = new InterRegionSingleton(); public sealed class InterRegionSingleton
{
public event InformRegionChild OnChildAgent; private static readonly InterRegionSingleton instance = new InterRegionSingleton();
public event ExpectArrival OnArrival;
public event InformRegionPrimGroup OnPrimGroupNear; public event InformRegionChild OnChildAgent;
public event PrimGroupArrival OnPrimGroupArrival; public event ExpectArrival OnArrival;
public event RegionUp OnRegionUp; public event InformRegionPrimGroup OnPrimGroupNear;
public event ChildAgentUpdate OnChildAgentUpdate; public event PrimGroupArrival OnPrimGroupArrival;
public event RegionUp OnRegionUp;
public event ChildAgentUpdate OnChildAgentUpdate;
static InterRegionSingleton() public event TellRegionToCloseChildConnection OnTellRegionToCloseChildConnection;
{
} private InformRegionChild handler001 = null; // OnChildAgent;
private ExpectArrival handler002 = null; // OnArrival;
private InterRegionSingleton() private InformRegionPrimGroup handler003 = null; // OnPrimGroupNear;
{ private PrimGroupArrival handler004 = null; // OnPrimGroupArrival;
} private RegionUp handler005 = null; // OnRegionUp;
private ChildAgentUpdate handler006 = null; // OnChildAgentUpdate;
public static InterRegionSingleton Instance private TellRegionToCloseChildConnection handler007 = null; // OnTellRegionToCloseChildConnection;
{
get { return instance; }
} static InterRegionSingleton()
{
public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) }
{
if (OnChildAgent != null) private InterRegionSingleton()
{ {
return OnChildAgent(regionHandle, agentData); }
}
return false; public static InterRegionSingleton Instance
} {
get { return instance; }
public bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle) }
{
if (OnRegionUp != null) public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
{ {
return OnRegionUp(sregion, regionhandle); handler001 = OnChildAgent;
} if (handler001 != null)
return false; {
} return handler001(regionHandle, agentData);
}
public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentUpdate) return false;
{ }
if (OnChildAgentUpdate != null)
{ public bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle)
return OnChildAgentUpdate(regionHandle, cAgentUpdate); {
} handler005 = OnRegionUp;
return false; if (handler005 != null)
} {
return handler005(sregion, regionhandle);
public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) }
{ return false;
if (OnArrival != null) }
{
return OnArrival(regionHandle, agentID, position, isFlying); public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentUpdate)
} {
return false; handler006 = OnChildAgentUpdate;
} if (handler006 != null)
{
public bool InformRegionPrim(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical) return handler006(regionHandle, cAgentUpdate);
{ }
if (OnPrimGroupNear != null) return false;
{ }
return OnPrimGroupNear(regionHandle, primID, position, isPhysical);
} public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
return false; {
} handler002 = OnArrival;
if (handler002 != null)
public bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, string objData) {
{ return handler002(regionHandle, agentID, position, isFlying);
if (OnPrimGroupArrival != null) }
{ return false;
return OnPrimGroupArrival(regionHandle, primID, objData); }
}
return false; public bool InformRegionPrim(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical)
} {
} handler003 = OnPrimGroupNear;
if (handler003 != null)
public class OGS1InterRegionRemoting : MarshalByRefObject {
{ return handler003(regionHandle, primID, position, isPhysical);
public OGS1InterRegionRemoting() }
{ return false;
} }
public bool InformRegionOfChildAgent(ulong regionHandle, sAgentCircuitData agentData) public bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, string objData)
{ {
try handler004 = OnPrimGroupArrival;
{ if (handler004 != null)
return {
InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, new AgentCircuitData(agentData)); return handler004(regionHandle, primID, objData);
} }
catch (RemotingException e) return false;
{ }
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false; public bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID)
} {
} handler007 = OnTellRegionToCloseChildConnection;
if (handler007 != null)
public bool RegionUp(SearializableRegionInfo region, ulong regionhandle) {
{ return handler007(regionHandle, agentID);
try }
{ return false;
return InterRegionSingleton.Instance.RegionUp(region, regionhandle); }
} }
catch (RemotingException e)
{ public class OGS1InterRegionRemoting : MarshalByRefObject
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); {
return false; private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
}
} public OGS1InterRegionRemoting()
{
public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) }
{
try public bool InformRegionOfChildAgent(ulong regionHandle, sAgentCircuitData agentData)
{ {
return InterRegionSingleton.Instance.ChildAgentUpdate(regionHandle, cAgentData); try
} {
catch (RemotingException e) return
{ InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, new AgentCircuitData(agentData));
Console.WriteLine("Remoting Error: Unable to send Child agent update to remote region.\n" + e.ToString()); }
return false; catch (RemotingException e)
} {
} Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false;
public bool ExpectAvatarCrossing(ulong regionHandle, Guid agentID, sLLVector3 position, bool isFlying) }
{ }
try
{ public bool RegionUp(SearializableRegionInfo region, ulong regionhandle)
return {
InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, new LLUUID(agentID), try
new LLVector3(position.x, position.y, position.z), {
isFlying); return InterRegionSingleton.Instance.RegionUp(region, regionhandle);
} }
catch (RemotingException e) catch (RemotingException e)
{ {
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false; return false;
} }
} }
public bool InformRegionPrim(ulong regionHandle, Guid SceneObjectGroupID, sLLVector3 position, bool isPhysical) public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
{ {
try try
{ {
return return InterRegionSingleton.Instance.ChildAgentUpdate(regionHandle, cAgentData);
InterRegionSingleton.Instance.InformRegionPrim(regionHandle, new LLUUID(SceneObjectGroupID), }
new LLVector3(position.x, position.y, position.z), catch (RemotingException e)
isPhysical); {
} Console.WriteLine("Remoting Error: Unable to send Child agent update to remote region.\n" + e.ToString());
catch (RemotingException e) return false;
{ }
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); }
return false;
}
} public bool ExpectAvatarCrossing(ulong regionHandle, Guid agentID, sLLVector3 position, bool isFlying)
{
public bool InformRegionOfPrimCrossing(ulong regionHandle, Guid primID, string objData) try
{ {
try return
{ InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, new LLUUID(agentID),
return InterRegionSingleton.Instance.ExpectPrimCrossing(regionHandle, new LLUUID(primID), objData); new LLVector3(position.x, position.y, position.z),
} isFlying);
catch (RemotingException e) }
{ catch (RemotingException e)
Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); {
return false; 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/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
namespace OpenSim.Region.Communications.OGS1 namespace OpenSim.Region.Communications.OGS1
{ {
public class OGS1InventoryService : IInventoryServices public class OGS1InventoryService : IInventoryServices
{ {
private string _inventoryServerUrl; private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<LLUUID, InventoryRequest> m_RequestingInventory = new Dictionary<LLUUID, InventoryRequest>();
private string _inventoryServerUrl;
public OGS1InventoryService(string inventoryServerUrl) private Dictionary<LLUUID, InventoryRequest> m_RequestingInventory = new Dictionary<LLUUID, InventoryRequest>();
{
_inventoryServerUrl = inventoryServerUrl; public OGS1InventoryService(string inventoryServerUrl)
} {
_inventoryServerUrl = inventoryServerUrl;
#region IInventoryServices Members }
// See IInventoryServices #region IInventoryServices Members
public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
InventoryItemInfo itemCallBack) // See IInventoryServices
{ public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
if (!m_RequestingInventory.ContainsKey(userID)) InventoryItemInfo itemCallBack)
{ {
InventoryRequest request = new InventoryRequest(userID, folderCallBack, itemCallBack); if (!m_RequestingInventory.ContainsKey(userID))
m_RequestingInventory.Add(userID, request); {
RequestInventory(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.
/// /// <summary>
/// XXX May want to change this so that we don't end up shuffling over data which might prove /// Request the entire user's inventory (folders and items) from the inventory server.
/// entirely unnecessary. ///
/// </summary> /// XXX May want to change this so that we don't end up shuffling over data which might prove
/// <param name="userID"></param> /// entirely unnecessary.
private void RequestInventory(LLUUID userID) /// </summary>
{ /// <param name="userID"></param>
try private void RequestInventory(LLUUID userID)
{ {
MainLog.Instance.Verbose( try
"INVENTORY", "Requesting inventory from {0}/GetInventory/ for user {1}", {
_inventoryServerUrl, userID); m_log.InfoFormat(
"[INVENTORY]: Requesting inventory from {0}/GetInventory/ for user {1}",
RestObjectPosterResponse<InventoryCollection> requester _inventoryServerUrl, userID);
= new RestObjectPosterResponse<InventoryCollection>();
requester.ResponseCallback = InventoryResponse; RestObjectPosterResponse<InventoryCollection> requester
= new RestObjectPosterResponse<InventoryCollection>();
requester.BeginPostObject<Guid>(_inventoryServerUrl + "/GetInventory/", userID.UUID); requester.ResponseCallback = InventoryResponse;
}
catch (Exception e) requester.BeginPostObject<Guid>(_inventoryServerUrl + "/GetInventory/", userID.UUID);
{ }
MainLog.Instance.Error("INVENTORY", e.ToString()); catch (Exception e)
} {
} m_log.Error("[INVENTORY]: " + e.ToString());
}
/// <summary> }
/// Callback used by the inventory server GetInventory request
/// </summary> /// <summary>
/// <param name="userID"></param> /// Callback used by the inventory server GetInventory request
private void InventoryResponse(InventoryCollection response) /// </summary>
{ /// <param name="userID"></param>
LLUUID userID = response.UserID; private void InventoryResponse(InventoryCollection response)
if (m_RequestingInventory.ContainsKey(userID)) {
{ LLUUID userID = response.UserID;
MainLog.Instance.Verbose("INVENTORY", if (m_RequestingInventory.ContainsKey(userID))
"Received inventory response for user {0} containing {1} folders and {2} items", {
userID, response.Folders.Count, response.AllItems.Count); m_log.InfoFormat("[INVENTORY]: " +
"Received inventory response for user {0} containing {1} folders and {2} items",
InventoryFolderImpl rootFolder = null; userID, response.Folders.Count, response.AllItems.Count);
InventoryRequest request = m_RequestingInventory[userID];
foreach (InventoryFolderBase folder in response.Folders) InventoryFolderImpl rootFolder = null;
{ InventoryRequest request = m_RequestingInventory[userID];
if (folder.parentID == LLUUID.Zero) foreach (InventoryFolderBase folder in response.Folders)
{ {
InventoryFolderImpl newfolder = new InventoryFolderImpl(folder); if (folder.parentID == LLUUID.Zero)
rootFolder = newfolder; {
request.FolderCallBack(userID, newfolder); InventoryFolderImpl newfolder = new InventoryFolderImpl(folder);
} rootFolder = newfolder;
} request.FolderCallBack(userID, newfolder);
}
if (rootFolder != null) }
{
foreach (InventoryFolderBase folder in response.Folders) if (rootFolder != null)
{ {
if (folder.folderID != rootFolder.folderID) foreach (InventoryFolderBase folder in response.Folders)
{ {
InventoryFolderImpl newfolder = new InventoryFolderImpl(folder); if (folder.folderID != rootFolder.folderID)
request.FolderCallBack(userID, newfolder); {
} InventoryFolderImpl newfolder = new InventoryFolderImpl(folder);
} request.FolderCallBack(userID, newfolder);
}
foreach (InventoryItemBase item in response.AllItems) }
{
request.ItemCallBack(userID, item); foreach (InventoryItemBase item in response.AllItems)
} {
} request.ItemCallBack(userID, item);
m_RequestingInventory.Remove(userID); }
} }
else m_RequestingInventory.Remove(userID);
{ }
MainLog.Instance.Warn( else
"INVENTORY", {
"Received inventory response for {0} for which we do not have a record of requesting!", m_log.WarnFormat(
userID); "[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>( public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
"POST", _inventoryServerUrl + "/NewFolder/", folder); {
} SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
"POST", _inventoryServerUrl + "/NewFolder/", folder);
public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder) }
{
SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>( public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder)
"POST", _inventoryServerUrl + "/MoveFolder/", folder); {
} SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
"POST", _inventoryServerUrl + "/MoveFolder/", folder);
public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) }
{
SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>( public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
"POST", _inventoryServerUrl + "/NewItem/", item); {
} SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
"POST", _inventoryServerUrl + "/NewItem/", item);
public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) }
{
SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>( public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
"POST", _inventoryServerUrl + "/DeleteItem/", item); {
} SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
"POST", _inventoryServerUrl + "/DeleteItem/", item);
public void CreateNewUserInventory(LLUUID user) }
{
} public bool HasInventoryForUser(LLUUID userID)
{
public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID) return false;
{ }
return new List<InventoryFolderBase>();
} public InventoryFolderBase RequestRootFolder(LLUUID userID)
{
#endregion return null;
}
public class InventoryRequest
{ public virtual InventoryFolderBase RequestNamedFolder(LLUUID userID, string folderName)
public LLUUID UserID; {
public InventoryFolderInfo FolderCallBack; return null;
public InventoryItemInfo ItemCallBack; }
public InventoryRequest(LLUUID userId, InventoryFolderInfo folderCall, InventoryItemInfo itemCall) public void CreateNewUserInventory(LLUUID user)
{ {
UserID = userId; }
FolderCallBack = folderCall;
ItemCallBack = itemCall; 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; * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
// General Information about an assembly is controlled through the following *
// set of attributes. Change these attribute values to modify the information * Redistribution and use in source and binary forms, with or without
// associated with an assembly. * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
[assembly : AssemblyTitle("OpenGrid.Framework.Communications.OGS1")] * notice, this list of conditions and the following disclaimer.
[assembly : AssemblyDescription("")] * * Redistributions in binary form must reproduce the above copyright
[assembly : AssemblyConfiguration("")] * notice, this list of conditions and the following disclaimer in the
[assembly : AssemblyCompany("")] * documentation and/or other materials provided with the distribution.
[assembly : AssemblyProduct("OpenGrid.Framework.Communications.OGS1")] * * Neither the name of the OpenSim Project nor the
[assembly : AssemblyCopyright("Copyright © 2007")] * names of its contributors may be used to endorse or promote products
[assembly : AssemblyTrademark("")] * derived from this software without specific prior written permission.
[assembly : AssemblyCulture("")] *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
// Setting ComVisible to false makes the types in this assembly not visible * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// to COM components. If you need to access a type in this assembly from * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// COM, set the ComVisible attribute to true on that type. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
[assembly : ComVisible(false)] * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// The following GUID is for the ID of the typelib if this project is exposed to COM * 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
[assembly : Guid("a8b2b39b-c83b-41e2-b0b5-7ccfc1fddae7")] * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
// Version information for an assembly consists of the following four values: */
//
// Major Version using System.Reflection;
// Minor Version using System.Runtime.InteropServices;
// Build Number
// Revision // General Information about an assembly is controlled through the following
// // set of attributes. Change these attribute values to modify the information
// You can specify all the values or you can default the Revision and Build Numbers // associated with an assembly.
// by using the '*' as shown below:
[assembly : AssemblyTitle("OpenGrid.Framework.Communications.OGS1")]
[assembly : AssemblyVersion("1.0.0.0")] [assembly : AssemblyDescription("")]
[assembly : AssemblyFileVersion("1.0.0.0")] [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")]