diff --git a/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs
deleted file mode 100644
index 03c12dd560..0000000000
--- a/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the 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 System;
-using System.IO;
-using System.Net;
-using System.Reflection;
-using System.Text;
-using System.Xml;
-using System.Xml.Serialization;
-using log4net;
-
-namespace OpenSim.Framework.Servers.HttpServer
-{
- public class AsynchronousRestObjectRequester
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- ///
- /// Perform an asynchronous REST request.
- ///
- /// GET or POST
- ///
- ///
- ///
- ///
- ///
- /// Thrown if we encounter a
- /// network issue while posting the request. You'll want to make
- /// sure you deal with this as they're not uncommon
- //
- public static void MakeRequest(string verb,
- string requestUrl, TRequest obj, Action action)
- {
-// m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl);
-
- Type type = typeof (TRequest);
-
- WebRequest request = WebRequest.Create(requestUrl);
- WebResponse response = null;
- TResponse deserial = default(TResponse);
- XmlSerializer deserializer = new XmlSerializer(typeof (TResponse));
-
- request.Method = verb;
-
- if (verb == "POST")
- {
- request.ContentType = "text/xml";
-
- MemoryStream buffer = new MemoryStream();
-
- XmlWriterSettings settings = new XmlWriterSettings();
- settings.Encoding = Encoding.UTF8;
-
- using (XmlWriter writer = XmlWriter.Create(buffer, settings))
- {
- XmlSerializer serializer = new XmlSerializer(type);
- serializer.Serialize(writer, obj);
- writer.Flush();
- }
-
- int length = (int) buffer.Length;
- request.ContentLength = length;
-
- request.BeginGetRequestStream(delegate(IAsyncResult res)
- {
- Stream requestStream = request.EndGetRequestStream(res);
-
- requestStream.Write(buffer.ToArray(), 0, length);
- requestStream.Close();
-
- request.BeginGetResponse(delegate(IAsyncResult ar)
- {
- response = request.EndGetResponse(ar);
- Stream respStream = null;
- try
- {
- respStream = response.GetResponseStream();
- deserial = (TResponse)deserializer.Deserialize(
- respStream);
- }
- catch (System.InvalidOperationException)
- {
- }
- finally
- {
- // Let's not close this
- //buffer.Close();
- respStream.Close();
- response.Close();
- }
-
- action(deserial);
-
- }, null);
- }, null);
-
-
- return;
- }
-
- request.BeginGetResponse(delegate(IAsyncResult res2)
- {
- try
- {
- // If the server returns a 404, this appears to trigger a System.Net.WebException even though that isn't
- // documented in MSDN
- response = request.EndGetResponse(res2);
-
- Stream respStream = null;
- try
- {
- respStream = response.GetResponseStream();
- deserial = (TResponse)deserializer.Deserialize(respStream);
- }
- catch (System.InvalidOperationException)
- {
- }
- finally
- {
- respStream.Close();
- response.Close();
- }
- }
- catch (WebException e)
- {
- if (e.Status == WebExceptionStatus.ProtocolError)
- {
- if (e.Response is HttpWebResponse)
- {
- HttpWebResponse httpResponse = (HttpWebResponse)e.Response;
-
- if (httpResponse.StatusCode != HttpStatusCode.NotFound)
- {
- // We don't appear to be handling any other status codes, so log these feailures to that
- // people don't spend unnecessary hours hunting phantom bugs.
- m_log.DebugFormat(
- "[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}",
- verb, requestUrl, httpResponse.StatusCode);
- }
- }
- }
- else
- {
- m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with status {2} and message {3}", verb, requestUrl, e.Status, e.Message);
- }
- }
- catch (Exception e)
- {
- m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with exception {2}", verb, requestUrl, e);
- }
-
- // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString());
-
- try
- {
- action(deserial);
- }
- catch (Exception e)
- {
- m_log.ErrorFormat(
- "[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}", verb, requestUrl, e);
- }
-
- }, null);
- }
- }
-}
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
deleted file mode 100644
index 41ece86047..0000000000
--- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the 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 System;
-using System.IO;
-using System.Net;
-using System.Reflection;
-using System.Text;
-using System.Xml;
-using System.Xml.Serialization;
-
-using log4net;
-
-namespace OpenSim.Framework.Servers.HttpServer
-{
- public class SynchronousRestFormsRequester
- {
- private static readonly ILog m_log =
- LogManager.GetLogger(
- MethodBase.GetCurrentMethod().DeclaringType);
-
- ///
- /// Perform a synchronous REST request.
- ///
- ///
- ///
- ///
- ///
- ///
- /// Thrown if we encounter a network issue while posting
- /// the request. You'll want to make sure you deal with this as they're not uncommon
- public static string MakeRequest(string verb, string requestUrl, string obj)
- {
- WebRequest request = WebRequest.Create(requestUrl);
- request.Method = verb;
- string respstring = String.Empty;
-
- using (MemoryStream buffer = new MemoryStream())
- {
- if ((verb == "POST") || (verb == "PUT"))
- {
- request.ContentType = "text/www-form-urlencoded";
-
- int length = 0;
- using (StreamWriter writer = new StreamWriter(buffer))
- {
- writer.Write(obj);
- writer.Flush();
- }
-
- length = (int)obj.Length;
- request.ContentLength = length;
-
- Stream requestStream = null;
- try
- {
- requestStream = request.GetRequestStream();
- requestStream.Write(buffer.ToArray(), 0, length);
- }
- catch (Exception e)
- {
- m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl);
- }
- finally
- {
- if (requestStream != null)
- requestStream.Close();
- }
- }
-
- try
- {
- using (WebResponse resp = request.GetResponse())
- {
- if (resp.ContentLength != 0)
- {
- Stream respStream = null;
- try
- {
- respStream = resp.GetResponseStream();
- using (StreamReader reader = new StreamReader(respStream))
- {
- respstring = reader.ReadToEnd();
- }
- }
- catch (Exception e)
- {
- m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString());
- }
- finally
- {
- if (respStream != null)
- respStream.Close();
- }
- }
- }
- }
- catch (System.InvalidOperationException)
- {
- // This is what happens when there is invalid XML
- m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request");
- }
- }
- return respstring;
- }
- }
-}
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs
deleted file mode 100644
index eab463cbd8..0000000000
--- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) Contributors, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the 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 System;
-using System.IO;
-using System.Net;
-using System.Text;
-using System.Xml;
-using System.Xml.Serialization;
-
-namespace OpenSim.Framework.Servers.HttpServer
-{
- public class SynchronousRestObjectPoster
- {
- [Obsolete]
- public static TResponse BeginPostObject(string verb, string requestUrl, TRequest obj)
- {
- return SynchronousRestObjectRequester.MakeRequest(verb, requestUrl, obj);
- }
- }
-
- public class SynchronousRestObjectRequester
- {
- ///
- /// Perform a synchronous REST request.
- ///
- ///
- ///
- ///
- ///
- ///
- /// Thrown if we encounter a network issue while posting
- /// the request. You'll want to make sure you deal with this as they're not uncommon
- public static TResponse MakeRequest(string verb, string requestUrl, TRequest obj)
- {
- Type type = typeof (TRequest);
- TResponse deserial = default(TResponse);
-
- WebRequest request = WebRequest.Create(requestUrl);
- request.Method = verb;
-
- if ((verb == "POST") || (verb == "PUT"))
- {
- request.ContentType = "text/xml";
-
- MemoryStream buffer = new MemoryStream();
-
- XmlWriterSettings settings = new XmlWriterSettings();
- settings.Encoding = Encoding.UTF8;
-
- using (XmlWriter writer = XmlWriter.Create(buffer, settings))
- {
- XmlSerializer serializer = new XmlSerializer(type);
- serializer.Serialize(writer, obj);
- writer.Flush();
- }
-
- int length = (int) buffer.Length;
- request.ContentLength = length;
-
- Stream requestStream = null;
- try
- {
- requestStream = request.GetRequestStream();
- requestStream.Write(buffer.ToArray(), 0, length);
- }
- catch (Exception)
- {
- return deserial;
- }
- finally
- {
- if (requestStream != null)
- requestStream.Close();
- }
- }
-
- try
- {
- using (WebResponse resp = request.GetResponse())
- {
- if (resp.ContentLength > 0)
- {
- Stream respStream = resp.GetResponseStream();
- XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
- deserial = (TResponse)deserializer.Deserialize(respStream);
- respStream.Close();
- }
- }
- }
- catch (System.InvalidOperationException)
- {
- // This is what happens when there is invalid XML
- }
- return deserial;
- }
- }
-}
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 1feeeb31e5..64cd014f5c 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -36,6 +36,9 @@ using System.Net.Security;
using System.Reflection;
using System.Text;
using System.Web;
+using System.Xml;
+using System.Xml.Serialization;
+
using log4net;
using OpenSim.Framework.Servers.HttpServer;
using OpenMetaverse.StructuredData;
@@ -625,4 +628,336 @@ namespace OpenSim.Framework
}
+
+ public static class AsynchronousRestObjectRequester
+ {
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ ///
+ /// Perform an asynchronous REST request.
+ ///
+ /// GET or POST
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown if we encounter a
+ /// network issue while posting the request. You'll want to make
+ /// sure you deal with this as they're not uncommon
+ //
+ public static void MakeRequest(string verb,
+ string requestUrl, TRequest obj, Action action)
+ {
+ // m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl);
+
+ Type type = typeof(TRequest);
+
+ WebRequest request = WebRequest.Create(requestUrl);
+ WebResponse response = null;
+ TResponse deserial = default(TResponse);
+ XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
+
+ request.Method = verb;
+
+ if (verb == "POST")
+ {
+ request.ContentType = "text/xml";
+
+ MemoryStream buffer = new MemoryStream();
+
+ XmlWriterSettings settings = new XmlWriterSettings();
+ settings.Encoding = Encoding.UTF8;
+
+ using (XmlWriter writer = XmlWriter.Create(buffer, settings))
+ {
+ XmlSerializer serializer = new XmlSerializer(type);
+ serializer.Serialize(writer, obj);
+ writer.Flush();
+ }
+
+ int length = (int)buffer.Length;
+ request.ContentLength = length;
+
+ request.BeginGetRequestStream(delegate(IAsyncResult res)
+ {
+ Stream requestStream = request.EndGetRequestStream(res);
+
+ requestStream.Write(buffer.ToArray(), 0, length);
+ requestStream.Close();
+
+ request.BeginGetResponse(delegate(IAsyncResult ar)
+ {
+ response = request.EndGetResponse(ar);
+ Stream respStream = null;
+ try
+ {
+ respStream = response.GetResponseStream();
+ deserial = (TResponse)deserializer.Deserialize(
+ respStream);
+ }
+ catch (System.InvalidOperationException)
+ {
+ }
+ finally
+ {
+ // Let's not close this
+ //buffer.Close();
+ respStream.Close();
+ response.Close();
+ }
+
+ action(deserial);
+
+ }, null);
+ }, null);
+
+
+ return;
+ }
+
+ request.BeginGetResponse(delegate(IAsyncResult res2)
+ {
+ try
+ {
+ // If the server returns a 404, this appears to trigger a System.Net.WebException even though that isn't
+ // documented in MSDN
+ response = request.EndGetResponse(res2);
+
+ Stream respStream = null;
+ try
+ {
+ respStream = response.GetResponseStream();
+ deserial = (TResponse)deserializer.Deserialize(respStream);
+ }
+ catch (System.InvalidOperationException)
+ {
+ }
+ finally
+ {
+ respStream.Close();
+ response.Close();
+ }
+ }
+ catch (WebException e)
+ {
+ if (e.Status == WebExceptionStatus.ProtocolError)
+ {
+ if (e.Response is HttpWebResponse)
+ {
+ HttpWebResponse httpResponse = (HttpWebResponse)e.Response;
+
+ if (httpResponse.StatusCode != HttpStatusCode.NotFound)
+ {
+ // We don't appear to be handling any other status codes, so log these feailures to that
+ // people don't spend unnecessary hours hunting phantom bugs.
+ m_log.DebugFormat(
+ "[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}",
+ verb, requestUrl, httpResponse.StatusCode);
+ }
+ }
+ }
+ else
+ {
+ m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with status {2} and message {3}", verb, requestUrl, e.Status, e.Message);
+ }
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with exception {2}", verb, requestUrl, e);
+ }
+
+ // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString());
+
+ try
+ {
+ action(deserial);
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat(
+ "[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}", verb, requestUrl, e);
+ }
+
+ }, null);
+ }
+ }
+
+ public static class SynchronousRestFormsRequester
+ {
+ private static readonly ILog m_log =
+ LogManager.GetLogger(
+ MethodBase.GetCurrentMethod().DeclaringType);
+
+ ///
+ /// Perform a synchronous REST request.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown if we encounter a network issue while posting
+ /// the request. You'll want to make sure you deal with this as they're not uncommon
+ public static string MakeRequest(string verb, string requestUrl, string obj)
+ {
+ WebRequest request = WebRequest.Create(requestUrl);
+ request.Method = verb;
+ string respstring = String.Empty;
+
+ using (MemoryStream buffer = new MemoryStream())
+ {
+ if ((verb == "POST") || (verb == "PUT"))
+ {
+ request.ContentType = "text/www-form-urlencoded";
+
+ int length = 0;
+ using (StreamWriter writer = new StreamWriter(buffer))
+ {
+ writer.Write(obj);
+ writer.Flush();
+ }
+
+ length = (int)obj.Length;
+ request.ContentLength = length;
+
+ Stream requestStream = null;
+ try
+ {
+ requestStream = request.GetRequestStream();
+ requestStream.Write(buffer.ToArray(), 0, length);
+ }
+ catch (Exception e)
+ {
+ m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl);
+ }
+ finally
+ {
+ if (requestStream != null)
+ requestStream.Close();
+ }
+ }
+
+ try
+ {
+ using (WebResponse resp = request.GetResponse())
+ {
+ if (resp.ContentLength != 0)
+ {
+ Stream respStream = null;
+ try
+ {
+ respStream = resp.GetResponseStream();
+ using (StreamReader reader = new StreamReader(respStream))
+ {
+ respstring = reader.ReadToEnd();
+ }
+ }
+ catch (Exception e)
+ {
+ m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString());
+ }
+ finally
+ {
+ if (respStream != null)
+ respStream.Close();
+ }
+ }
+ }
+ }
+ catch (System.InvalidOperationException)
+ {
+ // This is what happens when there is invalid XML
+ m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request");
+ }
+ }
+ return respstring;
+ }
+ }
+
+ public class SynchronousRestObjectPoster
+ {
+ [Obsolete]
+ public static TResponse BeginPostObject(string verb, string requestUrl, TRequest obj)
+ {
+ return SynchronousRestObjectRequester.MakeRequest(verb, requestUrl, obj);
+ }
+ }
+
+ public class SynchronousRestObjectRequester
+ {
+ ///
+ /// Perform a synchronous REST request.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown if we encounter a network issue while posting
+ /// the request. You'll want to make sure you deal with this as they're not uncommon
+ public static TResponse MakeRequest(string verb, string requestUrl, TRequest obj)
+ {
+ Type type = typeof(TRequest);
+ TResponse deserial = default(TResponse);
+
+ WebRequest request = WebRequest.Create(requestUrl);
+ request.Method = verb;
+
+ if ((verb == "POST") || (verb == "PUT"))
+ {
+ request.ContentType = "text/xml";
+
+ MemoryStream buffer = new MemoryStream();
+
+ XmlWriterSettings settings = new XmlWriterSettings();
+ settings.Encoding = Encoding.UTF8;
+
+ using (XmlWriter writer = XmlWriter.Create(buffer, settings))
+ {
+ XmlSerializer serializer = new XmlSerializer(type);
+ serializer.Serialize(writer, obj);
+ writer.Flush();
+ }
+
+ int length = (int)buffer.Length;
+ request.ContentLength = length;
+
+ Stream requestStream = null;
+ try
+ {
+ requestStream = request.GetRequestStream();
+ requestStream.Write(buffer.ToArray(), 0, length);
+ }
+ catch (Exception)
+ {
+ return deserial;
+ }
+ finally
+ {
+ if (requestStream != null)
+ requestStream.Close();
+ }
+ }
+
+ try
+ {
+ using (WebResponse resp = request.GetResponse())
+ {
+ if (resp.ContentLength > 0)
+ {
+ Stream respStream = resp.GetResponseStream();
+ XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
+ deserial = (TResponse)deserializer.Deserialize(respStream);
+ respStream.Close();
+ }
+ }
+ }
+ catch (System.InvalidOperationException)
+ {
+ // This is what happens when there is invalid XML
+ }
+ return deserial;
+ }
+ }
}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index cf04f0d809..1f7e66dabb 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4049,7 +4049,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ppcnt++;
}
-
Int32 fpcnt = 0;
Int32 fbcnt = 0;
@@ -4298,6 +4297,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendEstateCovenantInformation(UUID covenant)
{
+// m_log.DebugFormat("[LLCLIENTVIEW]: Sending estate covenant asset id of {0} to {1}", covenant, Name);
+
EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket();
EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock();
edata.CovenantID = covenant;
@@ -4308,8 +4309,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(einfopack, ThrottleOutPacketType.Task);
}
- public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner)
+ public void SendDetailedEstateData(
+ UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition,
+ UUID covenant, string abuseEmail, UUID estateOwner)
{
+// m_log.DebugFormat(
+// "[LLCLIENTVIEW]: Sending detailed estate data to {0} with covenant asset id {1}", Name, covenant);
+
EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
packet.MethodData.Invoice = invoice;
packet.AgentData.TransactionID = UUID.Random();
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 4d74b2a0a0..5baf0785f4 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -34,13 +34,13 @@ using Nini.Config;
using Nwc.XmlRpc;
using OpenMetaverse;
using OpenSim.Framework;
+using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using OpenSim.Services.Connectors.Friends;
using OpenSim.Server.Base;
-using OpenSim.Framework.Servers.HttpServer;
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index fdfcd104c0..919ea338f4 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -33,7 +33,6 @@ using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Servers;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Framework.Client;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 73b0a35b7c..c0946f4d52 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -222,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
deletes[g.OwnerID].Add(g);
}
- // This is pethod scoped and will be returned. It will be the
+ // This is method scoped and will be returned. It will be the
// last created asset id
UUID assetID = UUID.Zero;
@@ -230,8 +230,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// with distinct destinations as well.
foreach (List objlist in deletes.Values)
{
- Dictionary xmlStrings =
- new Dictionary();
+ CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero);
+ Dictionary originalPositions = new Dictionary();
foreach (SceneObjectGroup objectGroup in objlist)
{
@@ -245,7 +245,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
: objectGroup.AbsolutePosition.X,
objectGroup.AbsolutePosition.Z);
- Vector3 originalPosition = objectGroup.AbsolutePosition;
+ originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition;
objectGroup.AbsolutePosition = inventoryStoredPosition;
@@ -259,59 +259,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
(uint)PermissionMask.Modify);
objectGroup.RootPart.NextOwnerMask |=
(uint)PermissionMask.Move;
-
- string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup);
-
- objectGroup.AbsolutePosition = originalPosition;
-
- xmlStrings[objectGroup.UUID] = sceneObjectXml;
+
+ coa.Add(objectGroup);
}
string itemXml;
if (objlist.Count > 1)
- {
- float minX, minY, minZ;
- float maxX, maxY, maxZ;
-
- Vector3[] offsets = m_Scene.GetCombinedBoundingBox(objlist,
- out minX, out maxX, out minY, out maxY,
- out minZ, out maxZ);
-
- // CreateWrapper
- XmlDocument itemDoc = new XmlDocument();
- XmlElement root = itemDoc.CreateElement("", "CoalescedObject", "");
- itemDoc.AppendChild(root);
-
- // Embed the offsets into the group XML
- for ( int i = 0 ; i < objlist.Count ; i++ )
- {
- XmlDocument doc = new XmlDocument();
- SceneObjectGroup g = objlist[i];
- doc.LoadXml(xmlStrings[g.UUID]);
- XmlElement e = (XmlElement)doc.SelectSingleNode("/SceneObjectGroup");
- e.SetAttribute("offsetx", offsets[i].X.ToString());
- e.SetAttribute("offsety", offsets[i].Y.ToString());
- e.SetAttribute("offsetz", offsets[i].Z.ToString());
-
- XmlNode objectNode = itemDoc.ImportNode(e, true);
- root.AppendChild(objectNode);
- }
-
- float sizeX = maxX - minX;
- float sizeY = maxY - minY;
- float sizeZ = maxZ - minZ;
-
- root.SetAttribute("x", sizeX.ToString());
- root.SetAttribute("y", sizeY.ToString());
- root.SetAttribute("z", sizeZ.ToString());
-
- itemXml = itemDoc.InnerXml;
- }
+ itemXml = CoalescedSceneObjectsSerializer.ToXml(coa);
else
- {
- itemXml = xmlStrings[objlist[0].UUID];
- }
+ itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0]);
+
+ // Restore the position of each group now that it has been stored to inventory.
+ foreach (SceneObjectGroup objectGroup in objlist)
+ objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID];
// Get the user info of the item destination
//
@@ -332,7 +293,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
// All returns / deletes go to the object owner
//
-
userID = objlist[0].RootPart.OwnerID;
}
@@ -346,7 +306,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// Delete is treated like return in this case
// Deleting your own items makes them go to trash
//
-
+
InventoryFolderBase folder = null;
InventoryItemBase item = null;
@@ -548,7 +508,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
return assetID;
}
-
///
/// Rez an object into the scene from the user's inventory
///
@@ -659,9 +618,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
itemId, n.OuterXml);
objlist.Add(g);
XmlElement el = (XmlElement)n;
- float x = Convert.ToSingle(el.GetAttribute("offsetx"));
- float y = Convert.ToSingle(el.GetAttribute("offsety"));
- float z = Convert.ToSingle(el.GetAttribute("offsetz"));
+
+ string rawX = el.GetAttribute("offsetx");
+ string rawY = el.GetAttribute("offsety");
+ string rawZ = el.GetAttribute("offsetz");
+//
+// m_log.DebugFormat(
+// "[INVENTORY ACCESS MODULE]: Converting coalesced object {0} offset <{1}, {2}, {3}>",
+// g.Name, rawX, rawY, rawZ);
+
+ float x = Convert.ToSingle(rawX);
+ float y = Convert.ToSingle(rawY);
+ float z = Convert.ToSingle(rawZ);
veclist.Add(new Vector3(x, y, z));
}
}
@@ -753,10 +721,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// affect the name stored in the serialization, transfer
// the correct name from the inventory to the
// object itself before we rez.
- rootPart.Name = item.Name;
- rootPart.Description = item.Description;
- rootPart.ObjectSaleType = item.SaleType;
- rootPart.SalePrice = item.SalePrice;
+ //
+ // Only do these for the first object if we are rezzing a coalescence.
+ if (i == 0)
+ {
+ rootPart.Name = item.Name;
+ rootPart.Description = item.Description;
+ rootPart.ObjectSaleType = item.SaleType;
+ rootPart.SalePrice = item.SalePrice;
+ }
group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
if ((rootPart.OwnerID != item.Owner) ||
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
new file mode 100644
index 0000000000..c76a30af69
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
@@ -0,0 +1,220 @@
+/*
+ * 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 System;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using System.Threading;
+using Nini.Config;
+using NUnit.Framework;
+using OpenMetaverse;
+using OpenSim.Data;
+using OpenSim.Framework;
+using OpenSim.Framework.Serialization;
+using OpenSim.Framework.Serialization.External;
+using OpenSim.Framework.Communications;
+using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
+using OpenSim.Region.CoreModules.Framework.InventoryAccess;
+using OpenSim.Region.Framework.Scenes;
+using OpenSim.Region.Framework.Scenes.Serialization;
+using OpenSim.Services.Interfaces;
+using OpenSim.Tests.Common;
+using OpenSim.Tests.Common.Mock;
+using OpenSim.Tests.Common.Setup;
+
+namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
+{
+ [TestFixture]
+ public class InventoryAccessModuleTests
+ {
+ protected TestScene m_scene;
+ protected BasicInventoryAccessModule m_iam;
+ protected UUID m_userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
+ protected TestClient m_tc;
+
+ [SetUp]
+ public void SetUp()
+ {
+ m_iam = new BasicInventoryAccessModule();
+
+ IConfigSource config = new IniConfigSource();
+ config.AddConfig("Modules");
+ config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
+
+ m_scene = SceneSetupHelpers.SetupScene("Inventory");
+ SceneSetupHelpers.SetupSceneModules(m_scene, config, m_iam);
+
+ // Create user
+ string userFirstName = "Jock";
+ string userLastName = "Stirrup";
+ string userPassword = "troll";
+ UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, m_userId, userPassword);
+
+ AgentCircuitData acd = new AgentCircuitData();
+ acd.AgentID = m_userId;
+ m_tc = new TestClient(acd, m_scene);
+ }
+
+ [Test]
+ public void TestRezCoalescedObject()
+ {
+ TestHelper.InMethod();
+// log4net.Config.XmlConfigurator.Configure();
+
+ // Create asset
+ SceneObjectGroup object1;
+ {
+ string partName = "Object1";
+ UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
+ PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
+ Vector3 groupPosition = new Vector3(10, 20, 30);
+ Quaternion rotationOffset = Quaternion.Identity;
+ Vector3 offsetPosition = new Vector3(5, 10, 15);
+
+ SceneObjectPart part1
+ = new SceneObjectPart(
+ ownerId, shape, groupPosition, rotationOffset, offsetPosition);
+ part1.Scale = new Vector3(1, 1, 1);
+ part1.Name = partName;
+
+ object1 = new SceneObjectGroup(part1);
+ }
+
+ SceneObjectGroup object2;
+ {
+ string partName = "Object2";
+ UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
+ PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
+ Vector3 groupPosition = new Vector3(20, 40, 60);
+ Quaternion rotationOffset = Quaternion.Identity;
+ Vector3 offsetPosition = new Vector3(5, 10, 15);
+
+ SceneObjectPart part1
+ = new SceneObjectPart(
+ ownerId, shape, groupPosition, rotationOffset, offsetPosition);
+ part1.Scale = new Vector3(1, 1, 1);
+ part1.Name = partName;
+
+ object2 = new SceneObjectGroup(part1);
+ }
+
+ CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2);
+
+ UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
+ AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, coa);
+ m_scene.AssetService.Store(asset1);
+
+ // Create item
+ UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
+ string item1Name = "My Little Dog";
+ InventoryItemBase item1 = new InventoryItemBase();
+ item1.Name = item1Name;
+ item1.AssetID = asset1.FullID;
+ item1.ID = item1Id;
+ InventoryFolderBase objsFolder
+ = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, m_userId, "Objects")[0];
+ item1.Folder = objsFolder.ID;
+ m_scene.AddInventoryItem(item1);
+
+ SceneObjectGroup so
+ = m_iam.RezObject(
+ m_tc, item1Id, new Vector3(100, 100, 100), Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false);
+
+ Assert.That(so, Is.Not.Null);
+
+ Assert.That(m_scene.SceneGraph.GetTotalObjectsCount(), Is.EqualTo(2));
+
+ SceneObjectPart retrievedObj1Part = m_scene.GetSceneObjectPart(object1.Name);
+ Assert.That(retrievedObj1Part, Is.Null);
+
+ retrievedObj1Part = m_scene.GetSceneObjectPart(item1.Name);
+ Assert.That(retrievedObj1Part, Is.Not.Null);
+ Assert.That(retrievedObj1Part.Name, Is.EqualTo(item1.Name));
+
+ // Bottom of coalescence is placed on ground, hence we end up with 100.5 rather than 85 since the bottom
+ // object is unit square.
+ Assert.That(retrievedObj1Part.AbsolutePosition, Is.EqualTo(new Vector3(95, 90, 100.5f)));
+
+ SceneObjectPart retrievedObj2Part = m_scene.GetSceneObjectPart(object2.Name);
+ Assert.That(retrievedObj2Part, Is.Not.Null);
+ Assert.That(retrievedObj2Part.Name, Is.EqualTo(object2.Name));
+ Assert.That(retrievedObj2Part.AbsolutePosition, Is.EqualTo(new Vector3(105, 110, 130.5f)));
+ }
+
+ [Test]
+ public void TestRezObject()
+ {
+ TestHelper.InMethod();
+// log4net.Config.XmlConfigurator.Configure();
+
+ // Create asset
+ SceneObjectGroup object1;
+ SceneObjectPart part1;
+ {
+ string partName = "My Little Dog Object";
+ UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
+ PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
+ Vector3 groupPosition = new Vector3(10, 20, 30);
+ Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
+ Vector3 offsetPosition = new Vector3(5, 10, 15);
+
+ part1
+ = new SceneObjectPart(
+ ownerId, shape, groupPosition, rotationOffset, offsetPosition);
+ part1.Name = partName;
+
+ object1 = new SceneObjectGroup(part1);
+ }
+
+ UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
+ AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
+ m_scene.AssetService.Store(asset1);
+
+ // Create item
+ UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
+ string item1Name = "My Little Dog";
+ InventoryItemBase item1 = new InventoryItemBase();
+ item1.Name = item1Name;
+ item1.AssetID = asset1.FullID;
+ item1.ID = item1Id;
+ InventoryFolderBase objsFolder
+ = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, m_userId, "Objects")[0];
+ item1.Folder = objsFolder.ID;
+ m_scene.AddInventoryItem(item1);
+
+ SceneObjectGroup so
+ = m_iam.RezObject(
+ m_tc, item1Id, Vector3.Zero, Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false);
+
+ Assert.That(so, Is.Not.Null);
+
+ SceneObjectPart retrievedPart = m_scene.GetSceneObjectPart(so.UUID);
+ Assert.That(retrievedPart, Is.Not.Null);
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs
index e25700d1f7..422f394d7a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
using log4net;
using Nini.Config;
using OpenSim.Framework;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs
index 02acddc37e..2b5beba374 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
using log4net;
using Nini.Config;
using OpenSim.Framework;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs
index 6d975afb14..f29c074206 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
using log4net;
using Nini.Config;
using OpenSim.Framework;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
index 2f96bcb1ab..d2343c994e 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
using log4net;
using Nini.Config;
using OpenSim.Framework;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
index 209cf0d3c2..53a8ace14c 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
@@ -31,9 +31,8 @@ using System.Collections.Generic;
using log4net;
using Nini.Config;
using OpenSim.Framework;
-using OpenSim.Framework.Servers.HttpServer;
-using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
using OpenSim.Server.Base;
using OpenSim.Server.Handlers.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
index fcc69e949f..fc642032b5 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
using log4net;
using Nini.Config;
using OpenSim.Framework;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs
index 2a9366c44e..f759470b28 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
using log4net;
using Nini.Config;
using OpenSim.Framework;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
index 35518d59f8..5c3263260e 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
using log4net;
using Nini.Config;
using OpenSim.Framework;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs
index 5ee1c97e5f..86b4926ac5 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
using log4net;
using Nini.Config;
using OpenSim.Framework;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index b6d64acb80..ab90e90b78 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -259,6 +259,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID)
{
+// m_log.DebugFormat(
+// "[ESTATE MANAGEMENT MODULE]: Handling request from {0} to change estate covenant to {1}",
+// remoteClient.Name, estateCovenantID);
+
Scene.RegionInfo.RegionSettings.Covenant = estateCovenantID;
Scene.RegionInfo.RegionSettings.Save();
TriggerRegionInfoChange();
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs
index d6fa0937e5..21a9999ba0 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs
@@ -124,6 +124,52 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
colours.Save(stream, ImageFormat.Png);
}
+ public virtual void SaveFile(ITerrainChannel m_channel, string filename,
+ int offsetX, int offsetY,
+ int fileWidth, int fileHeight,
+ int regionSizeX, int regionSizeY)
+
+ {
+ // We need to do this because:
+ // "Saving the image to the same file it was constructed from is not allowed and throws an exception."
+ string tempName = offsetX + "_ " + offsetY + "_" + filename;
+
+ Bitmap entireBitmap = null;
+ Bitmap thisBitmap = null;
+ if (File.Exists(filename))
+ {
+ File.Copy(filename, tempName);
+ entireBitmap = new Bitmap(tempName);
+ if (entireBitmap.Width != fileWidth * regionSizeX || entireBitmap.Height != fileHeight * regionSizeY)
+ {
+ // old file, let's overwrite it
+ entireBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
+ }
+ }
+ else
+ {
+ entireBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
+ }
+
+ thisBitmap = CreateGrayscaleBitmapFromMap(m_channel);
+ Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY);
+ for (int x = 0; x < regionSizeX; x++)
+ for (int y = 0; y < regionSizeY; y++)
+ entireBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y));
+
+ Save(entireBitmap, filename);
+ thisBitmap.Dispose();
+ entireBitmap.Dispose();
+
+ if (File.Exists(tempName))
+ File.Delete(tempName);
+ }
+
+ protected virtual void Save(Bitmap bmp, string filename)
+ {
+ bmp.Save(filename, ImageFormat.Png);
+ }
+
#endregion
public override string ToString()
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs
index 8667607d0b..1a0d8ecf60 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs
@@ -76,6 +76,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
colours.Save(stream, ImageFormat.Jpeg);
}
+ public virtual void SaveFile(ITerrainChannel m_channel, string filename,
+ int offsetX, int offsetY,
+ int fileWidth, int fileHeight,
+ int regionSizeX, int regionSizeY)
+ {
+ throw new System.Exception("Not Implemented");
+ }
+
#endregion
public override string ToString()
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs
index a70ef13ed0..fad7641e42 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs
@@ -240,6 +240,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
get { return ".raw"; }
}
+ public virtual void SaveFile(ITerrainChannel m_channel, string filename,
+ int offsetX, int offsetY,
+ int fileWidth, int fileHeight,
+ int regionSizeX, int regionSizeY)
+ {
+ throw new System.Exception("Not Implemented");
+ }
+
#endregion
public override string ToString()
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs
index 3c76665d5e..ba073cae5a 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs
@@ -160,6 +160,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
bs.Close();
}
+ public virtual void SaveFile(ITerrainChannel m_channel, string filename,
+ int offsetX, int offsetY,
+ int fileWidth, int fileHeight,
+ int regionSizeX, int regionSizeY)
+ {
+ throw new System.Exception("Not Implemented");
+ }
#endregion
public override string ToString()
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs
index 2919897153..2f37d9d7e9 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs
@@ -308,6 +308,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
get { return ".ter"; }
}
+ public virtual void SaveFile(ITerrainChannel m_channel, string filename,
+ int offsetX, int offsetY,
+ int fileWidth, int fileHeight,
+ int regionSizeX, int regionSizeY)
+ {
+ throw new System.Exception("Not Implemented");
+ }
+
#endregion
public override string ToString()
diff --git a/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs b/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs
index 7403281621..7237f90a38 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs
@@ -38,5 +38,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
ITerrainChannel LoadStream(Stream stream);
void SaveFile(string filename, ITerrainChannel map);
void SaveStream(Stream stream, ITerrainChannel map);
+ void SaveFile(ITerrainChannel map, string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int regionSizeX, int regionSizeY);
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index 8a79d78b22..9c7b2fab9c 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -540,6 +540,39 @@ namespace OpenSim.Region.CoreModules.World.Terrain
}
}
+ ///
+ /// Saves the terrain to a larger terrain file.
+ ///
+ /// The terrain file to save
+ /// The width of the file in units
+ /// The height of the file in units
+ /// Where to begin our slice
+ /// Where to begin our slice
+ public void SaveToFile(string filename, int fileWidth, int fileHeight, int fileStartX, int fileStartY)
+ {
+ int offsetX = (int)m_scene.RegionInfo.RegionLocX - fileStartX;
+ int offsetY = (int)m_scene.RegionInfo.RegionLocY - fileStartY;
+
+ if (offsetX >= 0 && offsetX < fileWidth && offsetY >= 0 && offsetY < fileHeight)
+ {
+ // this region is included in the tile request
+ foreach (KeyValuePair loader in m_loaders)
+ {
+ if (filename.EndsWith(loader.Key))
+ {
+ lock (m_scene)
+ {
+ loader.Value.SaveFile(m_channel, filename, offsetX, offsetY,
+ fileWidth, fileHeight,
+ (int)Constants.RegionSize,
+ (int)Constants.RegionSize);
+ }
+ return;
+ }
+ }
+ }
+ }
+
///
/// Performs updates to the region periodically, synchronising physics and other heightmap aware sections
///
@@ -860,6 +893,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
SaveToFile((string) args[0]);
}
+ private void InterfaceSaveTileFile(Object[] args)
+ {
+ SaveToFile((string)args[0],
+ (int)args[1],
+ (int)args[2],
+ (int)args[3],
+ (int)args[4]);
+ }
+
private void InterfaceBakeTerrain(Object[] args)
{
UpdateRevertMap();
@@ -1115,6 +1157,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain
loadFromTileCommand.AddArgument("minimum Y tile", "The Y region coordinate of the first section on the file",
"Integer");
+ Command saveToTileCommand =
+ new Command("save-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceSaveTileFile, "Saves the current heightmap to the larger file.");
+ saveToTileCommand.AddArgument("filename",
+ "The file you wish to save to, the file extension determines the loader to be used. Supported extensions include: " +
+ supportedFileExtensions, "String");
+ saveToTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer");
+ saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer");
+ saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file",
+ "Integer");
+ saveToTileCommand.AddArgument("minimum Y tile", "The Y region coordinate of the first section on the file",
+ "Integer");
// Terrain adjustments
Command fillRegionCommand =
new Command("fill", CommandIntentions.COMMAND_HAZARDOUS, InterfaceFillTerrain, "Fills the current heightmap with a specified value.");
@@ -1166,6 +1219,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
m_commander.RegisterCommand("load", loadFromFileCommand);
m_commander.RegisterCommand("load-tile", loadFromTileCommand);
m_commander.RegisterCommand("save", saveToFileCommand);
+ m_commander.RegisterCommand("save-tile", saveToTileCommand);
m_commander.RegisterCommand("fill", fillRegionCommand);
m_commander.RegisterCommand("elevate", elevateCommand);
m_commander.RegisterCommand("lower", lowerCommand);
diff --git a/OpenSim/Region/Framework/Scenes/CoalescedSceneObjects.cs b/OpenSim/Region/Framework/Scenes/CoalescedSceneObjects.cs
new file mode 100644
index 0000000000..af8ccda6c2
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/CoalescedSceneObjects.cs
@@ -0,0 +1,154 @@
+/*
+ * 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 System;
+using System.Collections.Generic;
+using System.Linq;
+using OpenMetaverse;
+
+namespace OpenSim.Region.Framework.Scenes
+{
+ ///
+ /// Represents a coalescene of scene objects. A coalescence occurs when objects that are not in the same linkset
+ /// are grouped together.
+ ///
+ public class CoalescedSceneObjects
+ {
+ ///
+ /// The creator of this coalesence, though not necessarily the objects within it.
+ ///
+ public UUID CreatorId { get; set; }
+
+ ///
+ /// The number of objects in this coalesence
+ ///
+ public int Count
+ {
+ get
+ {
+ lock (m_memberObjects)
+ return m_memberObjects.Count;
+ }
+ }
+
+ ///
+ /// Does this coalesence have any member objects?
+ ///
+ public bool HasObjects { get { return Count > 0; } }
+
+ ///
+ /// Get the objects currently in this coalescence
+ ///
+ public List Objects
+ {
+ get
+ {
+ lock (m_memberObjects)
+ return new List(m_memberObjects);
+ }
+ }
+
+ ///
+ /// Get the scene that contains the objects in this coalescence. If there are no objects then null is returned.
+ ///
+ public Scene Scene
+ {
+ get
+ {
+ if (!HasObjects)
+ return null;
+ else
+ return Objects[0].Scene;
+ }
+ }
+
+ ///
+ /// At this point, we need to preserve the order of objects added to the coalescence, since the first
+ /// one will end up matching the item name when rerezzed.
+ ///
+ protected List m_memberObjects = new List();
+
+ public CoalescedSceneObjects(UUID creatorId)
+ {
+ CreatorId = creatorId;
+ }
+
+ public CoalescedSceneObjects(UUID creatorId, params SceneObjectGroup[] objs) : this(creatorId)
+ {
+ foreach (SceneObjectGroup obj in objs)
+ Add(obj);
+ }
+
+ ///
+ /// Add an object to the coalescence.
+ ///
+ ///
+ /// The offset of the object within the group
+ public void Add(SceneObjectGroup obj)
+ {
+ lock (m_memberObjects)
+ m_memberObjects.Add(obj);
+ }
+
+ ///
+ /// Removes a scene object from the coalescene
+ ///
+ ///
+ /// true if the object was there to be removed, false if not.
+ public bool Remove(SceneObjectGroup obj)
+ {
+ lock (m_memberObjects)
+ return m_memberObjects.Remove(obj);
+ }
+
+ ///
+ /// Get the total size of the coalescence (the size required to cover all the objects within it) and the
+ /// offsets of each of those objects.
+ ///
+ ///
+ ///
+ /// An array of offsets. The order of objects is the same as returned from the Objects property
+ ///
+ public Vector3[] GetSizeAndOffsets(out Vector3 size)
+ {
+ float minX, minY, minZ;
+ float maxX, maxY, maxZ;
+
+ Vector3[] offsets
+ = Scene.GetCombinedBoundingBox(
+ Objects, out minX, out maxX, out minY, out maxY, out minZ, out maxZ);
+
+ float sizeX = maxX - minX;
+ float sizeY = maxY - minY;
+ float sizeZ = maxZ - minZ;
+
+ size = new Vector3(sizeX, sizeY, sizeZ);
+
+ return offsets;
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f0acc38820..fdd5205de8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4839,7 +4839,20 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- public Vector3[] GetCombinedBoundingBox(List objects, out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ)
+ ///
+ /// Get the volume of space that will encompass all the given objects.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static Vector3[] GetCombinedBoundingBox(
+ List objects,
+ out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ)
{
minX = 256;
maxX = -256;
@@ -4857,6 +4870,10 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 vec = g.AbsolutePosition;
g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ);
+
+// m_log.DebugFormat(
+// "[SCENE]: For {0} found AxisAlignedBoundingBoxRaw {1}, {2}",
+// g.Name, new Vector3(ominX, ominY, ominZ), new Vector3(omaxX, omaxY, omaxZ));
ominX += vec.X;
omaxX += vec.X;
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 97af0a0b47..72f040252f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -997,6 +997,8 @@ namespace OpenSim.Region.Framework.Scenes
{
foreach (SceneObjectPart p in ((SceneObjectGroup)entity).Parts)
{
+// m_log.DebugFormat("[SCENE GRAPH]: Part {0} has name {1}", p.UUID, p.Name);
+
if (p.Name == name)
{
sop = p;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 3d2eacd720..8a8a6993cc 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2080,7 +2080,14 @@ namespace OpenSim.Region.Framework.Scenes
axPos *= parentRot;
Vector3 translationOffsetPosition = axPos;
- return GroupPosition + translationOffsetPosition;
+
+// m_log.DebugFormat("[SCENE OBJECT PART]: Found group pos {0} for part {1}", GroupPosition, Name);
+
+ Vector3 worldPos = GroupPosition + translationOffsetPosition;
+
+// m_log.DebugFormat("[SCENE OBJECT PART]: Found world pos {0} for part {1}", worldPos, Name);
+
+ return worldPos;
}
///
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
new file mode 100644
index 0000000000..a0e120a9ac
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
@@ -0,0 +1,114 @@
+/*
+ * 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 System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.IO;
+using System.Reflection;
+using System.Xml;
+using log4net;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Region.Framework.Scenes.Serialization
+{
+ ///
+ /// Serialize and deserialize coalesced scene objects.
+ ///
+ ///
+ /// Deserialization not yet here.
+ ///
+ public class CoalescedSceneObjectsSerializer
+ {
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ ///
+ /// Serialize coalesced objects to Xml
+ ///
+ ///
+ ///
+ public static string ToXml(CoalescedSceneObjects coa)
+ {
+ // TODO: Should probably return an empty xml serialization rather than a blank string
+ if (!coa.HasObjects)
+ return "";
+
+ using (StringWriter sw = new StringWriter())
+ {
+ using (XmlTextWriter writer = new XmlTextWriter(sw))
+ {
+ Vector3 size;
+
+ List coaObjects = coa.Objects;
+
+// m_log.DebugFormat(
+// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing {0} objects for coalesced object",
+// coaObjects.Count);
+
+ // This is weak - we're relying on the set of coalesced objects still being identical
+ Vector3[] offsets = coa.GetSizeAndOffsets(out size);
+
+ writer.WriteStartElement("CoalescedObject");
+
+ writer.WriteAttributeString("x", size.X.ToString());
+ writer.WriteAttributeString("y", size.Y.ToString());
+ writer.WriteAttributeString("z", size.Z.ToString());
+
+ // Embed the offsets into the group XML
+ for (int i = 0; i < coaObjects.Count; i++)
+ {
+ SceneObjectGroup obj = coaObjects[i];
+
+// m_log.DebugFormat(
+// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing offset for object {0}, {1}",
+// i, obj.Name);
+
+ writer.WriteStartElement("SceneObjectGroup");
+ writer.WriteAttributeString("offsetx", offsets[i].X.ToString());
+ writer.WriteAttributeString("offsety", offsets[i].Y.ToString());
+ writer.WriteAttributeString("offsetz", offsets[i].Z.ToString());
+
+ SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, true);
+
+ writer.WriteEndElement(); // SceneObjectGroup
+ }
+
+ writer.WriteEndElement(); // CoalescedObject
+ }
+
+ string output = sw.ToString();
+
+// m_log.Debug(output);
+
+ return output;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 57ae4fd24f..bb8a83a1af 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -139,6 +139,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
return sw.ToString();
}
}
+
///
/// Serialize a scene object to the original xml format
@@ -146,11 +147,25 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
///
///
public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer)
+ {
+ ToOriginalXmlFormat(sceneObject, writer, false);
+ }
+
+ ///
+ /// Serialize a scene object to the original xml format
+ ///
+ ///
+ ///
+ /// If false, don't write the enclosing SceneObjectGroup element
+ ///
+ public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer, bool noRootElement)
{
//m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", Name);
//int time = System.Environment.TickCount;
- writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
+ if (!noRootElement)
+ writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
+
writer.WriteStartElement(String.Empty, "RootPart", String.Empty);
ToXmlFormat(sceneObject.RootPart, writer);
writer.WriteEndElement();
@@ -170,10 +185,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteEndElement(); // OtherParts
sceneObject.SaveScriptedState(writer);
- writer.WriteEndElement(); // SceneObjectGroup
+
+ if (!noRootElement)
+ writer.WriteEndElement(); // SceneObjectGroup
//m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time);
- }
+ }
protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer)
{
@@ -1318,7 +1335,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteStartElement("SculptData");
byte[] sd;
if (shp.SculptData != null)
- sd = shp.ExtraParams;
+ sd = shp.SculptData;
else
sd = Utils.EmptyBytes;
writer.WriteBase64(sd, 0, sd.Length);
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs
index 85e34c1e3d..6df213d851 100644
--- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs
+++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs
@@ -648,6 +648,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
if (pbs.ProfileHollow != 0)
iPropertiesNotSupportedDefault++;
+ if ((pbs.PathBegin != 0) || pbs.PathEnd != 0)
+ iPropertiesNotSupportedDefault++;
+
if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0))
iPropertiesNotSupportedDefault++;
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index eb97f41e3c..a0101af2bb 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -2528,6 +2528,9 @@ namespace OpenSim.Region.Physics.OdePlugin
if (pbs.ProfileHollow != 0)
iPropertiesNotSupportedDefault++;
+ if ((pbs.PathBegin != 0) || pbs.PathEnd != 0)
+ iPropertiesNotSupportedDefault++;
+
if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0))
iPropertiesNotSupportedDefault++;
diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
index 65b3537041..f1da4fa777 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
@@ -34,7 +34,6 @@ using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Framework.Communications;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using OpenMetaverse;
diff --git a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs
index 6f77a2d8b3..c04e7a4971 100644
--- a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs
@@ -33,7 +33,6 @@ using System.Reflection;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using OpenSim.Server.Base;
using OpenMetaverse;
diff --git a/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs b/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs
index 4eb4bd2470..35b7109496 100644
--- a/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs
@@ -33,7 +33,6 @@ using System.Reflection;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using OpenMetaverse;
diff --git a/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs b/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs
index 1cd6bf8e1a..1a93ae71c6 100644
--- a/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs
@@ -33,7 +33,6 @@ using System.Reflection;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using IAvatarService = OpenSim.Services.Interfaces.IAvatarService;
diff --git a/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs b/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs
index c9bba0b730..d68829996d 100644
--- a/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs
+++ b/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs
@@ -33,7 +33,6 @@ using System.Reflection;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using OpenSim.Server.Base;
using OpenMetaverse;
diff --git a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs
index 36b5083860..861c4759a3 100644
--- a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs
@@ -33,7 +33,6 @@ using System.Reflection;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
using OpenSim.Server.Base;
diff --git a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs
index 0a7b277e4c..4ffa68c381 100644
--- a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs
+++ b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs
@@ -32,7 +32,7 @@ using System.Reflection;
using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenSim.Server.Base;
-using OpenSim.Framework.Servers.HttpServer;
+using OpenSim.Framework;
using OpenMetaverse;
using log4net;
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
index 5092d741e6..e57f28b44e 100644
--- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
@@ -33,7 +33,6 @@ using System.Reflection;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenSim.Server.Base;
diff --git a/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs b/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs
index b3ea865996..738cc06949 100644
--- a/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs
+++ b/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs
@@ -33,7 +33,6 @@ using System.Reflection;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenSim.Server.Base;
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
index b3bfcc27df..cd9f2bfcff 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
@@ -34,7 +34,6 @@ using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Framework.Communications;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using OpenSim.Server.Base;
using OpenMetaverse;
diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
index 252f7a1d16..30a73a471c 100644
--- a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
@@ -34,7 +34,6 @@ using System.Reflection;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using OpenMetaverse;
using Nwc.XmlRpc;
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
index 9e444c49bc..2cae02d42a 100644
--- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
@@ -36,7 +36,6 @@ using System.Text;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
diff --git a/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
index 41ebeaf05e..7238afc613 100644
--- a/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
@@ -33,7 +33,6 @@ using System.Reflection;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenSim.Server.Base;
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs
index 2a5df83193..f6835b9f2f 100644
--- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs
@@ -33,7 +33,6 @@ using System.Reflection;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
-using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using OpenMetaverse;
diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
index ff4423f7ab..af66d7f0a7 100644
--- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
@@ -71,6 +71,21 @@ namespace OpenSim.Tests.Common
Encoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)),
sog.OwnerID);
}
+
+ ///
+ /// Create an asset from the given scene object.
+ ///
+ ///
+ ///
+ ///
+ public static AssetBase CreateAsset(UUID assetUuid, CoalescedSceneObjects coa)
+ {
+ return CreateAsset(
+ assetUuid,
+ AssetType.Object,
+ Encoding.ASCII.GetBytes(CoalescedSceneObjectsSerializer.ToXml(coa)),
+ coa.CreatorId);
+ }
///
/// Create an asset from the given data.
diff --git a/prebuild.xml b/prebuild.xml
index 870ebf300c..49063daa57 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -931,7 +931,6 @@
-
@@ -2889,6 +2888,7 @@
+