aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMic Bowman2011-04-13 15:41:17 -0700
committerMic Bowman2011-04-13 15:41:17 -0700
commit590d20903c6dd596cb8ae3337065f955bd207b67 (patch)
treef6b60205fd58b03f03c9110a68b2036a3ef075d2 /OpenSim
parentMerge branch 'queuetest' of ssh://opensimulator.org/var/git/opensim into queu... (diff)
parentremove packet monitoring debugging code (diff)
downloadopensim-SC_OLD-590d20903c6dd596cb8ae3337065f955bd207b67.zip
opensim-SC_OLD-590d20903c6dd596cb8ae3337065f955bd207b67.tar.gz
opensim-SC_OLD-590d20903c6dd596cb8ae3337065f955bd207b67.tar.bz2
opensim-SC_OLD-590d20903c6dd596cb8ae3337065f955bd207b67.tar.xz
Merge branch 'testmerge' into queuetest
Conflicts: OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs192
-rw-r--r--OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs131
-rw-r--r--OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs122
-rw-r--r--OpenSim/Framework/WebUtil.cs335
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs95
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs220
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs46
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/JPEG.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs7
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/Terragen.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs54
-rw-r--r--OpenSim/Region/Framework/Scenes/CoalescedSceneObjects.cs154
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs114
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs25
-rw-r--r--OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs3
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs3
-rw-r--r--OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs1
-rw-r--r--OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs1
-rw-r--r--OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs1
-rw-r--r--OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs1
-rw-r--r--OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs1
-rw-r--r--OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs1
-rw-r--r--OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Grid/GridServiceConnector.cs1
-rw-r--r--OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs1
-rw-r--r--OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs1
-rw-r--r--OpenSim/Services/Connectors/Land/LandServiceConnector.cs1
-rw-r--r--OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs1
-rw-r--r--OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs1
-rw-r--r--OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs1
-rw-r--r--OpenSim/Tests/Common/Setup/AssetHelpers.cs15
49 files changed, 1074 insertions, 540 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs
deleted file mode 100644
index 03c12dd..0000000
--- a/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs
+++ /dev/null
@@ -1,192 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.IO;
30using System.Net;
31using System.Reflection;
32using System.Text;
33using System.Xml;
34using System.Xml.Serialization;
35using log4net;
36
37namespace OpenSim.Framework.Servers.HttpServer
38{
39 public class AsynchronousRestObjectRequester
40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42
43 /// <summary>
44 /// Perform an asynchronous REST request.
45 /// </summary>
46 /// <param name="verb">GET or POST</param>
47 /// <param name="requestUrl"></param>
48 /// <param name="obj"></param>
49 /// <param name="action"></param>
50 /// <returns></returns>
51 ///
52 /// <exception cref="System.Net.WebException">Thrown if we encounter a
53 /// network issue while posting the request. You'll want to make
54 /// sure you deal with this as they're not uncommon</exception>
55 //
56 public static void MakeRequest<TRequest, TResponse>(string verb,
57 string requestUrl, TRequest obj, Action<TResponse> action)
58 {
59// m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl);
60
61 Type type = typeof (TRequest);
62
63 WebRequest request = WebRequest.Create(requestUrl);
64 WebResponse response = null;
65 TResponse deserial = default(TResponse);
66 XmlSerializer deserializer = new XmlSerializer(typeof (TResponse));
67
68 request.Method = verb;
69
70 if (verb == "POST")
71 {
72 request.ContentType = "text/xml";
73
74 MemoryStream buffer = new MemoryStream();
75
76 XmlWriterSettings settings = new XmlWriterSettings();
77 settings.Encoding = Encoding.UTF8;
78
79 using (XmlWriter writer = XmlWriter.Create(buffer, settings))
80 {
81 XmlSerializer serializer = new XmlSerializer(type);
82 serializer.Serialize(writer, obj);
83 writer.Flush();
84 }
85
86 int length = (int) buffer.Length;
87 request.ContentLength = length;
88
89 request.BeginGetRequestStream(delegate(IAsyncResult res)
90 {
91 Stream requestStream = request.EndGetRequestStream(res);
92
93 requestStream.Write(buffer.ToArray(), 0, length);
94 requestStream.Close();
95
96 request.BeginGetResponse(delegate(IAsyncResult ar)
97 {
98 response = request.EndGetResponse(ar);
99 Stream respStream = null;
100 try
101 {
102 respStream = response.GetResponseStream();
103 deserial = (TResponse)deserializer.Deserialize(
104 respStream);
105 }
106 catch (System.InvalidOperationException)
107 {
108 }
109 finally
110 {
111 // Let's not close this
112 //buffer.Close();
113 respStream.Close();
114 response.Close();
115 }
116
117 action(deserial);
118
119 }, null);
120 }, null);
121
122
123 return;
124 }
125
126 request.BeginGetResponse(delegate(IAsyncResult res2)
127 {
128 try
129 {
130 // If the server returns a 404, this appears to trigger a System.Net.WebException even though that isn't
131 // documented in MSDN
132 response = request.EndGetResponse(res2);
133
134 Stream respStream = null;
135 try
136 {
137 respStream = response.GetResponseStream();
138 deserial = (TResponse)deserializer.Deserialize(respStream);
139 }
140 catch (System.InvalidOperationException)
141 {
142 }
143 finally
144 {
145 respStream.Close();
146 response.Close();
147 }
148 }
149 catch (WebException e)
150 {
151 if (e.Status == WebExceptionStatus.ProtocolError)
152 {
153 if (e.Response is HttpWebResponse)
154 {
155 HttpWebResponse httpResponse = (HttpWebResponse)e.Response;
156
157 if (httpResponse.StatusCode != HttpStatusCode.NotFound)
158 {
159 // We don't appear to be handling any other status codes, so log these feailures to that
160 // people don't spend unnecessary hours hunting phantom bugs.
161 m_log.DebugFormat(
162 "[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}",
163 verb, requestUrl, httpResponse.StatusCode);
164 }
165 }
166 }
167 else
168 {
169 m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with status {2} and message {3}", verb, requestUrl, e.Status, e.Message);
170 }
171 }
172 catch (Exception e)
173 {
174 m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with exception {2}", verb, requestUrl, e);
175 }
176
177 // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString());
178
179 try
180 {
181 action(deserial);
182 }
183 catch (Exception e)
184 {
185 m_log.ErrorFormat(
186 "[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}", verb, requestUrl, e);
187 }
188
189 }, null);
190 }
191 }
192}
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
deleted file mode 100644
index 41ece86..0000000
--- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
+++ /dev/null
@@ -1,131 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.IO;
30using System.Net;
31using System.Reflection;
32using System.Text;
33using System.Xml;
34using System.Xml.Serialization;
35
36using log4net;
37
38namespace OpenSim.Framework.Servers.HttpServer
39{
40 public class SynchronousRestFormsRequester
41 {
42 private static readonly ILog m_log =
43 LogManager.GetLogger(
44 MethodBase.GetCurrentMethod().DeclaringType);
45
46 /// <summary>
47 /// Perform a synchronous REST request.
48 /// </summary>
49 /// <param name="verb"></param>
50 /// <param name="requestUrl"></param>
51 /// <param name="obj"> </param>
52 /// <returns></returns>
53 ///
54 /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
55 /// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
56 public static string MakeRequest(string verb, string requestUrl, string obj)
57 {
58 WebRequest request = WebRequest.Create(requestUrl);
59 request.Method = verb;
60 string respstring = String.Empty;
61
62 using (MemoryStream buffer = new MemoryStream())
63 {
64 if ((verb == "POST") || (verb == "PUT"))
65 {
66 request.ContentType = "text/www-form-urlencoded";
67
68 int length = 0;
69 using (StreamWriter writer = new StreamWriter(buffer))
70 {
71 writer.Write(obj);
72 writer.Flush();
73 }
74
75 length = (int)obj.Length;
76 request.ContentLength = length;
77
78 Stream requestStream = null;
79 try
80 {
81 requestStream = request.GetRequestStream();
82 requestStream.Write(buffer.ToArray(), 0, length);
83 }
84 catch (Exception e)
85 {
86 m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl);
87 }
88 finally
89 {
90 if (requestStream != null)
91 requestStream.Close();
92 }
93 }
94
95 try
96 {
97 using (WebResponse resp = request.GetResponse())
98 {
99 if (resp.ContentLength != 0)
100 {
101 Stream respStream = null;
102 try
103 {
104 respStream = resp.GetResponseStream();
105 using (StreamReader reader = new StreamReader(respStream))
106 {
107 respstring = reader.ReadToEnd();
108 }
109 }
110 catch (Exception e)
111 {
112 m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString());
113 }
114 finally
115 {
116 if (respStream != null)
117 respStream.Close();
118 }
119 }
120 }
121 }
122 catch (System.InvalidOperationException)
123 {
124 // This is what happens when there is invalid XML
125 m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request");
126 }
127 }
128 return respstring;
129 }
130 }
131}
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs
deleted file mode 100644
index eab463c..0000000
--- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs
+++ /dev/null
@@ -1,122 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.IO;
30using System.Net;
31using System.Text;
32using System.Xml;
33using System.Xml.Serialization;
34
35namespace OpenSim.Framework.Servers.HttpServer
36{
37 public class SynchronousRestObjectPoster
38 {
39 [Obsolete]
40 public static TResponse BeginPostObject<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
41 {
42 return SynchronousRestObjectRequester.MakeRequest<TRequest, TResponse>(verb, requestUrl, obj);
43 }
44 }
45
46 public class SynchronousRestObjectRequester
47 {
48 /// <summary>
49 /// Perform a synchronous REST request.
50 /// </summary>
51 /// <param name="verb"></param>
52 /// <param name="requestUrl"></param>
53 /// <param name="obj"> </param>
54 /// <returns></returns>
55 ///
56 /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
57 /// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
58 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
59 {
60 Type type = typeof (TRequest);
61 TResponse deserial = default(TResponse);
62
63 WebRequest request = WebRequest.Create(requestUrl);
64 request.Method = verb;
65
66 if ((verb == "POST") || (verb == "PUT"))
67 {
68 request.ContentType = "text/xml";
69
70 MemoryStream buffer = new MemoryStream();
71
72 XmlWriterSettings settings = new XmlWriterSettings();
73 settings.Encoding = Encoding.UTF8;
74
75 using (XmlWriter writer = XmlWriter.Create(buffer, settings))
76 {
77 XmlSerializer serializer = new XmlSerializer(type);
78 serializer.Serialize(writer, obj);
79 writer.Flush();
80 }
81
82 int length = (int) buffer.Length;
83 request.ContentLength = length;
84
85 Stream requestStream = null;
86 try
87 {
88 requestStream = request.GetRequestStream();
89 requestStream.Write(buffer.ToArray(), 0, length);
90 }
91 catch (Exception)
92 {
93 return deserial;
94 }
95 finally
96 {
97 if (requestStream != null)
98 requestStream.Close();
99 }
100 }
101
102 try
103 {
104 using (WebResponse resp = request.GetResponse())
105 {
106 if (resp.ContentLength > 0)
107 {
108 Stream respStream = resp.GetResponseStream();
109 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
110 deserial = (TResponse)deserializer.Deserialize(respStream);
111 respStream.Close();
112 }
113 }
114 }
115 catch (System.InvalidOperationException)
116 {
117 // This is what happens when there is invalid XML
118 }
119 return deserial;
120 }
121 }
122}
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 1feeeb3..64cd014 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -36,6 +36,9 @@ using System.Net.Security;
36using System.Reflection; 36using System.Reflection;
37using System.Text; 37using System.Text;
38using System.Web; 38using System.Web;
39using System.Xml;
40using System.Xml.Serialization;
41
39using log4net; 42using log4net;
40using OpenSim.Framework.Servers.HttpServer; 43using OpenSim.Framework.Servers.HttpServer;
41using OpenMetaverse.StructuredData; 44using OpenMetaverse.StructuredData;
@@ -625,4 +628,336 @@ namespace OpenSim.Framework
625 628
626 629
627 } 630 }
631
632 public static class AsynchronousRestObjectRequester
633 {
634 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
635
636 /// <summary>
637 /// Perform an asynchronous REST request.
638 /// </summary>
639 /// <param name="verb">GET or POST</param>
640 /// <param name="requestUrl"></param>
641 /// <param name="obj"></param>
642 /// <param name="action"></param>
643 /// <returns></returns>
644 ///
645 /// <exception cref="System.Net.WebException">Thrown if we encounter a
646 /// network issue while posting the request. You'll want to make
647 /// sure you deal with this as they're not uncommon</exception>
648 //
649 public static void MakeRequest<TRequest, TResponse>(string verb,
650 string requestUrl, TRequest obj, Action<TResponse> action)
651 {
652 // m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl);
653
654 Type type = typeof(TRequest);
655
656 WebRequest request = WebRequest.Create(requestUrl);
657 WebResponse response = null;
658 TResponse deserial = default(TResponse);
659 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
660
661 request.Method = verb;
662
663 if (verb == "POST")
664 {
665 request.ContentType = "text/xml";
666
667 MemoryStream buffer = new MemoryStream();
668
669 XmlWriterSettings settings = new XmlWriterSettings();
670 settings.Encoding = Encoding.UTF8;
671
672 using (XmlWriter writer = XmlWriter.Create(buffer, settings))
673 {
674 XmlSerializer serializer = new XmlSerializer(type);
675 serializer.Serialize(writer, obj);
676 writer.Flush();
677 }
678
679 int length = (int)buffer.Length;
680 request.ContentLength = length;
681
682 request.BeginGetRequestStream(delegate(IAsyncResult res)
683 {
684 Stream requestStream = request.EndGetRequestStream(res);
685
686 requestStream.Write(buffer.ToArray(), 0, length);
687 requestStream.Close();
688
689 request.BeginGetResponse(delegate(IAsyncResult ar)
690 {
691 response = request.EndGetResponse(ar);
692 Stream respStream = null;
693 try
694 {
695 respStream = response.GetResponseStream();
696 deserial = (TResponse)deserializer.Deserialize(
697 respStream);
698 }
699 catch (System.InvalidOperationException)
700 {
701 }
702 finally
703 {
704 // Let's not close this
705 //buffer.Close();
706 respStream.Close();
707 response.Close();
708 }
709
710 action(deserial);
711
712 }, null);
713 }, null);
714
715
716 return;
717 }
718
719 request.BeginGetResponse(delegate(IAsyncResult res2)
720 {
721 try
722 {
723 // If the server returns a 404, this appears to trigger a System.Net.WebException even though that isn't
724 // documented in MSDN
725 response = request.EndGetResponse(res2);
726
727 Stream respStream = null;
728 try
729 {
730 respStream = response.GetResponseStream();
731 deserial = (TResponse)deserializer.Deserialize(respStream);
732 }
733 catch (System.InvalidOperationException)
734 {
735 }
736 finally
737 {
738 respStream.Close();
739 response.Close();
740 }
741 }
742 catch (WebException e)
743 {
744 if (e.Status == WebExceptionStatus.ProtocolError)
745 {
746 if (e.Response is HttpWebResponse)
747 {
748 HttpWebResponse httpResponse = (HttpWebResponse)e.Response;
749
750 if (httpResponse.StatusCode != HttpStatusCode.NotFound)
751 {
752 // We don't appear to be handling any other status codes, so log these feailures to that
753 // people don't spend unnecessary hours hunting phantom bugs.
754 m_log.DebugFormat(
755 "[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}",
756 verb, requestUrl, httpResponse.StatusCode);
757 }
758 }
759 }
760 else
761 {
762 m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with status {2} and message {3}", verb, requestUrl, e.Status, e.Message);
763 }
764 }
765 catch (Exception e)
766 {
767 m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with exception {2}", verb, requestUrl, e);
768 }
769
770 // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString());
771
772 try
773 {
774 action(deserial);
775 }
776 catch (Exception e)
777 {
778 m_log.ErrorFormat(
779 "[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}", verb, requestUrl, e);
780 }
781
782 }, null);
783 }
784 }
785
786 public static class SynchronousRestFormsRequester
787 {
788 private static readonly ILog m_log =
789 LogManager.GetLogger(
790 MethodBase.GetCurrentMethod().DeclaringType);
791
792 /// <summary>
793 /// Perform a synchronous REST request.
794 /// </summary>
795 /// <param name="verb"></param>
796 /// <param name="requestUrl"></param>
797 /// <param name="obj"> </param>
798 /// <returns></returns>
799 ///
800 /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
801 /// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
802 public static string MakeRequest(string verb, string requestUrl, string obj)
803 {
804 WebRequest request = WebRequest.Create(requestUrl);
805 request.Method = verb;
806 string respstring = String.Empty;
807
808 using (MemoryStream buffer = new MemoryStream())
809 {
810 if ((verb == "POST") || (verb == "PUT"))
811 {
812 request.ContentType = "text/www-form-urlencoded";
813
814 int length = 0;
815 using (StreamWriter writer = new StreamWriter(buffer))
816 {
817 writer.Write(obj);
818 writer.Flush();
819 }
820
821 length = (int)obj.Length;
822 request.ContentLength = length;
823
824 Stream requestStream = null;
825 try
826 {
827 requestStream = request.GetRequestStream();
828 requestStream.Write(buffer.ToArray(), 0, length);
829 }
830 catch (Exception e)
831 {
832 m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl);
833 }
834 finally
835 {
836 if (requestStream != null)
837 requestStream.Close();
838 }
839 }
840
841 try
842 {
843 using (WebResponse resp = request.GetResponse())
844 {
845 if (resp.ContentLength != 0)
846 {
847 Stream respStream = null;
848 try
849 {
850 respStream = resp.GetResponseStream();
851 using (StreamReader reader = new StreamReader(respStream))
852 {
853 respstring = reader.ReadToEnd();
854 }
855 }
856 catch (Exception e)
857 {
858 m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString());
859 }
860 finally
861 {
862 if (respStream != null)
863 respStream.Close();
864 }
865 }
866 }
867 }
868 catch (System.InvalidOperationException)
869 {
870 // This is what happens when there is invalid XML
871 m_log.DebugFormat("[FORMS]: InvalidOperationException on receiving request");
872 }
873 }
874 return respstring;
875 }
876 }
877
878 public class SynchronousRestObjectPoster
879 {
880 [Obsolete]
881 public static TResponse BeginPostObject<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
882 {
883 return SynchronousRestObjectRequester.MakeRequest<TRequest, TResponse>(verb, requestUrl, obj);
884 }
885 }
886
887 public class SynchronousRestObjectRequester
888 {
889 /// <summary>
890 /// Perform a synchronous REST request.
891 /// </summary>
892 /// <param name="verb"></param>
893 /// <param name="requestUrl"></param>
894 /// <param name="obj"> </param>
895 /// <returns></returns>
896 ///
897 /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
898 /// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
899 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
900 {
901 Type type = typeof(TRequest);
902 TResponse deserial = default(TResponse);
903
904 WebRequest request = WebRequest.Create(requestUrl);
905 request.Method = verb;
906
907 if ((verb == "POST") || (verb == "PUT"))
908 {
909 request.ContentType = "text/xml";
910
911 MemoryStream buffer = new MemoryStream();
912
913 XmlWriterSettings settings = new XmlWriterSettings();
914 settings.Encoding = Encoding.UTF8;
915
916 using (XmlWriter writer = XmlWriter.Create(buffer, settings))
917 {
918 XmlSerializer serializer = new XmlSerializer(type);
919 serializer.Serialize(writer, obj);
920 writer.Flush();
921 }
922
923 int length = (int)buffer.Length;
924 request.ContentLength = length;
925
926 Stream requestStream = null;
927 try
928 {
929 requestStream = request.GetRequestStream();
930 requestStream.Write(buffer.ToArray(), 0, length);
931 }
932 catch (Exception)
933 {
934 return deserial;
935 }
936 finally
937 {
938 if (requestStream != null)
939 requestStream.Close();
940 }
941 }
942
943 try
944 {
945 using (WebResponse resp = request.GetResponse())
946 {
947 if (resp.ContentLength > 0)
948 {
949 Stream respStream = resp.GetResponseStream();
950 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
951 deserial = (TResponse)deserializer.Deserialize(respStream);
952 respStream.Close();
953 }
954 }
955 }
956 catch (System.InvalidOperationException)
957 {
958 // This is what happens when there is invalid XML
959 }
960 return deserial;
961 }
962 }
628} 963}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index cf04f0d..1f7e66d 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -4049,7 +4049,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4049 ppcnt++; 4049 ppcnt++;
4050 } 4050 }
4051 4051
4052
4053 Int32 fpcnt = 0; 4052 Int32 fpcnt = 0;
4054 Int32 fbcnt = 0; 4053 Int32 fbcnt = 0;
4055 4054
@@ -4298,6 +4297,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4298 4297
4299 public void SendEstateCovenantInformation(UUID covenant) 4298 public void SendEstateCovenantInformation(UUID covenant)
4300 { 4299 {
4300// m_log.DebugFormat("[LLCLIENTVIEW]: Sending estate covenant asset id of {0} to {1}", covenant, Name);
4301
4301 EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket(); 4302 EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket();
4302 EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock(); 4303 EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock();
4303 edata.CovenantID = covenant; 4304 edata.CovenantID = covenant;
@@ -4308,8 +4309,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4308 OutPacket(einfopack, ThrottleOutPacketType.Task); 4309 OutPacket(einfopack, ThrottleOutPacketType.Task);
4309 } 4310 }
4310 4311
4311 public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner) 4312 public void SendDetailedEstateData(
4313 UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition,
4314 UUID covenant, string abuseEmail, UUID estateOwner)
4312 { 4315 {
4316// m_log.DebugFormat(
4317// "[LLCLIENTVIEW]: Sending detailed estate data to {0} with covenant asset id {1}", Name, covenant);
4318
4313 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); 4319 EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
4314 packet.MethodData.Invoice = invoice; 4320 packet.MethodData.Invoice = invoice;
4315 packet.AgentData.TransactionID = UUID.Random(); 4321 packet.AgentData.TransactionID = UUID.Random();
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 4d74b2a..5baf078 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -34,13 +34,13 @@ using Nini.Config;
34using Nwc.XmlRpc; 34using Nwc.XmlRpc;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
38using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces; 41using OpenSim.Services.Interfaces;
41using OpenSim.Services.Connectors.Friends; 42using OpenSim.Services.Connectors.Friends;
42using OpenSim.Server.Base; 43using OpenSim.Server.Base;
43using OpenSim.Framework.Servers.HttpServer;
44using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; 44using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
45using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; 45using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
46using GridRegion = OpenSim.Services.Interfaces.GridRegion; 46using GridRegion = OpenSim.Services.Interfaces.GridRegion;
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index fdfcd10..919ea33 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -33,7 +33,6 @@ using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
35using OpenSim.Framework.Servers; 35using OpenSim.Framework.Servers;
36using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Framework.Client; 36using OpenSim.Framework.Client;
38using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 73b0a35..c0946f4 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
222 deletes[g.OwnerID].Add(g); 222 deletes[g.OwnerID].Add(g);
223 } 223 }
224 224
225 // This is pethod scoped and will be returned. It will be the 225 // This is method scoped and will be returned. It will be the
226 // last created asset id 226 // last created asset id
227 UUID assetID = UUID.Zero; 227 UUID assetID = UUID.Zero;
228 228
@@ -230,8 +230,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
230 // with distinct destinations as well. 230 // with distinct destinations as well.
231 foreach (List<SceneObjectGroup> objlist in deletes.Values) 231 foreach (List<SceneObjectGroup> objlist in deletes.Values)
232 { 232 {
233 Dictionary<UUID, string> xmlStrings = 233 CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero);
234 new Dictionary<UUID, string>(); 234 Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>();
235 235
236 foreach (SceneObjectGroup objectGroup in objlist) 236 foreach (SceneObjectGroup objectGroup in objlist)
237 { 237 {
@@ -245,7 +245,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
245 : objectGroup.AbsolutePosition.X, 245 : objectGroup.AbsolutePosition.X,
246 objectGroup.AbsolutePosition.Z); 246 objectGroup.AbsolutePosition.Z);
247 247
248 Vector3 originalPosition = objectGroup.AbsolutePosition; 248 originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition;
249 249
250 objectGroup.AbsolutePosition = inventoryStoredPosition; 250 objectGroup.AbsolutePosition = inventoryStoredPosition;
251 251
@@ -259,59 +259,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
259 (uint)PermissionMask.Modify); 259 (uint)PermissionMask.Modify);
260 objectGroup.RootPart.NextOwnerMask |= 260 objectGroup.RootPart.NextOwnerMask |=
261 (uint)PermissionMask.Move; 261 (uint)PermissionMask.Move;
262 262
263 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); 263 coa.Add(objectGroup);
264
265 objectGroup.AbsolutePosition = originalPosition;
266
267 xmlStrings[objectGroup.UUID] = sceneObjectXml;
268 } 264 }
269 265
270 string itemXml; 266 string itemXml;
271 267
272 if (objlist.Count > 1) 268 if (objlist.Count > 1)
273 { 269 itemXml = CoalescedSceneObjectsSerializer.ToXml(coa);
274 float minX, minY, minZ;
275 float maxX, maxY, maxZ;
276
277 Vector3[] offsets = m_Scene.GetCombinedBoundingBox(objlist,
278 out minX, out maxX, out minY, out maxY,
279 out minZ, out maxZ);
280
281 // CreateWrapper
282 XmlDocument itemDoc = new XmlDocument();
283 XmlElement root = itemDoc.CreateElement("", "CoalescedObject", "");
284 itemDoc.AppendChild(root);
285
286 // Embed the offsets into the group XML
287 for ( int i = 0 ; i < objlist.Count ; i++ )
288 {
289 XmlDocument doc = new XmlDocument();
290 SceneObjectGroup g = objlist[i];
291 doc.LoadXml(xmlStrings[g.UUID]);
292 XmlElement e = (XmlElement)doc.SelectSingleNode("/SceneObjectGroup");
293 e.SetAttribute("offsetx", offsets[i].X.ToString());
294 e.SetAttribute("offsety", offsets[i].Y.ToString());
295 e.SetAttribute("offsetz", offsets[i].Z.ToString());
296
297 XmlNode objectNode = itemDoc.ImportNode(e, true);
298 root.AppendChild(objectNode);
299 }
300
301 float sizeX = maxX - minX;
302 float sizeY = maxY - minY;
303 float sizeZ = maxZ - minZ;
304
305 root.SetAttribute("x", sizeX.ToString());
306 root.SetAttribute("y", sizeY.ToString());
307 root.SetAttribute("z", sizeZ.ToString());
308
309 itemXml = itemDoc.InnerXml;
310 }
311 else 270 else
312 { 271 itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0]);
313 itemXml = xmlStrings[objlist[0].UUID]; 272
314 } 273 // Restore the position of each group now that it has been stored to inventory.
274 foreach (SceneObjectGroup objectGroup in objlist)
275 objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID];
315 276
316 // Get the user info of the item destination 277 // Get the user info of the item destination
317 // 278 //
@@ -332,7 +293,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
332 { 293 {
333 // All returns / deletes go to the object owner 294 // All returns / deletes go to the object owner
334 // 295 //
335
336 userID = objlist[0].RootPart.OwnerID; 296 userID = objlist[0].RootPart.OwnerID;
337 } 297 }
338 298
@@ -346,7 +306,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
346 // Delete is treated like return in this case 306 // Delete is treated like return in this case
347 // Deleting your own items makes them go to trash 307 // Deleting your own items makes them go to trash
348 // 308 //
349 309
350 InventoryFolderBase folder = null; 310 InventoryFolderBase folder = null;
351 InventoryItemBase item = null; 311 InventoryItemBase item = null;
352 312
@@ -548,7 +508,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
548 return assetID; 508 return assetID;
549 } 509 }
550 510
551
552 /// <summary> 511 /// <summary>
553 /// Rez an object into the scene from the user's inventory 512 /// Rez an object into the scene from the user's inventory
554 /// </summary> 513 /// </summary>
@@ -659,9 +618,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
659 itemId, n.OuterXml); 618 itemId, n.OuterXml);
660 objlist.Add(g); 619 objlist.Add(g);
661 XmlElement el = (XmlElement)n; 620 XmlElement el = (XmlElement)n;
662 float x = Convert.ToSingle(el.GetAttribute("offsetx")); 621
663 float y = Convert.ToSingle(el.GetAttribute("offsety")); 622 string rawX = el.GetAttribute("offsetx");
664 float z = Convert.ToSingle(el.GetAttribute("offsetz")); 623 string rawY = el.GetAttribute("offsety");
624 string rawZ = el.GetAttribute("offsetz");
625//
626// m_log.DebugFormat(
627// "[INVENTORY ACCESS MODULE]: Converting coalesced object {0} offset <{1}, {2}, {3}>",
628// g.Name, rawX, rawY, rawZ);
629
630 float x = Convert.ToSingle(rawX);
631 float y = Convert.ToSingle(rawY);
632 float z = Convert.ToSingle(rawZ);
665 veclist.Add(new Vector3(x, y, z)); 633 veclist.Add(new Vector3(x, y, z));
666 } 634 }
667 } 635 }
@@ -753,10 +721,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
753 // affect the name stored in the serialization, transfer 721 // affect the name stored in the serialization, transfer
754 // the correct name from the inventory to the 722 // the correct name from the inventory to the
755 // object itself before we rez. 723 // object itself before we rez.
756 rootPart.Name = item.Name; 724 //
757 rootPart.Description = item.Description; 725 // Only do these for the first object if we are rezzing a coalescence.
758 rootPart.ObjectSaleType = item.SaleType; 726 if (i == 0)
759 rootPart.SalePrice = item.SalePrice; 727 {
728 rootPart.Name = item.Name;
729 rootPart.Description = item.Description;
730 rootPart.ObjectSaleType = item.SaleType;
731 rootPart.SalePrice = item.SalePrice;
732 }
760 733
761 group.SetGroup(remoteClient.ActiveGroupId, remoteClient); 734 group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
762 if ((rootPart.OwnerID != item.Owner) || 735 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 0000000..c76a30a
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
@@ -0,0 +1,220 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using System.Threading;
33using Nini.Config;
34using NUnit.Framework;
35using OpenMetaverse;
36using OpenSim.Data;
37using OpenSim.Framework;
38using OpenSim.Framework.Serialization;
39using OpenSim.Framework.Serialization.External;
40using OpenSim.Framework.Communications;
41using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
42using OpenSim.Region.CoreModules.Framework.InventoryAccess;
43using OpenSim.Region.Framework.Scenes;
44using OpenSim.Region.Framework.Scenes.Serialization;
45using OpenSim.Services.Interfaces;
46using OpenSim.Tests.Common;
47using OpenSim.Tests.Common.Mock;
48using OpenSim.Tests.Common.Setup;
49
50namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
51{
52 [TestFixture]
53 public class InventoryAccessModuleTests
54 {
55 protected TestScene m_scene;
56 protected BasicInventoryAccessModule m_iam;
57 protected UUID m_userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
58 protected TestClient m_tc;
59
60 [SetUp]
61 public void SetUp()
62 {
63 m_iam = new BasicInventoryAccessModule();
64
65 IConfigSource config = new IniConfigSource();
66 config.AddConfig("Modules");
67 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
68
69 m_scene = SceneSetupHelpers.SetupScene("Inventory");
70 SceneSetupHelpers.SetupSceneModules(m_scene, config, m_iam);
71
72 // Create user
73 string userFirstName = "Jock";
74 string userLastName = "Stirrup";
75 string userPassword = "troll";
76 UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, m_userId, userPassword);
77
78 AgentCircuitData acd = new AgentCircuitData();
79 acd.AgentID = m_userId;
80 m_tc = new TestClient(acd, m_scene);
81 }
82
83 [Test]
84 public void TestRezCoalescedObject()
85 {
86 TestHelper.InMethod();
87// log4net.Config.XmlConfigurator.Configure();
88
89 // Create asset
90 SceneObjectGroup object1;
91 {
92 string partName = "Object1";
93 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
94 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
95 Vector3 groupPosition = new Vector3(10, 20, 30);
96 Quaternion rotationOffset = Quaternion.Identity;
97 Vector3 offsetPosition = new Vector3(5, 10, 15);
98
99 SceneObjectPart part1
100 = new SceneObjectPart(
101 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
102 part1.Scale = new Vector3(1, 1, 1);
103 part1.Name = partName;
104
105 object1 = new SceneObjectGroup(part1);
106 }
107
108 SceneObjectGroup object2;
109 {
110 string partName = "Object2";
111 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
112 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
113 Vector3 groupPosition = new Vector3(20, 40, 60);
114 Quaternion rotationOffset = Quaternion.Identity;
115 Vector3 offsetPosition = new Vector3(5, 10, 15);
116
117 SceneObjectPart part1
118 = new SceneObjectPart(
119 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
120 part1.Scale = new Vector3(1, 1, 1);
121 part1.Name = partName;
122
123 object2 = new SceneObjectGroup(part1);
124 }
125
126 CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2);
127
128 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
129 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, coa);
130 m_scene.AssetService.Store(asset1);
131
132 // Create item
133 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
134 string item1Name = "My Little Dog";
135 InventoryItemBase item1 = new InventoryItemBase();
136 item1.Name = item1Name;
137 item1.AssetID = asset1.FullID;
138 item1.ID = item1Id;
139 InventoryFolderBase objsFolder
140 = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, m_userId, "Objects")[0];
141 item1.Folder = objsFolder.ID;
142 m_scene.AddInventoryItem(item1);
143
144 SceneObjectGroup so
145 = m_iam.RezObject(
146 m_tc, item1Id, new Vector3(100, 100, 100), Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false);
147
148 Assert.That(so, Is.Not.Null);
149
150 Assert.That(m_scene.SceneGraph.GetTotalObjectsCount(), Is.EqualTo(2));
151
152 SceneObjectPart retrievedObj1Part = m_scene.GetSceneObjectPart(object1.Name);
153 Assert.That(retrievedObj1Part, Is.Null);
154
155 retrievedObj1Part = m_scene.GetSceneObjectPart(item1.Name);
156 Assert.That(retrievedObj1Part, Is.Not.Null);
157 Assert.That(retrievedObj1Part.Name, Is.EqualTo(item1.Name));
158
159 // Bottom of coalescence is placed on ground, hence we end up with 100.5 rather than 85 since the bottom
160 // object is unit square.
161 Assert.That(retrievedObj1Part.AbsolutePosition, Is.EqualTo(new Vector3(95, 90, 100.5f)));
162
163 SceneObjectPart retrievedObj2Part = m_scene.GetSceneObjectPart(object2.Name);
164 Assert.That(retrievedObj2Part, Is.Not.Null);
165 Assert.That(retrievedObj2Part.Name, Is.EqualTo(object2.Name));
166 Assert.That(retrievedObj2Part.AbsolutePosition, Is.EqualTo(new Vector3(105, 110, 130.5f)));
167 }
168
169 [Test]
170 public void TestRezObject()
171 {
172 TestHelper.InMethod();
173// log4net.Config.XmlConfigurator.Configure();
174
175 // Create asset
176 SceneObjectGroup object1;
177 SceneObjectPart part1;
178 {
179 string partName = "My Little Dog Object";
180 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
181 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
182 Vector3 groupPosition = new Vector3(10, 20, 30);
183 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
184 Vector3 offsetPosition = new Vector3(5, 10, 15);
185
186 part1
187 = new SceneObjectPart(
188 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
189 part1.Name = partName;
190
191 object1 = new SceneObjectGroup(part1);
192 }
193
194 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
195 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
196 m_scene.AssetService.Store(asset1);
197
198 // Create item
199 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
200 string item1Name = "My Little Dog";
201 InventoryItemBase item1 = new InventoryItemBase();
202 item1.Name = item1Name;
203 item1.AssetID = asset1.FullID;
204 item1.ID = item1Id;
205 InventoryFolderBase objsFolder
206 = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, m_userId, "Objects")[0];
207 item1.Folder = objsFolder.ID;
208 m_scene.AddInventoryItem(item1);
209
210 SceneObjectGroup so
211 = m_iam.RezObject(
212 m_tc, item1Id, Vector3.Zero, Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false);
213
214 Assert.That(so, Is.Not.Null);
215
216 SceneObjectPart retrievedPart = m_scene.GetSceneObjectPart(so.UUID);
217 Assert.That(retrievedPart, Is.Not.Null);
218 }
219 }
220} \ 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 e25700d..422f394 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;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base; 36using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs
index 02acddc..2b5beba 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;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base; 36using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs
index 6d975af..f29c074 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;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base; 36using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
index 2f96bcb..d2343c9 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;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base; 36using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
index 209cf0d..53a8ace 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;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes;
37using OpenSim.Server.Base; 36using OpenSim.Server.Base;
38using OpenSim.Server.Handlers.Base; 37using OpenSim.Server.Handlers.Base;
39 38
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
index fcc69e9..fc64203 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;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base; 36using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs
index 2a9366c..f759470 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;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base; 36using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
index 35518d5..5c32632 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;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base; 36using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs
index 5ee1c97..86b4926 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;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base; 36using OpenSim.Server.Base;
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index b6d64ac..ab90e90 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
259 259
260 private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID) 260 private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, UUID estateCovenantID)
261 { 261 {
262// m_log.DebugFormat(
263// "[ESTATE MANAGEMENT MODULE]: Handling request from {0} to change estate covenant to {1}",
264// remoteClient.Name, estateCovenantID);
265
262 Scene.RegionInfo.RegionSettings.Covenant = estateCovenantID; 266 Scene.RegionInfo.RegionSettings.Covenant = estateCovenantID;
263 Scene.RegionInfo.RegionSettings.Save(); 267 Scene.RegionInfo.RegionSettings.Save();
264 TriggerRegionInfoChange(); 268 TriggerRegionInfoChange();
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs
index d6fa093..21a9999 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
124 colours.Save(stream, ImageFormat.Png); 124 colours.Save(stream, ImageFormat.Png);
125 } 125 }
126 126
127 public virtual void SaveFile(ITerrainChannel m_channel, string filename,
128 int offsetX, int offsetY,
129 int fileWidth, int fileHeight,
130 int regionSizeX, int regionSizeY)
131
132 {
133 // We need to do this because:
134 // "Saving the image to the same file it was constructed from is not allowed and throws an exception."
135 string tempName = offsetX + "_ " + offsetY + "_" + filename;
136
137 Bitmap entireBitmap = null;
138 Bitmap thisBitmap = null;
139 if (File.Exists(filename))
140 {
141 File.Copy(filename, tempName);
142 entireBitmap = new Bitmap(tempName);
143 if (entireBitmap.Width != fileWidth * regionSizeX || entireBitmap.Height != fileHeight * regionSizeY)
144 {
145 // old file, let's overwrite it
146 entireBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
147 }
148 }
149 else
150 {
151 entireBitmap = new Bitmap(fileWidth * regionSizeX, fileHeight * regionSizeY);
152 }
153
154 thisBitmap = CreateGrayscaleBitmapFromMap(m_channel);
155 Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY);
156 for (int x = 0; x < regionSizeX; x++)
157 for (int y = 0; y < regionSizeY; y++)
158 entireBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y));
159
160 Save(entireBitmap, filename);
161 thisBitmap.Dispose();
162 entireBitmap.Dispose();
163
164 if (File.Exists(tempName))
165 File.Delete(tempName);
166 }
167
168 protected virtual void Save(Bitmap bmp, string filename)
169 {
170 bmp.Save(filename, ImageFormat.Png);
171 }
172
127 #endregion 173 #endregion
128 174
129 public override string ToString() 175 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 8667607..1a0d8ec 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
76 colours.Save(stream, ImageFormat.Jpeg); 76 colours.Save(stream, ImageFormat.Jpeg);
77 } 77 }
78 78
79 public virtual void SaveFile(ITerrainChannel m_channel, string filename,
80 int offsetX, int offsetY,
81 int fileWidth, int fileHeight,
82 int regionSizeX, int regionSizeY)
83 {
84 throw new System.Exception("Not Implemented");
85 }
86
79 #endregion 87 #endregion
80 88
81 public override string ToString() 89 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 a70ef13..fad7641 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
240 get { return ".raw"; } 240 get { return ".raw"; }
241 } 241 }
242 242
243 public virtual void SaveFile(ITerrainChannel m_channel, string filename,
244 int offsetX, int offsetY,
245 int fileWidth, int fileHeight,
246 int regionSizeX, int regionSizeY)
247 {
248 throw new System.Exception("Not Implemented");
249 }
250
243 #endregion 251 #endregion
244 252
245 public override string ToString() 253 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 3c76665..ba073ca 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
160 bs.Close(); 160 bs.Close();
161 } 161 }
162 162
163 public virtual void SaveFile(ITerrainChannel m_channel, string filename,
164 int offsetX, int offsetY,
165 int fileWidth, int fileHeight,
166 int regionSizeX, int regionSizeY)
167 {
168 throw new System.Exception("Not Implemented");
169 }
163 #endregion 170 #endregion
164 171
165 public override string ToString() 172 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 2919897..2f37d9d 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
308 get { return ".ter"; } 308 get { return ".ter"; }
309 } 309 }
310 310
311 public virtual void SaveFile(ITerrainChannel m_channel, string filename,
312 int offsetX, int offsetY,
313 int fileWidth, int fileHeight,
314 int regionSizeX, int regionSizeY)
315 {
316 throw new System.Exception("Not Implemented");
317 }
318
311 #endregion 319 #endregion
312 320
313 public override string ToString() 321 public override string ToString()
diff --git a/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs b/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs
index 7403281..7237f90 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
38 ITerrainChannel LoadStream(Stream stream); 38 ITerrainChannel LoadStream(Stream stream);
39 void SaveFile(string filename, ITerrainChannel map); 39 void SaveFile(string filename, ITerrainChannel map);
40 void SaveStream(Stream stream, ITerrainChannel map); 40 void SaveStream(Stream stream, ITerrainChannel map);
41 void SaveFile(ITerrainChannel map, string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int regionSizeX, int regionSizeY);
41 } 42 }
42} \ No newline at end of file 43} \ 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 8a79d78..9c7b2fa 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -541,6 +541,39 @@ namespace OpenSim.Region.CoreModules.World.Terrain
541 } 541 }
542 542
543 /// <summary> 543 /// <summary>
544 /// Saves the terrain to a larger terrain file.
545 /// </summary>
546 /// <param name="filename">The terrain file to save</param>
547 /// <param name="fileWidth">The width of the file in units</param>
548 /// <param name="fileHeight">The height of the file in units</param>
549 /// <param name="fileStartX">Where to begin our slice</param>
550 /// <param name="fileStartY">Where to begin our slice</param>
551 public void SaveToFile(string filename, int fileWidth, int fileHeight, int fileStartX, int fileStartY)
552 {
553 int offsetX = (int)m_scene.RegionInfo.RegionLocX - fileStartX;
554 int offsetY = (int)m_scene.RegionInfo.RegionLocY - fileStartY;
555
556 if (offsetX >= 0 && offsetX < fileWidth && offsetY >= 0 && offsetY < fileHeight)
557 {
558 // this region is included in the tile request
559 foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders)
560 {
561 if (filename.EndsWith(loader.Key))
562 {
563 lock (m_scene)
564 {
565 loader.Value.SaveFile(m_channel, filename, offsetX, offsetY,
566 fileWidth, fileHeight,
567 (int)Constants.RegionSize,
568 (int)Constants.RegionSize);
569 }
570 return;
571 }
572 }
573 }
574 }
575
576 /// <summary>
544 /// Performs updates to the region periodically, synchronising physics and other heightmap aware sections 577 /// Performs updates to the region periodically, synchronising physics and other heightmap aware sections
545 /// </summary> 578 /// </summary>
546 private void EventManager_OnTerrainTick() 579 private void EventManager_OnTerrainTick()
@@ -860,6 +893,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain
860 SaveToFile((string) args[0]); 893 SaveToFile((string) args[0]);
861 } 894 }
862 895
896 private void InterfaceSaveTileFile(Object[] args)
897 {
898 SaveToFile((string)args[0],
899 (int)args[1],
900 (int)args[2],
901 (int)args[3],
902 (int)args[4]);
903 }
904
863 private void InterfaceBakeTerrain(Object[] args) 905 private void InterfaceBakeTerrain(Object[] args)
864 { 906 {
865 UpdateRevertMap(); 907 UpdateRevertMap();
@@ -1115,6 +1157,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1115 loadFromTileCommand.AddArgument("minimum Y tile", "The Y region coordinate of the first section on the file", 1157 loadFromTileCommand.AddArgument("minimum Y tile", "The Y region coordinate of the first section on the file",
1116 "Integer"); 1158 "Integer");
1117 1159
1160 Command saveToTileCommand =
1161 new Command("save-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceSaveTileFile, "Saves the current heightmap to the larger file.");
1162 saveToTileCommand.AddArgument("filename",
1163 "The file you wish to save to, the file extension determines the loader to be used. Supported extensions include: " +
1164 supportedFileExtensions, "String");
1165 saveToTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer");
1166 saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer");
1167 saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file",
1168 "Integer");
1169 saveToTileCommand.AddArgument("minimum Y tile", "The Y region coordinate of the first section on the file",
1170 "Integer");
1118 // Terrain adjustments 1171 // Terrain adjustments
1119 Command fillRegionCommand = 1172 Command fillRegionCommand =
1120 new Command("fill", CommandIntentions.COMMAND_HAZARDOUS, InterfaceFillTerrain, "Fills the current heightmap with a specified value."); 1173 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
1166 m_commander.RegisterCommand("load", loadFromFileCommand); 1219 m_commander.RegisterCommand("load", loadFromFileCommand);
1167 m_commander.RegisterCommand("load-tile", loadFromTileCommand); 1220 m_commander.RegisterCommand("load-tile", loadFromTileCommand);
1168 m_commander.RegisterCommand("save", saveToFileCommand); 1221 m_commander.RegisterCommand("save", saveToFileCommand);
1222 m_commander.RegisterCommand("save-tile", saveToTileCommand);
1169 m_commander.RegisterCommand("fill", fillRegionCommand); 1223 m_commander.RegisterCommand("fill", fillRegionCommand);
1170 m_commander.RegisterCommand("elevate", elevateCommand); 1224 m_commander.RegisterCommand("elevate", elevateCommand);
1171 m_commander.RegisterCommand("lower", lowerCommand); 1225 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 0000000..af8ccda
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/CoalescedSceneObjects.cs
@@ -0,0 +1,154 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Linq;
31using OpenMetaverse;
32
33namespace OpenSim.Region.Framework.Scenes
34{
35 /// <summary>
36 /// Represents a coalescene of scene objects. A coalescence occurs when objects that are not in the same linkset
37 /// are grouped together.
38 /// </summary>
39 public class CoalescedSceneObjects
40 {
41 /// <summary>
42 /// The creator of this coalesence, though not necessarily the objects within it.
43 /// </summary>
44 public UUID CreatorId { get; set; }
45
46 /// <summary>
47 /// The number of objects in this coalesence
48 /// </summary>
49 public int Count
50 {
51 get
52 {
53 lock (m_memberObjects)
54 return m_memberObjects.Count;
55 }
56 }
57
58 /// <summary>
59 /// Does this coalesence have any member objects?
60 /// </summary>
61 public bool HasObjects { get { return Count > 0; } }
62
63 /// <summary>
64 /// Get the objects currently in this coalescence
65 /// </summary>
66 public List<SceneObjectGroup> Objects
67 {
68 get
69 {
70 lock (m_memberObjects)
71 return new List<SceneObjectGroup>(m_memberObjects);
72 }
73 }
74
75 /// <summary>
76 /// Get the scene that contains the objects in this coalescence. If there are no objects then null is returned.
77 /// </summary>
78 public Scene Scene
79 {
80 get
81 {
82 if (!HasObjects)
83 return null;
84 else
85 return Objects[0].Scene;
86 }
87 }
88
89 /// <summary>
90 /// At this point, we need to preserve the order of objects added to the coalescence, since the first
91 /// one will end up matching the item name when rerezzed.
92 /// </summary>
93 protected List<SceneObjectGroup> m_memberObjects = new List<SceneObjectGroup>();
94
95 public CoalescedSceneObjects(UUID creatorId)
96 {
97 CreatorId = creatorId;
98 }
99
100 public CoalescedSceneObjects(UUID creatorId, params SceneObjectGroup[] objs) : this(creatorId)
101 {
102 foreach (SceneObjectGroup obj in objs)
103 Add(obj);
104 }
105
106 /// <summary>
107 /// Add an object to the coalescence.
108 /// </summary>
109 /// <param name="obj"></param>
110 /// <param name="offset">The offset of the object within the group</param>
111 public void Add(SceneObjectGroup obj)
112 {
113 lock (m_memberObjects)
114 m_memberObjects.Add(obj);
115 }
116
117 /// <summary>
118 /// Removes a scene object from the coalescene
119 /// </summary>
120 /// <param name="sceneObjectId"></param>
121 /// <returns>true if the object was there to be removed, false if not.</returns>
122 public bool Remove(SceneObjectGroup obj)
123 {
124 lock (m_memberObjects)
125 return m_memberObjects.Remove(obj);
126 }
127
128 /// <summary>
129 /// Get the total size of the coalescence (the size required to cover all the objects within it) and the
130 /// offsets of each of those objects.
131 /// </summary>
132 /// <param name="size"></param>
133 /// <returns>
134 /// An array of offsets. The order of objects is the same as returned from the Objects property
135 /// </returns>
136 public Vector3[] GetSizeAndOffsets(out Vector3 size)
137 {
138 float minX, minY, minZ;
139 float maxX, maxY, maxZ;
140
141 Vector3[] offsets
142 = Scene.GetCombinedBoundingBox(
143 Objects, out minX, out maxX, out minY, out maxY, out minZ, out maxZ);
144
145 float sizeX = maxX - minX;
146 float sizeY = maxY - minY;
147 float sizeZ = maxZ - minZ;
148
149 size = new Vector3(sizeX, sizeY, sizeZ);
150
151 return offsets;
152 }
153 }
154} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f0acc38..fdd5205 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4839,7 +4839,20 @@ namespace OpenSim.Region.Framework.Scenes
4839 } 4839 }
4840 } 4840 }
4841 4841
4842 public Vector3[] GetCombinedBoundingBox(List<SceneObjectGroup> objects, out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) 4842 /// <summary>
4843 /// Get the volume of space that will encompass all the given objects.
4844 /// </summary>
4845 /// <param name="objects"></param>
4846 /// <param name="minX"></param>
4847 /// <param name="maxX"></param>
4848 /// <param name="minY"></param>
4849 /// <param name="maxY"></param>
4850 /// <param name="minZ"></param>
4851 /// <param name="maxZ"></param>
4852 /// <returns></returns>
4853 public static Vector3[] GetCombinedBoundingBox(
4854 List<SceneObjectGroup> objects,
4855 out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ)
4843 { 4856 {
4844 minX = 256; 4857 minX = 256;
4845 maxX = -256; 4858 maxX = -256;
@@ -4857,6 +4870,10 @@ namespace OpenSim.Region.Framework.Scenes
4857 Vector3 vec = g.AbsolutePosition; 4870 Vector3 vec = g.AbsolutePosition;
4858 4871
4859 g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); 4872 g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ);
4873
4874// m_log.DebugFormat(
4875// "[SCENE]: For {0} found AxisAlignedBoundingBoxRaw {1}, {2}",
4876// g.Name, new Vector3(ominX, ominY, ominZ), new Vector3(omaxX, omaxY, omaxZ));
4860 4877
4861 ominX += vec.X; 4878 ominX += vec.X;
4862 omaxX += vec.X; 4879 omaxX += vec.X;
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 97af0a0..72f0402 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -997,6 +997,8 @@ namespace OpenSim.Region.Framework.Scenes
997 { 997 {
998 foreach (SceneObjectPart p in ((SceneObjectGroup)entity).Parts) 998 foreach (SceneObjectPart p in ((SceneObjectGroup)entity).Parts)
999 { 999 {
1000// m_log.DebugFormat("[SCENE GRAPH]: Part {0} has name {1}", p.UUID, p.Name);
1001
1000 if (p.Name == name) 1002 if (p.Name == name)
1001 { 1003 {
1002 sop = p; 1004 sop = p;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 3d2eacd..8a8a699 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2080,7 +2080,14 @@ namespace OpenSim.Region.Framework.Scenes
2080 2080
2081 axPos *= parentRot; 2081 axPos *= parentRot;
2082 Vector3 translationOffsetPosition = axPos; 2082 Vector3 translationOffsetPosition = axPos;
2083 return GroupPosition + translationOffsetPosition; 2083
2084// m_log.DebugFormat("[SCENE OBJECT PART]: Found group pos {0} for part {1}", GroupPosition, Name);
2085
2086 Vector3 worldPos = GroupPosition + translationOffsetPosition;
2087
2088// m_log.DebugFormat("[SCENE OBJECT PART]: Found world pos {0} for part {1}", worldPos, Name);
2089
2090 return worldPos;
2084 } 2091 }
2085 2092
2086 /// <summary> 2093 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
new file mode 100644
index 0000000..a0e120a
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
@@ -0,0 +1,114 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Drawing;
31using System.IO;
32using System.Reflection;
33using System.Xml;
34using log4net;
35using OpenMetaverse;
36using OpenSim.Framework;
37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes;
39
40namespace OpenSim.Region.Framework.Scenes.Serialization
41{
42 /// <summary>
43 /// Serialize and deserialize coalesced scene objects.
44 /// </summary>
45 /// <remarks>
46 /// Deserialization not yet here.
47 /// </remarks>
48 public class CoalescedSceneObjectsSerializer
49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51
52 /// <summary>
53 /// Serialize coalesced objects to Xml
54 /// </summary>
55 /// <param name="coa"></param>
56 /// <returns></returns>
57 public static string ToXml(CoalescedSceneObjects coa)
58 {
59 // TODO: Should probably return an empty xml serialization rather than a blank string
60 if (!coa.HasObjects)
61 return "";
62
63 using (StringWriter sw = new StringWriter())
64 {
65 using (XmlTextWriter writer = new XmlTextWriter(sw))
66 {
67 Vector3 size;
68
69 List<SceneObjectGroup> coaObjects = coa.Objects;
70
71// m_log.DebugFormat(
72// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing {0} objects for coalesced object",
73// coaObjects.Count);
74
75 // This is weak - we're relying on the set of coalesced objects still being identical
76 Vector3[] offsets = coa.GetSizeAndOffsets(out size);
77
78 writer.WriteStartElement("CoalescedObject");
79
80 writer.WriteAttributeString("x", size.X.ToString());
81 writer.WriteAttributeString("y", size.Y.ToString());
82 writer.WriteAttributeString("z", size.Z.ToString());
83
84 // Embed the offsets into the group XML
85 for (int i = 0; i < coaObjects.Count; i++)
86 {
87 SceneObjectGroup obj = coaObjects[i];
88
89// m_log.DebugFormat(
90// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing offset for object {0}, {1}",
91// i, obj.Name);
92
93 writer.WriteStartElement("SceneObjectGroup");
94 writer.WriteAttributeString("offsetx", offsets[i].X.ToString());
95 writer.WriteAttributeString("offsety", offsets[i].Y.ToString());
96 writer.WriteAttributeString("offsetz", offsets[i].Z.ToString());
97
98 SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, true);
99
100 writer.WriteEndElement(); // SceneObjectGroup
101 }
102
103 writer.WriteEndElement(); // CoalescedObject
104 }
105
106 string output = sw.ToString();
107
108// m_log.Debug(output);
109
110 return output;
111 }
112 }
113 }
114} \ 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 57ae4fd..bb8a83a 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
139 return sw.ToString(); 139 return sw.ToString();
140 } 140 }
141 } 141 }
142
142 143
143 /// <summary> 144 /// <summary>
144 /// Serialize a scene object to the original xml format 145 /// Serialize a scene object to the original xml format
@@ -147,10 +148,24 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
147 /// <returns></returns> 148 /// <returns></returns>
148 public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer) 149 public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer)
149 { 150 {
151 ToOriginalXmlFormat(sceneObject, writer, false);
152 }
153
154 /// <summary>
155 /// Serialize a scene object to the original xml format
156 /// </summary>
157 /// <param name="sceneObject"></param>
158 /// <param name="writer"></param>
159 /// <param name="noRootElement">If false, don't write the enclosing SceneObjectGroup element</param>
160 /// <returns></returns>
161 public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer, bool noRootElement)
162 {
150 //m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", Name); 163 //m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", Name);
151 //int time = System.Environment.TickCount; 164 //int time = System.Environment.TickCount;
152 165
153 writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); 166 if (!noRootElement)
167 writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
168
154 writer.WriteStartElement(String.Empty, "RootPart", String.Empty); 169 writer.WriteStartElement(String.Empty, "RootPart", String.Empty);
155 ToXmlFormat(sceneObject.RootPart, writer); 170 ToXmlFormat(sceneObject.RootPart, writer);
156 writer.WriteEndElement(); 171 writer.WriteEndElement();
@@ -170,10 +185,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
170 185
171 writer.WriteEndElement(); // OtherParts 186 writer.WriteEndElement(); // OtherParts
172 sceneObject.SaveScriptedState(writer); 187 sceneObject.SaveScriptedState(writer);
173 writer.WriteEndElement(); // SceneObjectGroup 188
189 if (!noRootElement)
190 writer.WriteEndElement(); // SceneObjectGroup
174 191
175 //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time); 192 //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time);
176 } 193 }
177 194
178 protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer) 195 protected static void ToXmlFormat(SceneObjectPart part, XmlTextWriter writer)
179 { 196 {
@@ -1318,7 +1335,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1318 writer.WriteStartElement("SculptData"); 1335 writer.WriteStartElement("SculptData");
1319 byte[] sd; 1336 byte[] sd;
1320 if (shp.SculptData != null) 1337 if (shp.SculptData != null)
1321 sd = shp.ExtraParams; 1338 sd = shp.SculptData;
1322 else 1339 else
1323 sd = Utils.EmptyBytes; 1340 sd = Utils.EmptyBytes;
1324 writer.WriteBase64(sd, 0, sd.Length); 1341 writer.WriteBase64(sd, 0, sd.Length);
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs
index 85e34c1..6df213d 100644
--- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs
+++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs
@@ -648,6 +648,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
648 if (pbs.ProfileHollow != 0) 648 if (pbs.ProfileHollow != 0)
649 iPropertiesNotSupportedDefault++; 649 iPropertiesNotSupportedDefault++;
650 650
651 if ((pbs.PathBegin != 0) || pbs.PathEnd != 0)
652 iPropertiesNotSupportedDefault++;
653
651 if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0)) 654 if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0))
652 iPropertiesNotSupportedDefault++; 655 iPropertiesNotSupportedDefault++;
653 656
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index eb97f41..a0101af 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -2528,6 +2528,9 @@ namespace OpenSim.Region.Physics.OdePlugin
2528 if (pbs.ProfileHollow != 0) 2528 if (pbs.ProfileHollow != 0)
2529 iPropertiesNotSupportedDefault++; 2529 iPropertiesNotSupportedDefault++;
2530 2530
2531 if ((pbs.PathBegin != 0) || pbs.PathEnd != 0)
2532 iPropertiesNotSupportedDefault++;
2533
2531 if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0)) 2534 if ((pbs.PathTwistBegin != 0) || (pbs.PathTwist != 0))
2532 iPropertiesNotSupportedDefault++; 2535 iPropertiesNotSupportedDefault++;
2533 2536
diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
index 65b3537..f1da4fa 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
@@ -34,7 +34,6 @@ using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Framework.Communications; 36using OpenSim.Framework.Communications;
37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
39using OpenMetaverse; 38using OpenMetaverse;
40 39
diff --git a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs
index 6f77a2d..c04e7a4 100644
--- a/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Authentication/AuthenticationServiceConnector.cs
@@ -33,7 +33,6 @@ using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
38using OpenSim.Server.Base; 37using OpenSim.Server.Base;
39using OpenMetaverse; 38using OpenMetaverse;
diff --git a/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs b/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs
index 4eb4bd2..35b7109 100644
--- a/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Authorization/AuthorizationServiceConnector.cs
@@ -33,7 +33,6 @@ using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
38using OpenMetaverse; 37using OpenMetaverse;
39 38
diff --git a/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs b/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs
index 1cd6bf8..1a93ae7 100644
--- a/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs
@@ -33,7 +33,6 @@ using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
38using GridRegion = OpenSim.Services.Interfaces.GridRegion; 37using GridRegion = OpenSim.Services.Interfaces.GridRegion;
39using IAvatarService = OpenSim.Services.Interfaces.IAvatarService; 38using IAvatarService = OpenSim.Services.Interfaces.IAvatarService;
diff --git a/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs b/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs
index c9bba0b..d688299 100644
--- a/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs
+++ b/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs
@@ -33,7 +33,6 @@ using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
38using OpenSim.Server.Base; 37using OpenSim.Server.Base;
39using OpenMetaverse; 38using OpenMetaverse;
diff --git a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs
index 36b5083..861c475 100644
--- a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs
@@ -33,7 +33,6 @@ using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
38using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; 37using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
39using OpenSim.Server.Base; 38using OpenSim.Server.Base;
diff --git a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs
index 0a7b277..4ffa68c 100644
--- a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs
+++ b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs
@@ -32,7 +32,7 @@ using System.Reflection;
32using OpenSim.Services.Interfaces; 32using OpenSim.Services.Interfaces;
33using GridRegion = OpenSim.Services.Interfaces.GridRegion; 33using GridRegion = OpenSim.Services.Interfaces.GridRegion;
34using OpenSim.Server.Base; 34using OpenSim.Server.Base;
35using OpenSim.Framework.Servers.HttpServer; 35using OpenSim.Framework;
36 36
37using OpenMetaverse; 37using OpenMetaverse;
38using log4net; 38using log4net;
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
index 5092d74..e57f28b 100644
--- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
@@ -33,7 +33,6 @@ using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
38using GridRegion = OpenSim.Services.Interfaces.GridRegion; 37using GridRegion = OpenSim.Services.Interfaces.GridRegion;
39using OpenSim.Server.Base; 38using OpenSim.Server.Base;
diff --git a/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs b/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs
index b3ea865..738cc06 100644
--- a/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs
+++ b/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs
@@ -33,7 +33,6 @@ using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
38using GridRegion = OpenSim.Services.Interfaces.GridRegion; 37using GridRegion = OpenSim.Services.Interfaces.GridRegion;
39using OpenSim.Server.Base; 38using OpenSim.Server.Base;
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
index b3bfcc2..cd9f2bf 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
@@ -34,7 +34,6 @@ using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Framework.Communications; 36using OpenSim.Framework.Communications;
37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
39using OpenSim.Server.Base; 38using OpenSim.Server.Base;
40using OpenMetaverse; 39using OpenMetaverse;
diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
index 252f7a1..30a73a4 100644
--- a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
@@ -34,7 +34,6 @@ using System.Reflection;
34using Nini.Config; 34using Nini.Config;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Communications; 36using OpenSim.Framework.Communications;
37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
39using OpenMetaverse; 38using OpenMetaverse;
40using Nwc.XmlRpc; 39using Nwc.XmlRpc;
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
index 9e444c4..2cae02d 100644
--- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
@@ -36,7 +36,6 @@ using System.Text;
36using Nini.Config; 36using Nini.Config;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Services.Interfaces; 39using OpenSim.Services.Interfaces;
41using OpenMetaverse; 40using OpenMetaverse;
42using OpenMetaverse.StructuredData; 41using OpenMetaverse.StructuredData;
diff --git a/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
index 41ebeaf..7238afc 100644
--- a/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Presence/PresenceServiceConnector.cs
@@ -33,7 +33,6 @@ using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
38using GridRegion = OpenSim.Services.Interfaces.GridRegion; 37using GridRegion = OpenSim.Services.Interfaces.GridRegion;
39using OpenSim.Server.Base; 38using OpenSim.Server.Base;
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs
index 2a5df83..f6835b9 100644
--- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs
@@ -33,7 +33,6 @@ using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Server.Base; 36using OpenSim.Server.Base;
38using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
39using OpenMetaverse; 38using OpenMetaverse;
diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
index ff4423f..af66d7f 100644
--- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
@@ -71,6 +71,21 @@ namespace OpenSim.Tests.Common
71 Encoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)), 71 Encoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)),
72 sog.OwnerID); 72 sog.OwnerID);
73 } 73 }
74
75 /// <summary>
76 /// Create an asset from the given scene object.
77 /// </summary>
78 /// <param name="assetUuid"></param>
79 /// <param name="coa"></param>
80 /// <returns></returns>
81 public static AssetBase CreateAsset(UUID assetUuid, CoalescedSceneObjects coa)
82 {
83 return CreateAsset(
84 assetUuid,
85 AssetType.Object,
86 Encoding.ASCII.GetBytes(CoalescedSceneObjectsSerializer.ToXml(coa)),
87 coa.CreatorId);
88 }
74 89
75 /// <summary> 90 /// <summary>
76 /// Create an asset from the given data. 91 /// Create an asset from the given data.