From 5f34bd73fbca765064c4b3811d1f67da36cbf5ae Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Mon, 6 Apr 2009 14:24:13 +0000 Subject: [PATCH] Update svn properties. --- OpenSim/Framework/Animation.cs | 188 +-- .../Communications/Clients/RegionClient.cs | 1262 ++++++++--------- OpenSim/Framework/ISceneObject.cs | 84 +- .../OptionalModules/Autooar/AutooarModule.cs | 144 +- .../Scripting/Minimodule/IParcel.cs | 30 +- .../Scripting/Minimodule/IPersistence.cs | 58 +- .../Scripting/Minimodule/ISocialEntity.cs | 26 +- .../Scripting/Minimodule/LOParcel.cs | 90 +- .../Minimodule/Object/IObjectPhysics.cs | 78 +- .../Scripting/Minimodule/SEUser.cs | 68 +- 10 files changed, 1014 insertions(+), 1014 deletions(-) diff --git a/OpenSim/Framework/Animation.cs b/OpenSim/Framework/Animation.cs index cda83871a5..6cfeddaba9 100644 --- a/OpenSim/Framework/Animation.cs +++ b/OpenSim/Framework/Animation.cs @@ -1,94 +1,94 @@ -/* - * 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 OpenMetaverse; -using OpenMetaverse.StructuredData; - -namespace OpenSim.Framework -{ - [Serializable] - public class Animation - { - private UUID animID; - public UUID AnimID - { - get { return animID; } - set { animID = value; } - } - - private int sequenceNum; - public int SequenceNum - { - get { return sequenceNum; } - set { sequenceNum = value; } - } - - private UUID objectID; - public UUID ObjectID - { - get { return objectID; } - set { objectID = value; } - } - - public Animation() - { - } - - public Animation(UUID animID, int sequenceNum, UUID objectID) - { - this.animID = animID; - this.sequenceNum = sequenceNum; - this.objectID = objectID; - } - - public Animation(OSDMap args) - { - UnpackUpdateMessage(args); - } - - public OSDMap PackUpdateMessage() - { - OSDMap anim = new OSDMap(); - anim["animation"] = OSD.FromUUID(animID); - anim["object_id"] = OSD.FromUUID(objectID); - anim["seq_num"] = OSD.FromInteger(sequenceNum); - return anim; - } - - public void UnpackUpdateMessage(OSDMap args) - { - if (args["animation"] != null) - animID = args["animation"].AsUUID(); - if (args["object_id"] != null) - objectID = args["object_id"].AsUUID(); - if (args["seq_num"] != null) - sequenceNum = args["seq_num"].AsInteger(); - } - - } -} +/* + * 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 OpenMetaverse; +using OpenMetaverse.StructuredData; + +namespace OpenSim.Framework +{ + [Serializable] + public class Animation + { + private UUID animID; + public UUID AnimID + { + get { return animID; } + set { animID = value; } + } + + private int sequenceNum; + public int SequenceNum + { + get { return sequenceNum; } + set { sequenceNum = value; } + } + + private UUID objectID; + public UUID ObjectID + { + get { return objectID; } + set { objectID = value; } + } + + public Animation() + { + } + + public Animation(UUID animID, int sequenceNum, UUID objectID) + { + this.animID = animID; + this.sequenceNum = sequenceNum; + this.objectID = objectID; + } + + public Animation(OSDMap args) + { + UnpackUpdateMessage(args); + } + + public OSDMap PackUpdateMessage() + { + OSDMap anim = new OSDMap(); + anim["animation"] = OSD.FromUUID(animID); + anim["object_id"] = OSD.FromUUID(objectID); + anim["seq_num"] = OSD.FromInteger(sequenceNum); + return anim; + } + + public void UnpackUpdateMessage(OSDMap args) + { + if (args["animation"] != null) + animID = args["animation"].AsUUID(); + if (args["object_id"] != null) + objectID = args["object_id"].AsUUID(); + if (args["seq_num"] != null) + sequenceNum = args["seq_num"].AsInteger(); + } + + } +} diff --git a/OpenSim/Framework/Communications/Clients/RegionClient.cs b/OpenSim/Framework/Communications/Clients/RegionClient.cs index 196bcf9d45..27353b0c22 100644 --- a/OpenSim/Framework/Communications/Clients/RegionClient.cs +++ b/OpenSim/Framework/Communications/Clients/RegionClient.cs @@ -1,631 +1,631 @@ -/* - * 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 System.IO; -using System.Net; -using System.Reflection; -using System.Text; - -using OpenMetaverse; -using OpenMetaverse.StructuredData; - -using log4net; - -namespace OpenSim.Framework.Communications.Clients -{ - public class RegionClient - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public bool DoCreateChildAgentCall(RegionInfo region, AgentCircuitData aCircuit) - { - // Eventually, we want to use a caps url instead of the agentID - string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + aCircuit.AgentID + "/"; - //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); - - HttpWebRequest AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); - AgentCreateRequest.Method = "POST"; - AgentCreateRequest.ContentType = "application/json"; - AgentCreateRequest.Timeout = 10000; - //AgentCreateRequest.KeepAlive = false; - - // Fill it in - OSDMap args = null; - try - { - args = aCircuit.PackAgentCircuitData(); - } - catch (Exception e) - { - m_log.Debug("[REST COMMS]: PackAgentCircuitData failed with exception: " + e.Message); - } - // Add the regionhandle of the destination region - ulong regionHandle = GetRegionHandle(region.RegionHandle); - args["destination_handle"] = OSD.FromString(regionHandle.ToString()); - - string strBuffer = ""; - byte[] buffer = new byte[1]; - try - { - strBuffer = OSDParser.SerializeJsonString(args); - UTF8Encoding str = new UTF8Encoding(); - buffer = str.GetBytes(strBuffer); - - } - catch (Exception e) - { - m_log.WarnFormat("[OSG2]: Exception thrown on serialization of ChildCreate: {0}", e.Message); - // ignore. buffer will be empty, caller should check. - } - - Stream os = null; - try - { // send the Post - AgentCreateRequest.ContentLength = buffer.Length; //Count bytes to send - os = AgentCreateRequest.GetRequestStream(); - os.Write(buffer, 0, strBuffer.Length); //Send it - os.Close(); - //m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri); - } - //catch (WebException ex) - catch - { - //m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message); - - return false; - } - - // Let's wait for the response - //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); - - try - { - WebResponse webResponse = AgentCreateRequest.GetResponse(); - if (webResponse == null) - { - m_log.Info("[REST COMMS]: Null reply on DoCreateChildAgentCall post"); - } - - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); - //reply = sr.ReadToEnd().Trim(); - sr.ReadToEnd().Trim(); - sr.Close(); - //m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply); - - } - catch (WebException ex) - { - m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateChildAgentCall {0}", ex.Message); - // ignore, really - } - - return true; - - } - - public bool DoChildAgentUpdateCall(RegionInfo region, IAgentData cAgentData) - { - // Eventually, we want to use a caps url instead of the agentID - string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + cAgentData.AgentID + "/"; - //Console.WriteLine(" >>> DoChildAgentUpdateCall <<< " + uri); - - HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); - ChildUpdateRequest.Method = "PUT"; - ChildUpdateRequest.ContentType = "application/json"; - ChildUpdateRequest.Timeout = 10000; - //ChildUpdateRequest.KeepAlive = false; - - // Fill it in - OSDMap args = null; - try - { - args = cAgentData.Pack(); - } - catch (Exception e) - { - m_log.Debug("[REST COMMS]: PackUpdateMessage failed with exception: " + e.Message); - } - // Add the regionhandle of the destination region - ulong regionHandle = GetRegionHandle(region.RegionHandle); - args["destination_handle"] = OSD.FromString(regionHandle.ToString()); - - string strBuffer = ""; - byte[] buffer = new byte[1]; - try - { - strBuffer = OSDParser.SerializeJsonString(args); - UTF8Encoding str = new UTF8Encoding(); - buffer = str.GetBytes(strBuffer); - - } - catch (Exception e) - { - m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of ChildUpdate: {0}", e.Message); - // ignore. buffer will be empty, caller should check. - } - - Stream os = null; - try - { // send the Post - ChildUpdateRequest.ContentLength = buffer.Length; //Count bytes to send - os = ChildUpdateRequest.GetRequestStream(); - os.Write(buffer, 0, strBuffer.Length); //Send it - os.Close(); - //m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri); - } - //catch (WebException ex) - catch - { - //m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message); - - return false; - } - - // Let's wait for the response - //m_log.Info("[REST COMMS]: Waiting for a reply after ChildAgentUpdate"); - - try - { - WebResponse webResponse = ChildUpdateRequest.GetResponse(); - if (webResponse == null) - { - m_log.Info("[REST COMMS]: Null reply on ChilAgentUpdate post"); - } - - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); - //reply = sr.ReadToEnd().Trim(); - sr.ReadToEnd().Trim(); - sr.Close(); - //m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply); - - } - catch (WebException ex) - { - m_log.InfoFormat("[REST COMMS]: exception on reply of ChilAgentUpdate {0}", ex.Message); - // ignore, really - } - - return true; - } - - public bool DoRetrieveRootAgentCall(RegionInfo region, UUID id, out IAgentData agent) - { - agent = null; - // Eventually, we want to use a caps url instead of the agentID - string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + id + "/" + region.RegionHandle.ToString() + "/"; - //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); - - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); - request.Method = "GET"; - request.Timeout = 10000; - //request.Headers.Add("authorization", ""); // coming soon - - HttpWebResponse webResponse = null; - string reply = string.Empty; - try - { - webResponse = (HttpWebResponse)request.GetResponse(); - if (webResponse == null) - { - m_log.Info("[REST COMMS]: Null reply on agent get "); - } - - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); - reply = sr.ReadToEnd().Trim(); - sr.Close(); - - //Console.WriteLine("[REST COMMS]: ChilAgentUpdate reply was " + reply); - - } - catch (WebException ex) - { - m_log.InfoFormat("[REST COMMS]: exception on reply of agent get {0}", ex.Message); - // ignore, really - return false; - } - - if (webResponse.StatusCode == HttpStatusCode.OK) - { - // we know it's jason - OSDMap args = GetOSDMap(reply); - if (args == null) - { - //Console.WriteLine("[REST COMMS]: Error getting OSDMap from reply"); - return false; - } - - agent = new CompleteAgentData(); - agent.Unpack(args); - return true; - } - - //Console.WriteLine("[REST COMMS]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode); - return false; - } - - public bool DoReleaseAgentCall(ulong regionHandle, UUID id, string uri) - { - //m_log.Debug(" >>> DoReleaseAgentCall <<< " + uri); - - WebRequest request = WebRequest.Create(uri); - request.Method = "DELETE"; - request.Timeout = 10000; - - try - { - WebResponse webResponse = request.GetResponse(); - if (webResponse == null) - { - m_log.Info("[REST COMMS]: Null reply on agent delete "); - } - - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); - //reply = sr.ReadToEnd().Trim(); - sr.ReadToEnd().Trim(); - sr.Close(); - //m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply); - - } - catch (WebException ex) - { - m_log.InfoFormat("[REST COMMS]: exception on reply of agent delete {0}", ex.Message); - // ignore, really - } - - return true; - } - - - public bool DoCloseAgentCall(RegionInfo region, UUID id) - { - string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + id + "/" + region.RegionHandle.ToString() + "/"; - - //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri); - - WebRequest request = WebRequest.Create(uri); - request.Method = "DELETE"; - request.Timeout = 10000; - - try - { - WebResponse webResponse = request.GetResponse(); - if (webResponse == null) - { - m_log.Info("[REST COMMS]: Null reply on agent delete "); - } - - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); - //reply = sr.ReadToEnd().Trim(); - sr.ReadToEnd().Trim(); - sr.Close(); - //m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply); - - } - catch (WebException ex) - { - m_log.InfoFormat("[REST COMMS]: exception on reply of agent delete {0}", ex.Message); - // ignore, really - } - - return true; - } - - public bool DoCreateObjectCall(RegionInfo region, ISceneObject sog, bool allowScriptCrossing) - { - ulong regionHandle = GetRegionHandle(region.RegionHandle); - string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/object/" + sog.UUID + "/" + regionHandle.ToString() + "/"; - //m_log.Debug(" >>> DoCreateChildAgentCall <<< " + uri); - - WebRequest ObjectCreateRequest = WebRequest.Create(uri); - ObjectCreateRequest.Method = "POST"; - ObjectCreateRequest.ContentType = "application/json"; - ObjectCreateRequest.Timeout = 10000; - - OSDMap args = new OSDMap(2); - args["sog"] = OSD.FromString(sog.ToXmlString2()); - args["extra"] = OSD.FromString(sog.ExtraToXmlString()); - if (allowScriptCrossing) - { - string state = sog.GetStateSnapshot(); - if (state.Length > 0) - args["state"] = OSD.FromString(state); - } - - string strBuffer = ""; - byte[] buffer = new byte[1]; - try - { - strBuffer = OSDParser.SerializeJsonString(args); - UTF8Encoding str = new UTF8Encoding(); - buffer = str.GetBytes(strBuffer); - - } - catch (Exception e) - { - m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of CreateObject: {0}", e.Message); - // ignore. buffer will be empty, caller should check. - } - - Stream os = null; - try - { // send the Post - ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send - os = ObjectCreateRequest.GetRequestStream(); - os.Write(buffer, 0, strBuffer.Length); //Send it - os.Close(); - m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri); - } - //catch (WebException ex) - catch - { - // m_log.InfoFormat("[REST COMMS]: Bad send on CreateObject {0}", ex.Message); - - return false; - } - - // Let's wait for the response - //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); - - try - { - WebResponse webResponse = ObjectCreateRequest.GetResponse(); - if (webResponse == null) - { - m_log.Info("[REST COMMS]: Null reply on DoCreateObjectCall post"); - } - - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); - //reply = sr.ReadToEnd().Trim(); - sr.ReadToEnd().Trim(); - sr.Close(); - //m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply); - - } - catch (WebException ex) - { - m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateObjectCall {0}", ex.Message); - // ignore, really - } - - return true; - - } - - public bool DoCreateObjectCall(RegionInfo region, UUID userID, UUID itemID) - { - ulong regionHandle = GetRegionHandle(region.RegionHandle); - string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/object/" + UUID.Zero + "/" + regionHandle.ToString() + "/"; - //m_log.Debug(" >>> DoCreateChildAgentCall <<< " + uri); - - WebRequest ObjectCreateRequest = WebRequest.Create(uri); - ObjectCreateRequest.Method = "PUT"; - ObjectCreateRequest.ContentType = "application/json"; - ObjectCreateRequest.Timeout = 10000; - - OSDMap args = new OSDMap(2); - args["userid"] = OSD.FromUUID(userID); - args["itemid"] = OSD.FromUUID(itemID); - - string strBuffer = ""; - byte[] buffer = new byte[1]; - try - { - strBuffer = OSDParser.SerializeJsonString(args); - UTF8Encoding str = new UTF8Encoding(); - buffer = str.GetBytes(strBuffer); - - } - catch (Exception e) - { - m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of CreateObject: {0}", e.Message); - // ignore. buffer will be empty, caller should check. - } - - Stream os = null; - try - { // send the Post - ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send - os = ObjectCreateRequest.GetRequestStream(); - os.Write(buffer, 0, strBuffer.Length); //Send it - os.Close(); - //m_log.InfoFormat("[REST COMMS]: Posted CreateObject request to remote sim {0}", uri); - } - //catch (WebException ex) - catch - { - // m_log.InfoFormat("[REST COMMS]: Bad send on CreateObject {0}", ex.Message); - - return false; - } - - // Let's wait for the response - //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); - - try - { - WebResponse webResponse = ObjectCreateRequest.GetResponse(); - if (webResponse == null) - { - m_log.Info("[REST COMMS]: Null reply on DoCreateObjectCall post"); - } - - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); - sr.ReadToEnd().Trim(); - sr.ReadToEnd().Trim(); - sr.Close(); - - //m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply); - - } - catch (WebException ex) - { - m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateObjectCall {0}", ex.Message); - // ignore, really - } - - return true; - - } - - public bool DoHelloNeighbourCall(RegionInfo region, RegionInfo thisRegion) - { - string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; - //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); - - WebRequest HelloNeighbourRequest = WebRequest.Create(uri); - HelloNeighbourRequest.Method = "POST"; - HelloNeighbourRequest.ContentType = "application/json"; - HelloNeighbourRequest.Timeout = 10000; - - // Fill it in - OSDMap args = null; - try - { - args = thisRegion.PackRegionInfoData(); - } - catch (Exception e) - { - m_log.Debug("[REST COMMS]: PackRegionInfoData failed with exception: " + e.Message); - } - // Add the regionhandle of the destination region - ulong regionHandle = GetRegionHandle(region.RegionHandle); - args["destination_handle"] = OSD.FromString(regionHandle.ToString()); - - string strBuffer = ""; - byte[] buffer = new byte[1]; - try - { - strBuffer = OSDParser.SerializeJsonString(args); - UTF8Encoding str = new UTF8Encoding(); - buffer = str.GetBytes(strBuffer); - - } - catch (Exception e) - { - m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of HelloNeighbour: {0}", e.Message); - // ignore. buffer will be empty, caller should check. - } - - Stream os = null; - try - { // send the Post - HelloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send - os = HelloNeighbourRequest.GetRequestStream(); - os.Write(buffer, 0, strBuffer.Length); //Send it - os.Close(); - //m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri); - } - //catch (WebException ex) - catch - { - //m_log.InfoFormat("[REST COMMS]: Bad send on HelloNeighbour {0}", ex.Message); - - return false; - } - - // Let's wait for the response - //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); - - try - { - WebResponse webResponse = HelloNeighbourRequest.GetResponse(); - if (webResponse == null) - { - m_log.Info("[REST COMMS]: Null reply on DoHelloNeighbourCall post"); - } - - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); - //reply = sr.ReadToEnd().Trim(); - sr.ReadToEnd().Trim(); - sr.Close(); - //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); - - } - catch (WebException ex) - { - m_log.InfoFormat("[REST COMMS]: exception on reply of DoHelloNeighbourCall {0}", ex.Message); - // ignore, really - } - - return true; - - } - - #region Hyperlinks - - public virtual ulong GetRegionHandle(ulong handle) - { - return handle; - } - - public virtual bool IsHyperlink(ulong handle) - { - return false; - } - - public virtual void SendUserInformation(RegionInfo regInfo, AgentCircuitData aCircuit) - { - } - - public virtual void AdjustUserInformation(AgentCircuitData aCircuit) - { - } - - #endregion /* Hyperlinks */ - - public static OSDMap GetOSDMap(string data) - { - OSDMap args = null; - try - { - OSD buffer; - // We should pay attention to the content-type, but let's assume we know it's Json - buffer = OSDParser.DeserializeJson(data); - if (buffer.Type == OSDType.Map) - { - args = (OSDMap)buffer; - return args; - } - else - { - // uh? - System.Console.WriteLine("[REST COMMS]: Got OSD of type " + buffer.Type.ToString()); - return null; - } - } - catch (Exception ex) - { - System.Console.WriteLine("[REST COMMS]: exception on parse of REST message " + ex.Message); - return null; - } - } - - - } -} +/* + * 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 System.IO; +using System.Net; +using System.Reflection; +using System.Text; + +using OpenMetaverse; +using OpenMetaverse.StructuredData; + +using log4net; + +namespace OpenSim.Framework.Communications.Clients +{ + public class RegionClient + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + public bool DoCreateChildAgentCall(RegionInfo region, AgentCircuitData aCircuit) + { + // Eventually, we want to use a caps url instead of the agentID + string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + aCircuit.AgentID + "/"; + //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); + + HttpWebRequest AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); + AgentCreateRequest.Method = "POST"; + AgentCreateRequest.ContentType = "application/json"; + AgentCreateRequest.Timeout = 10000; + //AgentCreateRequest.KeepAlive = false; + + // Fill it in + OSDMap args = null; + try + { + args = aCircuit.PackAgentCircuitData(); + } + catch (Exception e) + { + m_log.Debug("[REST COMMS]: PackAgentCircuitData failed with exception: " + e.Message); + } + // Add the regionhandle of the destination region + ulong regionHandle = GetRegionHandle(region.RegionHandle); + args["destination_handle"] = OSD.FromString(regionHandle.ToString()); + + string strBuffer = ""; + byte[] buffer = new byte[1]; + try + { + strBuffer = OSDParser.SerializeJsonString(args); + UTF8Encoding str = new UTF8Encoding(); + buffer = str.GetBytes(strBuffer); + + } + catch (Exception e) + { + m_log.WarnFormat("[OSG2]: Exception thrown on serialization of ChildCreate: {0}", e.Message); + // ignore. buffer will be empty, caller should check. + } + + Stream os = null; + try + { // send the Post + AgentCreateRequest.ContentLength = buffer.Length; //Count bytes to send + os = AgentCreateRequest.GetRequestStream(); + os.Write(buffer, 0, strBuffer.Length); //Send it + os.Close(); + //m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri); + } + //catch (WebException ex) + catch + { + //m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message); + + return false; + } + + // Let's wait for the response + //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); + + try + { + WebResponse webResponse = AgentCreateRequest.GetResponse(); + if (webResponse == null) + { + m_log.Info("[REST COMMS]: Null reply on DoCreateChildAgentCall post"); + } + + StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + //reply = sr.ReadToEnd().Trim(); + sr.ReadToEnd().Trim(); + sr.Close(); + //m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply); + + } + catch (WebException ex) + { + m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateChildAgentCall {0}", ex.Message); + // ignore, really + } + + return true; + + } + + public bool DoChildAgentUpdateCall(RegionInfo region, IAgentData cAgentData) + { + // Eventually, we want to use a caps url instead of the agentID + string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + cAgentData.AgentID + "/"; + //Console.WriteLine(" >>> DoChildAgentUpdateCall <<< " + uri); + + HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); + ChildUpdateRequest.Method = "PUT"; + ChildUpdateRequest.ContentType = "application/json"; + ChildUpdateRequest.Timeout = 10000; + //ChildUpdateRequest.KeepAlive = false; + + // Fill it in + OSDMap args = null; + try + { + args = cAgentData.Pack(); + } + catch (Exception e) + { + m_log.Debug("[REST COMMS]: PackUpdateMessage failed with exception: " + e.Message); + } + // Add the regionhandle of the destination region + ulong regionHandle = GetRegionHandle(region.RegionHandle); + args["destination_handle"] = OSD.FromString(regionHandle.ToString()); + + string strBuffer = ""; + byte[] buffer = new byte[1]; + try + { + strBuffer = OSDParser.SerializeJsonString(args); + UTF8Encoding str = new UTF8Encoding(); + buffer = str.GetBytes(strBuffer); + + } + catch (Exception e) + { + m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of ChildUpdate: {0}", e.Message); + // ignore. buffer will be empty, caller should check. + } + + Stream os = null; + try + { // send the Post + ChildUpdateRequest.ContentLength = buffer.Length; //Count bytes to send + os = ChildUpdateRequest.GetRequestStream(); + os.Write(buffer, 0, strBuffer.Length); //Send it + os.Close(); + //m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri); + } + //catch (WebException ex) + catch + { + //m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message); + + return false; + } + + // Let's wait for the response + //m_log.Info("[REST COMMS]: Waiting for a reply after ChildAgentUpdate"); + + try + { + WebResponse webResponse = ChildUpdateRequest.GetResponse(); + if (webResponse == null) + { + m_log.Info("[REST COMMS]: Null reply on ChilAgentUpdate post"); + } + + StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + //reply = sr.ReadToEnd().Trim(); + sr.ReadToEnd().Trim(); + sr.Close(); + //m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply); + + } + catch (WebException ex) + { + m_log.InfoFormat("[REST COMMS]: exception on reply of ChilAgentUpdate {0}", ex.Message); + // ignore, really + } + + return true; + } + + public bool DoRetrieveRootAgentCall(RegionInfo region, UUID id, out IAgentData agent) + { + agent = null; + // Eventually, we want to use a caps url instead of the agentID + string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + id + "/" + region.RegionHandle.ToString() + "/"; + //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); + + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); + request.Method = "GET"; + request.Timeout = 10000; + //request.Headers.Add("authorization", ""); // coming soon + + HttpWebResponse webResponse = null; + string reply = string.Empty; + try + { + webResponse = (HttpWebResponse)request.GetResponse(); + if (webResponse == null) + { + m_log.Info("[REST COMMS]: Null reply on agent get "); + } + + StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + reply = sr.ReadToEnd().Trim(); + sr.Close(); + + //Console.WriteLine("[REST COMMS]: ChilAgentUpdate reply was " + reply); + + } + catch (WebException ex) + { + m_log.InfoFormat("[REST COMMS]: exception on reply of agent get {0}", ex.Message); + // ignore, really + return false; + } + + if (webResponse.StatusCode == HttpStatusCode.OK) + { + // we know it's jason + OSDMap args = GetOSDMap(reply); + if (args == null) + { + //Console.WriteLine("[REST COMMS]: Error getting OSDMap from reply"); + return false; + } + + agent = new CompleteAgentData(); + agent.Unpack(args); + return true; + } + + //Console.WriteLine("[REST COMMS]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode); + return false; + } + + public bool DoReleaseAgentCall(ulong regionHandle, UUID id, string uri) + { + //m_log.Debug(" >>> DoReleaseAgentCall <<< " + uri); + + WebRequest request = WebRequest.Create(uri); + request.Method = "DELETE"; + request.Timeout = 10000; + + try + { + WebResponse webResponse = request.GetResponse(); + if (webResponse == null) + { + m_log.Info("[REST COMMS]: Null reply on agent delete "); + } + + StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + //reply = sr.ReadToEnd().Trim(); + sr.ReadToEnd().Trim(); + sr.Close(); + //m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply); + + } + catch (WebException ex) + { + m_log.InfoFormat("[REST COMMS]: exception on reply of agent delete {0}", ex.Message); + // ignore, really + } + + return true; + } + + + public bool DoCloseAgentCall(RegionInfo region, UUID id) + { + string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + id + "/" + region.RegionHandle.ToString() + "/"; + + //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri); + + WebRequest request = WebRequest.Create(uri); + request.Method = "DELETE"; + request.Timeout = 10000; + + try + { + WebResponse webResponse = request.GetResponse(); + if (webResponse == null) + { + m_log.Info("[REST COMMS]: Null reply on agent delete "); + } + + StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + //reply = sr.ReadToEnd().Trim(); + sr.ReadToEnd().Trim(); + sr.Close(); + //m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply); + + } + catch (WebException ex) + { + m_log.InfoFormat("[REST COMMS]: exception on reply of agent delete {0}", ex.Message); + // ignore, really + } + + return true; + } + + public bool DoCreateObjectCall(RegionInfo region, ISceneObject sog, bool allowScriptCrossing) + { + ulong regionHandle = GetRegionHandle(region.RegionHandle); + string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/object/" + sog.UUID + "/" + regionHandle.ToString() + "/"; + //m_log.Debug(" >>> DoCreateChildAgentCall <<< " + uri); + + WebRequest ObjectCreateRequest = WebRequest.Create(uri); + ObjectCreateRequest.Method = "POST"; + ObjectCreateRequest.ContentType = "application/json"; + ObjectCreateRequest.Timeout = 10000; + + OSDMap args = new OSDMap(2); + args["sog"] = OSD.FromString(sog.ToXmlString2()); + args["extra"] = OSD.FromString(sog.ExtraToXmlString()); + if (allowScriptCrossing) + { + string state = sog.GetStateSnapshot(); + if (state.Length > 0) + args["state"] = OSD.FromString(state); + } + + string strBuffer = ""; + byte[] buffer = new byte[1]; + try + { + strBuffer = OSDParser.SerializeJsonString(args); + UTF8Encoding str = new UTF8Encoding(); + buffer = str.GetBytes(strBuffer); + + } + catch (Exception e) + { + m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of CreateObject: {0}", e.Message); + // ignore. buffer will be empty, caller should check. + } + + Stream os = null; + try + { // send the Post + ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send + os = ObjectCreateRequest.GetRequestStream(); + os.Write(buffer, 0, strBuffer.Length); //Send it + os.Close(); + m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri); + } + //catch (WebException ex) + catch + { + // m_log.InfoFormat("[REST COMMS]: Bad send on CreateObject {0}", ex.Message); + + return false; + } + + // Let's wait for the response + //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); + + try + { + WebResponse webResponse = ObjectCreateRequest.GetResponse(); + if (webResponse == null) + { + m_log.Info("[REST COMMS]: Null reply on DoCreateObjectCall post"); + } + + StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + //reply = sr.ReadToEnd().Trim(); + sr.ReadToEnd().Trim(); + sr.Close(); + //m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply); + + } + catch (WebException ex) + { + m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateObjectCall {0}", ex.Message); + // ignore, really + } + + return true; + + } + + public bool DoCreateObjectCall(RegionInfo region, UUID userID, UUID itemID) + { + ulong regionHandle = GetRegionHandle(region.RegionHandle); + string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/object/" + UUID.Zero + "/" + regionHandle.ToString() + "/"; + //m_log.Debug(" >>> DoCreateChildAgentCall <<< " + uri); + + WebRequest ObjectCreateRequest = WebRequest.Create(uri); + ObjectCreateRequest.Method = "PUT"; + ObjectCreateRequest.ContentType = "application/json"; + ObjectCreateRequest.Timeout = 10000; + + OSDMap args = new OSDMap(2); + args["userid"] = OSD.FromUUID(userID); + args["itemid"] = OSD.FromUUID(itemID); + + string strBuffer = ""; + byte[] buffer = new byte[1]; + try + { + strBuffer = OSDParser.SerializeJsonString(args); + UTF8Encoding str = new UTF8Encoding(); + buffer = str.GetBytes(strBuffer); + + } + catch (Exception e) + { + m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of CreateObject: {0}", e.Message); + // ignore. buffer will be empty, caller should check. + } + + Stream os = null; + try + { // send the Post + ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send + os = ObjectCreateRequest.GetRequestStream(); + os.Write(buffer, 0, strBuffer.Length); //Send it + os.Close(); + //m_log.InfoFormat("[REST COMMS]: Posted CreateObject request to remote sim {0}", uri); + } + //catch (WebException ex) + catch + { + // m_log.InfoFormat("[REST COMMS]: Bad send on CreateObject {0}", ex.Message); + + return false; + } + + // Let's wait for the response + //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); + + try + { + WebResponse webResponse = ObjectCreateRequest.GetResponse(); + if (webResponse == null) + { + m_log.Info("[REST COMMS]: Null reply on DoCreateObjectCall post"); + } + + StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + sr.ReadToEnd().Trim(); + sr.ReadToEnd().Trim(); + sr.Close(); + + //m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply); + + } + catch (WebException ex) + { + m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateObjectCall {0}", ex.Message); + // ignore, really + } + + return true; + + } + + public bool DoHelloNeighbourCall(RegionInfo region, RegionInfo thisRegion) + { + string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; + //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); + + WebRequest HelloNeighbourRequest = WebRequest.Create(uri); + HelloNeighbourRequest.Method = "POST"; + HelloNeighbourRequest.ContentType = "application/json"; + HelloNeighbourRequest.Timeout = 10000; + + // Fill it in + OSDMap args = null; + try + { + args = thisRegion.PackRegionInfoData(); + } + catch (Exception e) + { + m_log.Debug("[REST COMMS]: PackRegionInfoData failed with exception: " + e.Message); + } + // Add the regionhandle of the destination region + ulong regionHandle = GetRegionHandle(region.RegionHandle); + args["destination_handle"] = OSD.FromString(regionHandle.ToString()); + + string strBuffer = ""; + byte[] buffer = new byte[1]; + try + { + strBuffer = OSDParser.SerializeJsonString(args); + UTF8Encoding str = new UTF8Encoding(); + buffer = str.GetBytes(strBuffer); + + } + catch (Exception e) + { + m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of HelloNeighbour: {0}", e.Message); + // ignore. buffer will be empty, caller should check. + } + + Stream os = null; + try + { // send the Post + HelloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send + os = HelloNeighbourRequest.GetRequestStream(); + os.Write(buffer, 0, strBuffer.Length); //Send it + os.Close(); + //m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri); + } + //catch (WebException ex) + catch + { + //m_log.InfoFormat("[REST COMMS]: Bad send on HelloNeighbour {0}", ex.Message); + + return false; + } + + // Let's wait for the response + //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); + + try + { + WebResponse webResponse = HelloNeighbourRequest.GetResponse(); + if (webResponse == null) + { + m_log.Info("[REST COMMS]: Null reply on DoHelloNeighbourCall post"); + } + + StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + //reply = sr.ReadToEnd().Trim(); + sr.ReadToEnd().Trim(); + sr.Close(); + //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); + + } + catch (WebException ex) + { + m_log.InfoFormat("[REST COMMS]: exception on reply of DoHelloNeighbourCall {0}", ex.Message); + // ignore, really + } + + return true; + + } + + #region Hyperlinks + + public virtual ulong GetRegionHandle(ulong handle) + { + return handle; + } + + public virtual bool IsHyperlink(ulong handle) + { + return false; + } + + public virtual void SendUserInformation(RegionInfo regInfo, AgentCircuitData aCircuit) + { + } + + public virtual void AdjustUserInformation(AgentCircuitData aCircuit) + { + } + + #endregion /* Hyperlinks */ + + public static OSDMap GetOSDMap(string data) + { + OSDMap args = null; + try + { + OSD buffer; + // We should pay attention to the content-type, but let's assume we know it's Json + buffer = OSDParser.DeserializeJson(data); + if (buffer.Type == OSDType.Map) + { + args = (OSDMap)buffer; + return args; + } + else + { + // uh? + System.Console.WriteLine("[REST COMMS]: Got OSD of type " + buffer.Type.ToString()); + return null; + } + } + catch (Exception ex) + { + System.Console.WriteLine("[REST COMMS]: exception on parse of REST message " + ex.Message); + return null; + } + } + + + } +} diff --git a/OpenSim/Framework/ISceneObject.cs b/OpenSim/Framework/ISceneObject.cs index 87dcc2dfbf..c327b05a80 100644 --- a/OpenSim/Framework/ISceneObject.cs +++ b/OpenSim/Framework/ISceneObject.cs @@ -1,42 +1,42 @@ -/* - * 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 OpenSimulator 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 OpenMetaverse; - -namespace OpenSim.Framework -{ - public interface ISceneObject - { - UUID UUID { get; } - ISceneObject CloneForNewScene(); - string ToXmlString2(); - string ExtraToXmlString(); - void ExtraFromXmlString(string xmlstr); - string GetStateSnapshot(); - void SetState(string xmlstr, UUID regionID); - } -} +/* + * 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 OpenSimulator 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 OpenMetaverse; + +namespace OpenSim.Framework +{ + public interface ISceneObject + { + UUID UUID { get; } + ISceneObject CloneForNewScene(); + string ToXmlString2(); + string ExtraToXmlString(); + void ExtraFromXmlString(string xmlstr); + string GetStateSnapshot(); + void SetState(string xmlstr, UUID regionID); + } +} diff --git a/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs b/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs index 6c109289bc..580c8e1a58 100644 --- a/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs +++ b/OpenSim/Region/OptionalModules/Autooar/AutooarModule.cs @@ -1,72 +1,72 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using System.Timers; -using Nini.Config; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; - -namespace OpenSim.Region.OptionalModules.Autooar -{ - public class AutooarModule : IRegionModule - { - private readonly Timer m_timer = new Timer(60000*20); - private readonly List m_scenes = new List(); - private IConfigSource config; - private bool m_enabled = false; - - - public void Initialise(Scene scene, IConfigSource source) - { - m_scenes.Add(scene); - config = source; - } - - public void PostInitialise() - { - if(config.Configs["autooar"] != null) - { - m_enabled = config.Configs["autooar"].GetBoolean("Enabled", m_enabled); - } - - if(m_enabled) - { - m_timer.Elapsed += m_timer_Elapsed; - m_timer.AutoReset = true; - m_timer.Start(); - } - } - - void m_timer_Elapsed(object sender, ElapsedEventArgs e) - { - if (!Directory.Exists("autooars")) - Directory.CreateDirectory("autooars"); - - foreach (Scene scene in m_scenes) - { - IRegionArchiverModule archiver = scene.RequestModuleInterface(); - - archiver.ArchiveRegion(Path.Combine("autooars", - scene.RegionInfo.RegionName + "_" + scene.RegionInfo.RegionLocX + - "x" + scene.RegionInfo.RegionLocY + ".oar.tar.gz")); - } - } - - public void Close() - { - if (m_timer.Enabled) - m_timer.Stop(); - } - - public string Name - { - get { return "Automatic OAR Module"; } - } - - public bool IsSharedModule - { - get { return true; } - } - } -} +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Timers; +using Nini.Config; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.OptionalModules.Autooar +{ + public class AutooarModule : IRegionModule + { + private readonly Timer m_timer = new Timer(60000*20); + private readonly List m_scenes = new List(); + private IConfigSource config; + private bool m_enabled = false; + + + public void Initialise(Scene scene, IConfigSource source) + { + m_scenes.Add(scene); + config = source; + } + + public void PostInitialise() + { + if(config.Configs["autooar"] != null) + { + m_enabled = config.Configs["autooar"].GetBoolean("Enabled", m_enabled); + } + + if(m_enabled) + { + m_timer.Elapsed += m_timer_Elapsed; + m_timer.AutoReset = true; + m_timer.Start(); + } + } + + void m_timer_Elapsed(object sender, ElapsedEventArgs e) + { + if (!Directory.Exists("autooars")) + Directory.CreateDirectory("autooars"); + + foreach (Scene scene in m_scenes) + { + IRegionArchiverModule archiver = scene.RequestModuleInterface(); + + archiver.ArchiveRegion(Path.Combine("autooars", + scene.RegionInfo.RegionName + "_" + scene.RegionInfo.RegionLocX + + "x" + scene.RegionInfo.RegionLocY + ".oar.tar.gz")); + } + } + + public void Close() + { + if (m_timer.Enabled) + m_timer.Stop(); + } + + public string Name + { + get { return "Automatic OAR Module"; } + } + + public bool IsSharedModule + { + get { return true; } + } + } +} diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IParcel.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IParcel.cs index 2a973a9c6a..2849f161ee 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IParcel.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IParcel.cs @@ -1,15 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenMetaverse; - -namespace OpenSim.Region.OptionalModules.Scripting.Minimodule -{ - public interface IParcel - { - string Name { get; set; } - string Description { get; set; } - ISocialEntity Owner { get; set; } - bool[,] Bitmap { get; } - } -} +using System; +using System.Collections.Generic; +using System.Text; +using OpenMetaverse; + +namespace OpenSim.Region.OptionalModules.Scripting.Minimodule +{ + public interface IParcel + { + string Name { get; set; } + string Description { get; set; } + ISocialEntity Owner { get; set; } + bool[,] Bitmap { get; } + } +} diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IPersistence.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IPersistence.cs index e433c11dbc..c09388046f 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IPersistence.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IPersistence.cs @@ -1,29 +1,29 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.OptionalModules.Scripting.Minimodule -{ - interface IPersistence - { - T Get(Guid storageID); - T Get(); - - /// - /// Stores 'data' into the persistence system - /// associated with this object, however saved - /// under the ID 'storageID'. This data may - /// be accessed by other scripts however. - /// - /// - /// - void Put(Guid storageID, T data); - - /// - /// Stores 'data' into the persistence system - /// using the default ID for this script. - /// - /// - void Put(T data); - } -} +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.OptionalModules.Scripting.Minimodule +{ + interface IPersistence + { + T Get(Guid storageID); + T Get(); + + /// + /// Stores 'data' into the persistence system + /// associated with this object, however saved + /// under the ID 'storageID'. This data may + /// be accessed by other scripts however. + /// + /// + /// + void Put(Guid storageID, T data); + + /// + /// Stores 'data' into the persistence system + /// using the default ID for this script. + /// + /// + void Put(T data); + } +} diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISocialEntity.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISocialEntity.cs index 0833ffd17d..cc664eb4c3 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISocialEntity.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISocialEntity.cs @@ -1,14 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenMetaverse; - -namespace OpenSim.Region.OptionalModules.Scripting.Minimodule -{ - public interface ISocialEntity - { - UUID GlobalID { get; } - string Name { get; } - bool IsUser { get; } - } +using System; +using System.Collections.Generic; +using System.Text; +using OpenMetaverse; + +namespace OpenSim.Region.OptionalModules.Scripting.Minimodule +{ + public interface ISocialEntity + { + UUID GlobalID { get; } + string Name { get; } + bool IsUser { get; } + } } \ No newline at end of file diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs index aceeacce15..8ab1a56afd 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/LOParcel.cs @@ -1,45 +1,45 @@ -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; - -namespace OpenSim.Region.OptionalModules.Scripting.Minimodule -{ - class LOParcel : IParcel - { - private readonly Scene m_scene; - private readonly int m_parcelID; - - public LOParcel(Scene m_scene, int m_parcelID) - { - this.m_scene = m_scene; - this.m_parcelID = m_parcelID; - } - - private ILandObject GetLO() - { - return m_scene.LandChannel.GetLandObject(m_parcelID); - } - - public string Name - { - get { return GetLO().landData.Name; } - set { GetLO().landData.Name = value; } - } - - public string Description - { - get { return GetLO().landData.Description; } - set { GetLO().landData.Description = value; } - } - - public ISocialEntity Owner - { - get { throw new System.NotImplementedException(); } - set { throw new System.NotImplementedException(); } - } - - public bool[,] Bitmap - { - get { return GetLO().landBitmap; } - } - } -} +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.OptionalModules.Scripting.Minimodule +{ + class LOParcel : IParcel + { + private readonly Scene m_scene; + private readonly int m_parcelID; + + public LOParcel(Scene m_scene, int m_parcelID) + { + this.m_scene = m_scene; + this.m_parcelID = m_parcelID; + } + + private ILandObject GetLO() + { + return m_scene.LandChannel.GetLandObject(m_parcelID); + } + + public string Name + { + get { return GetLO().landData.Name; } + set { GetLO().landData.Name = value; } + } + + public string Description + { + get { return GetLO().landData.Description; } + set { GetLO().landData.Description = value; } + } + + public ISocialEntity Owner + { + get { throw new System.NotImplementedException(); } + set { throw new System.NotImplementedException(); } + } + + public bool[,] Bitmap + { + get { return GetLO().landBitmap; } + } + } +} diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectPhysics.cs index 6ca4e5fe98..3682e9b83d 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectPhysics.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectPhysics.cs @@ -1,39 +1,39 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenMetaverse; - -namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Object -{ - /// - /// This implements an interface similar to that provided by physics engines to OpenSim internally. - /// Eg, PhysicsActor. It is capable of setting and getting properties related to the current - /// physics scene representation of this object. - /// - public interface IObjectPhysics - { - bool Enabled { get; set; } - - bool Phantom { get; set; } - bool PhantomCollisions { get; set; } - - double Density { get; set; } - double Mass { get; set; } - double Buoyancy { get; set; } - - Vector3 GeometricCenter { get; } - Vector3 CenterOfMass { get; } - - Vector3 RotationalVelocity { get; set; } - Vector3 Velocity { get; set; } - Vector3 Torque { get; set; } - Vector3 Acceleration { get; } - Vector3 Force { get; set; } - - bool FloatOnWater { set; } - - void AddForce(Vector3 force, bool pushforce); - void AddAngularForce(Vector3 force, bool pushforce); - void SetMomentum(Vector3 momentum); - } -} +using System; +using System.Collections.Generic; +using System.Text; +using OpenMetaverse; + +namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Object +{ + /// + /// This implements an interface similar to that provided by physics engines to OpenSim internally. + /// Eg, PhysicsActor. It is capable of setting and getting properties related to the current + /// physics scene representation of this object. + /// + public interface IObjectPhysics + { + bool Enabled { get; set; } + + bool Phantom { get; set; } + bool PhantomCollisions { get; set; } + + double Density { get; set; } + double Mass { get; set; } + double Buoyancy { get; set; } + + Vector3 GeometricCenter { get; } + Vector3 CenterOfMass { get; } + + Vector3 RotationalVelocity { get; set; } + Vector3 Velocity { get; set; } + Vector3 Torque { get; set; } + Vector3 Acceleration { get; } + Vector3 Force { get; set; } + + bool FloatOnWater { set; } + + void AddForce(Vector3 force, bool pushforce); + void AddAngularForce(Vector3 force, bool pushforce); + void SetMomentum(Vector3 momentum); + } +} diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SEUser.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SEUser.cs index a35e0514e3..a7da114f36 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SEUser.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SEUser.cs @@ -1,34 +1,34 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenMetaverse; - -namespace OpenSim.Region.OptionalModules.Scripting.Minimodule -{ - class SEUser : ISocialEntity - { - private readonly UUID m_uuid; - private readonly string m_name; - - public SEUser(UUID uuid, string name) - { - m_uuid = uuid; - m_name = name; - } - - public UUID GlobalID - { - get { return m_uuid; } - } - - public string Name - { - get { return m_name; } - } - - public bool IsUser - { - get { return true; } - } - } -} +using System; +using System.Collections.Generic; +using System.Text; +using OpenMetaverse; + +namespace OpenSim.Region.OptionalModules.Scripting.Minimodule +{ + class SEUser : ISocialEntity + { + private readonly UUID m_uuid; + private readonly string m_name; + + public SEUser(UUID uuid, string name) + { + m_uuid = uuid; + m_name = name; + } + + public UUID GlobalID + { + get { return m_uuid; } + } + + public string Name + { + get { return m_name; } + } + + public bool IsUser + { + get { return true; } + } + } +}