diff options
66 files changed, 1410 insertions, 1124 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 | |||
28 | using System; | ||
29 | using System.IO; | ||
30 | using System.Net; | ||
31 | using System.Reflection; | ||
32 | using System.Text; | ||
33 | using System.Xml; | ||
34 | using System.Xml.Serialization; | ||
35 | using log4net; | ||
36 | |||
37 | namespace 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 | |||
28 | using System; | ||
29 | using System.IO; | ||
30 | using System.Net; | ||
31 | using System.Reflection; | ||
32 | using System.Text; | ||
33 | using System.Xml; | ||
34 | using System.Xml.Serialization; | ||
35 | |||
36 | using log4net; | ||
37 | |||
38 | namespace 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 | |||
28 | using System; | ||
29 | using System.IO; | ||
30 | using System.Net; | ||
31 | using System.Text; | ||
32 | using System.Xml; | ||
33 | using System.Xml.Serialization; | ||
34 | |||
35 | namespace 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; | |||
36 | using System.Reflection; | 36 | using System.Reflection; |
37 | using System.Text; | 37 | using System.Text; |
38 | using System.Web; | 38 | using System.Web; |
39 | using System.Xml; | ||
40 | using System.Xml.Serialization; | ||
41 | |||
39 | using log4net; | 42 | using log4net; |
40 | using OpenSim.Framework.Servers.HttpServer; | 43 | using OpenSim.Framework.Servers.HttpServer; |
41 | using OpenMetaverse.StructuredData; | 44 | using 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 8de31d7..76d7f79 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -4290,6 +4290,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4290 | 4290 | ||
4291 | public void SendEstateCovenantInformation(UUID covenant) | 4291 | public void SendEstateCovenantInformation(UUID covenant) |
4292 | { | 4292 | { |
4293 | // m_log.DebugFormat("[LLCLIENTVIEW]: Sending estate covenant asset id of {0} to {1}", covenant, Name); | ||
4294 | |||
4293 | EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket(); | 4295 | EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket(); |
4294 | EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock(); | 4296 | EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock(); |
4295 | edata.CovenantID = covenant; | 4297 | edata.CovenantID = covenant; |
@@ -4300,8 +4302,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4300 | OutPacket(einfopack, ThrottleOutPacketType.Task); | 4302 | OutPacket(einfopack, ThrottleOutPacketType.Task); |
4301 | } | 4303 | } |
4302 | 4304 | ||
4303 | public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner) | 4305 | public void SendDetailedEstateData( |
4306 | UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, | ||
4307 | UUID covenant, string abuseEmail, UUID estateOwner) | ||
4304 | { | 4308 | { |
4309 | // m_log.DebugFormat( | ||
4310 | // "[LLCLIENTVIEW]: Sending detailed estate data to {0} with covenant asset id {1}", Name, covenant); | ||
4311 | |||
4305 | EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); | 4312 | EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); |
4306 | packet.MethodData.Invoice = invoice; | 4313 | packet.MethodData.Invoice = invoice; |
4307 | packet.AgentData.TransactionID = UUID.Random(); | 4314 | 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; | |||
34 | using Nwc.XmlRpc; | 34 | using Nwc.XmlRpc; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
38 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
40 | using OpenSim.Services.Interfaces; | 41 | using OpenSim.Services.Interfaces; |
41 | using OpenSim.Services.Connectors.Friends; | 42 | using OpenSim.Services.Connectors.Friends; |
42 | using OpenSim.Server.Base; | 43 | using OpenSim.Server.Base; |
43 | using OpenSim.Framework.Servers.HttpServer; | ||
44 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | 44 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; |
45 | using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; | 45 | using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; |
46 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 46 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 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; | |||
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | 34 | using OpenSim.Framework.Communications; |
35 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Framework.Client; | 36 | using OpenSim.Framework.Client; |
38 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 01170aa..f3d2f26 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -471,16 +471,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
471 | if (m_creatorIdForAssetId.ContainsKey(assetId)) | 471 | if (m_creatorIdForAssetId.ContainsKey(assetId)) |
472 | { | 472 | { |
473 | string xmlData = Utils.BytesToString(data); | 473 | string xmlData = Utils.BytesToString(data); |
474 | SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 474 | List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); |
475 | foreach (SceneObjectPart sop in sog.Parts) | 475 | |
476 | CoalescedSceneObjects coa = null; | ||
477 | if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) | ||
478 | { | ||
479 | // m_log.DebugFormat( | ||
480 | // "[INVENTORY ARCHIVER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); | ||
481 | |||
482 | sceneObjects.AddRange(coa.Objects); | ||
483 | } | ||
484 | else | ||
476 | { | 485 | { |
477 | if (sop.CreatorData == null || sop.CreatorData == "") | 486 | sceneObjects.Add(SceneObjectSerializer.FromOriginalXmlFormat(xmlData)); |
478 | { | ||
479 | sop.CreatorID = m_creatorIdForAssetId[assetId]; | ||
480 | } | ||
481 | } | 487 | } |
482 | 488 | ||
483 | data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)); | 489 | foreach (SceneObjectGroup sog in sceneObjects) |
490 | foreach (SceneObjectPart sop in sog.Parts) | ||
491 | if (sop.CreatorData == null || sop.CreatorData == "") | ||
492 | sop.CreatorID = m_creatorIdForAssetId[assetId]; | ||
493 | |||
494 | if (coa != null) | ||
495 | data = Utils.StringToBytes(CoalescedSceneObjectsSerializer.ToXml(coa)); | ||
496 | else | ||
497 | data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sceneObjects[0])); | ||
484 | } | 498 | } |
485 | } | 499 | } |
486 | 500 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index e5127a0..5ba08ee 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs | |||
@@ -68,17 +68,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
68 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"), | 68 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"), |
69 | FirstName = "Mr", | 69 | FirstName = "Mr", |
70 | LastName = "Tiddles" }; | 70 | LastName = "Tiddles" }; |
71 | |||
71 | protected UserAccount m_uaLL1 | 72 | protected UserAccount m_uaLL1 |
72 | = new UserAccount { | 73 | = new UserAccount { |
73 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"), | 74 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"), |
74 | FirstName = "Lord", | 75 | FirstName = "Lord", |
75 | LastName = "Lucan" }; | 76 | LastName = "Lucan" }; |
77 | |||
76 | protected UserAccount m_uaLL2 | 78 | protected UserAccount m_uaLL2 |
77 | = new UserAccount { | 79 | = new UserAccount { |
78 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000777"), | 80 | PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000777"), |
79 | FirstName = "Lord", | 81 | FirstName = "Lord", |
80 | LastName = "Lucan" }; | 82 | LastName = "Lucan" }; |
83 | |||
81 | protected string m_item1Name = "Ray Gun Item"; | 84 | protected string m_item1Name = "Ray Gun Item"; |
85 | protected string m_coaItemName = "Coalesced Item"; | ||
82 | 86 | ||
83 | [SetUp] | 87 | [SetUp] |
84 | public virtual void SetUp() | 88 | public virtual void SetUp() |
@@ -97,38 +101,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
97 | // log4net.Config.XmlConfigurator.Configure(); | 101 | // log4net.Config.XmlConfigurator.Configure(); |
98 | 102 | ||
99 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 103 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
100 | Scene scene = SceneSetupHelpers.SetupScene("Inventory"); | 104 | Scene scene = SceneSetupHelpers.SetupScene(); |
101 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); | 105 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); |
102 | 106 | ||
103 | UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); | 107 | UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); |
104 | 108 | ||
105 | MemoryStream archiveWriteStream = new MemoryStream(); | 109 | MemoryStream archiveWriteStream = new MemoryStream(); |
106 | 110 | ||
107 | // Create asset | 111 | // Create scene object asset |
108 | SceneObjectGroup object1; | 112 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); |
109 | SceneObjectPart part1; | 113 | SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50); |
110 | { | ||
111 | string partName = "Ray Gun Object"; | ||
112 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); | ||
113 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); | ||
114 | Vector3 groupPosition = new Vector3(10, 20, 30); | ||
115 | Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); | ||
116 | Vector3 offsetPosition = new Vector3(5, 10, 15); | ||
117 | |||
118 | part1 | ||
119 | = new SceneObjectPart( | ||
120 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); | ||
121 | part1.Name = partName; | ||
122 | |||
123 | object1 = new SceneObjectGroup(part1); | ||
124 | scene.AddNewSceneObject(object1, false); | ||
125 | } | ||
126 | 114 | ||
127 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); | 115 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); |
128 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); | 116 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); |
129 | scene.AssetService.Store(asset1); | 117 | scene.AssetService.Store(asset1); |
130 | 118 | ||
131 | // Create item | 119 | // Create scene object item |
132 | InventoryItemBase item1 = new InventoryItemBase(); | 120 | InventoryItemBase item1 = new InventoryItemBase(); |
133 | item1.Name = m_item1Name; | 121 | item1.Name = m_item1Name; |
134 | item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 122 | item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
@@ -139,8 +127,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
139 | item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; | 127 | item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; |
140 | scene.AddInventoryItem(item1); | 128 | scene.AddInventoryItem(item1); |
141 | 129 | ||
130 | // Create coalesced objects asset | ||
131 | SceneObjectGroup cobj1 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object1", 0x120); | ||
132 | cobj1.AbsolutePosition = new Vector3(15, 30, 45); | ||
133 | |||
134 | SceneObjectGroup cobj2 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object2", 0x140); | ||
135 | cobj2.AbsolutePosition = new Vector3(25, 50, 75); | ||
136 | |||
137 | CoalescedSceneObjects coa = new CoalescedSceneObjects(m_uaLL1.PrincipalID, cobj1, cobj2); | ||
138 | |||
139 | AssetBase coaAsset = AssetHelpers.CreateAsset(0x160, coa); | ||
140 | scene.AssetService.Store(coaAsset); | ||
141 | |||
142 | // Create coalesced objects inventory item | ||
143 | InventoryItemBase coaItem = new InventoryItemBase(); | ||
144 | coaItem.Name = m_coaItemName; | ||
145 | coaItem.ID = UUID.Parse("00000000-0000-0000-0000-000000000180"); | ||
146 | coaItem.AssetID = coaAsset.FullID; | ||
147 | coaItem.GroupID = UUID.Random(); | ||
148 | coaItem.CreatorIdAsUuid = m_uaLL1.PrincipalID; | ||
149 | coaItem.Owner = m_uaLL1.PrincipalID; | ||
150 | coaItem.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; | ||
151 | scene.AddInventoryItem(coaItem); | ||
152 | |||
142 | archiverModule.ArchiveInventory( | 153 | archiverModule.ArchiveInventory( |
143 | Guid.NewGuid(), m_uaLL1.FirstName, m_uaLL1.LastName, m_item1Name, "hampshire", archiveWriteStream); | 154 | Guid.NewGuid(), m_uaLL1.FirstName, m_uaLL1.LastName, "/*", "hampshire", archiveWriteStream); |
144 | 155 | ||
145 | m_iarStreamBytes = archiveWriteStream.ToArray(); | 156 | m_iarStreamBytes = archiveWriteStream.ToArray(); |
146 | } | 157 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 7f156f8..d03f6da 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -62,9 +62,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
62 | SerialiserModule serialiserModule = new SerialiserModule(); | 62 | SerialiserModule serialiserModule = new SerialiserModule(); |
63 | m_archiverModule = new InventoryArchiverModule(); | 63 | m_archiverModule = new InventoryArchiverModule(); |
64 | 64 | ||
65 | m_scene = SceneSetupHelpers.SetupScene("Inventory"); | 65 | m_scene = SceneSetupHelpers.SetupScene(); |
66 | SceneSetupHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); | 66 | SceneSetupHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); |
67 | } | 67 | } |
68 | |||
69 | [Test] | ||
70 | public void TestLoadCoalesecedItem() | ||
71 | { | ||
72 | TestHelper.InMethod(); | ||
73 | // log4net.Config.XmlConfigurator.Configure(); | ||
74 | |||
75 | UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL1, "password"); | ||
76 | m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); | ||
77 | |||
78 | InventoryItemBase coaItem | ||
79 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName); | ||
80 | |||
81 | Assert.That(coaItem, Is.Not.Null, "Didn't find loaded item 1"); | ||
82 | |||
83 | string assetXml = AssetHelpers.ReadAssetAsString(m_scene.AssetService, coaItem.AssetID); | ||
84 | |||
85 | CoalescedSceneObjects coa; | ||
86 | bool readResult = CoalescedSceneObjectsSerializer.TryFromXml(assetXml, out coa); | ||
87 | |||
88 | Assert.That(readResult, Is.True); | ||
89 | Assert.That(coa.Count, Is.EqualTo(2)); | ||
90 | |||
91 | List<SceneObjectGroup> coaObjects = coa.Objects; | ||
92 | Assert.That(coaObjects[0].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000120"))); | ||
93 | Assert.That(coaObjects[0].AbsolutePosition, Is.EqualTo(new Vector3(15, 30, 45))); | ||
94 | |||
95 | Assert.That(coaObjects[1].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000140"))); | ||
96 | Assert.That(coaObjects[1].AbsolutePosition, Is.EqualTo(new Vector3(25, 50, 75))); | ||
97 | } | ||
68 | 98 | ||
69 | /// <summary> | 99 | /// <summary> |
70 | /// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive | 100 | /// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive |
@@ -84,24 +114,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
84 | UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword); | 114 | UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword); |
85 | 115 | ||
86 | // Create asset | 116 | // Create asset |
87 | SceneObjectGroup object1; | 117 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); |
88 | SceneObjectPart part1; | 118 | SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50); |
89 | { | ||
90 | string partName = "My Little Dog Object"; | ||
91 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); | ||
92 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); | ||
93 | Vector3 groupPosition = new Vector3(10, 20, 30); | ||
94 | Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); | ||
95 | Vector3 offsetPosition = new Vector3(5, 10, 15); | ||
96 | |||
97 | part1 | ||
98 | = new SceneObjectPart( | ||
99 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); | ||
100 | part1.Name = partName; | ||
101 | |||
102 | object1 = new SceneObjectGroup(part1); | ||
103 | m_scene.AddNewSceneObject(object1, false); | ||
104 | } | ||
105 | 119 | ||
106 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); | 120 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); |
107 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); | 121 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs index 0e8f647..c7dae52 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs | |||
@@ -63,7 +63,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
63 | 63 | ||
64 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 64 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
65 | 65 | ||
66 | Scene scene = SceneSetupHelpers.SetupScene("Inventory"); | 66 | Scene scene = SceneSetupHelpers.SetupScene(); |
67 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); | 67 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); |
68 | 68 | ||
69 | // Create user | 69 | // Create user |
@@ -180,7 +180,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
180 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 180 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
181 | 181 | ||
182 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene | 182 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene |
183 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 183 | Scene scene = SceneSetupHelpers.SetupScene(); |
184 | 184 | ||
185 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 185 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); |
186 | 186 | ||
@@ -223,7 +223,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
223 | 223 | ||
224 | SerialiserModule serialiserModule = new SerialiserModule(); | 224 | SerialiserModule serialiserModule = new SerialiserModule(); |
225 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 225 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
226 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 226 | Scene scene = SceneSetupHelpers.SetupScene(); |
227 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 227 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); |
228 | 228 | ||
229 | UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "password"); | 229 | UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "password"); |
@@ -248,7 +248,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
248 | 248 | ||
249 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); | 249 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
250 | 250 | ||
251 | Scene scene = SceneSetupHelpers.SetupScene("Inventory"); | 251 | Scene scene = SceneSetupHelpers.SetupScene(); |
252 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); | 252 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); |
253 | 253 | ||
254 | // Create user | 254 | // Create user |
@@ -327,7 +327,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
327 | TestHelper.InMethod(); | 327 | TestHelper.InMethod(); |
328 | // log4net.Config.XmlConfigurator.Configure(); | 328 | // log4net.Config.XmlConfigurator.Configure(); |
329 | 329 | ||
330 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 330 | Scene scene = SceneSetupHelpers.SetupScene(); |
331 | UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); | 331 | UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); |
332 | 332 | ||
333 | Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); | 333 | Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); |
@@ -394,7 +394,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
394 | TestHelper.InMethod(); | 394 | TestHelper.InMethod(); |
395 | //log4net.Config.XmlConfigurator.Configure(); | 395 | //log4net.Config.XmlConfigurator.Configure(); |
396 | 396 | ||
397 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 397 | Scene scene = SceneSetupHelpers.SetupScene(); |
398 | UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); | 398 | UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); |
399 | 399 | ||
400 | string folder1ExistingName = "a"; | 400 | string folder1ExistingName = "a"; |
@@ -445,7 +445,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
445 | TestHelper.InMethod(); | 445 | TestHelper.InMethod(); |
446 | // log4net.Config.XmlConfigurator.Configure(); | 446 | // log4net.Config.XmlConfigurator.Configure(); |
447 | 447 | ||
448 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 448 | Scene scene = SceneSetupHelpers.SetupScene(); |
449 | UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); | 449 | UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); |
450 | 450 | ||
451 | string folder1ExistingName = "a"; | 451 | string folder1ExistingName = "a"; |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 73b0a35..5d19025 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,209 +259,37 @@ 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. |
315 | 274 | foreach (SceneObjectGroup objectGroup in objlist) | |
316 | // Get the user info of the item destination | 275 | objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; |
317 | // | ||
318 | UUID userID = UUID.Zero; | ||
319 | |||
320 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || | ||
321 | action == DeRezAction.SaveToExistingUserInventoryItem) | ||
322 | { | ||
323 | // Take or take copy require a taker | ||
324 | // Saving changes requires a local user | ||
325 | // | ||
326 | if (remoteClient == null) | ||
327 | return UUID.Zero; | ||
328 | |||
329 | userID = remoteClient.AgentId; | ||
330 | } | ||
331 | else | ||
332 | { | ||
333 | // All returns / deletes go to the object owner | ||
334 | // | ||
335 | |||
336 | userID = objlist[0].RootPart.OwnerID; | ||
337 | } | ||
338 | 276 | ||
339 | if (userID == UUID.Zero) // Can't proceed | 277 | InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID); |
340 | { | 278 | if (item == null) |
341 | return UUID.Zero; | 279 | return UUID.Zero; |
342 | } | 280 | |
343 | 281 | // Can't know creator is the same, so null it in inventory | |
344 | // If we're returning someone's item, it goes back to the | 282 | if (objlist.Count > 1) |
345 | // owner's Lost And Found folder. | ||
346 | // Delete is treated like return in this case | ||
347 | // Deleting your own items makes them go to trash | ||
348 | // | ||
349 | |||
350 | InventoryFolderBase folder = null; | ||
351 | InventoryItemBase item = null; | ||
352 | |||
353 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | ||
354 | { | 283 | { |
355 | item = new InventoryItemBase(objlist[0].RootPart.FromUserInventoryItemID, userID); | 284 | item.CreatorId = UUID.Zero.ToString(); |
356 | item = m_Scene.InventoryService.GetItem(item); | 285 | item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; |
357 | |||
358 | //item = userInfo.RootFolder.FindItem( | ||
359 | // objectGroup.RootPart.FromUserInventoryItemID); | ||
360 | |||
361 | if (null == item) | ||
362 | { | ||
363 | m_log.DebugFormat( | ||
364 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", | ||
365 | objlist[0].Name, objlist[0].UUID); | ||
366 | return UUID.Zero; | ||
367 | } | ||
368 | } | 286 | } |
369 | else | 287 | else |
370 | { | 288 | { |
371 | // Folder magic | 289 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); |
372 | // | 290 | item.SaleType = objlist[0].RootPart.ObjectSaleType; |
373 | if (action == DeRezAction.Delete) | 291 | item.SalePrice = objlist[0].RootPart.SalePrice; |
374 | { | 292 | } |
375 | // Deleting someone else's item | ||
376 | // | ||
377 | if (remoteClient == null || | ||
378 | objlist[0].OwnerID != remoteClient.AgentId) | ||
379 | { | ||
380 | |||
381 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
382 | } | ||
383 | else | ||
384 | { | ||
385 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | ||
386 | } | ||
387 | } | ||
388 | else if (action == DeRezAction.Return) | ||
389 | { | ||
390 | |||
391 | // Dump to lost + found unconditionally | ||
392 | // | ||
393 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
394 | } | ||
395 | |||
396 | if (folderID == UUID.Zero && folder == null) | ||
397 | { | ||
398 | if (action == DeRezAction.Delete) | ||
399 | { | ||
400 | // Deletes go to trash by default | ||
401 | // | ||
402 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | ||
403 | } | ||
404 | else | ||
405 | { | ||
406 | if (remoteClient == null || | ||
407 | objlist[0].OwnerID != remoteClient.AgentId) | ||
408 | { | ||
409 | // Taking copy of another person's item. Take to | ||
410 | // Objects folder. | ||
411 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); | ||
412 | } | ||
413 | else | ||
414 | { | ||
415 | // Catch all. Use lost & found | ||
416 | // | ||
417 | |||
418 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
419 | } | ||
420 | } | ||
421 | } | ||
422 | |||
423 | // Override and put into where it came from, if it came | ||
424 | // from anywhere in inventory | ||
425 | // | ||
426 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) | ||
427 | { | ||
428 | if (objlist[0].RootPart.FromFolderID != UUID.Zero) | ||
429 | { | ||
430 | InventoryFolderBase f = new InventoryFolderBase(objlist[0].RootPart.FromFolderID, userID); | ||
431 | folder = m_Scene.InventoryService.GetFolder(f); | ||
432 | } | ||
433 | } | ||
434 | |||
435 | if (folder == null) // None of the above | ||
436 | { | ||
437 | folder = new InventoryFolderBase(folderID); | ||
438 | |||
439 | if (folder == null) // Nowhere to put it | ||
440 | { | ||
441 | return UUID.Zero; | ||
442 | } | ||
443 | } | ||
444 | |||
445 | item = new InventoryItemBase(); | ||
446 | // Can't know creator is the same, so null it in inventory | ||
447 | if (objlist.Count > 1) | ||
448 | item.CreatorId = UUID.Zero.ToString(); | ||
449 | else | ||
450 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); | ||
451 | item.ID = UUID.Random(); | ||
452 | item.InvType = (int)InventoryType.Object; | ||
453 | item.Folder = folder.ID; | ||
454 | item.Owner = userID; | ||
455 | if (objlist.Count > 1) | ||
456 | { | ||
457 | item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; | ||
458 | } | ||
459 | else | ||
460 | { | ||
461 | item.SaleType = objlist[0].RootPart.ObjectSaleType; | ||
462 | item.SalePrice = objlist[0].RootPart.SalePrice; | ||
463 | } | ||
464 | } | ||
465 | 293 | ||
466 | AssetBase asset = CreateAsset( | 294 | AssetBase asset = CreateAsset( |
467 | objlist[0].GetPartName(objlist[0].RootPart.LocalId), | 295 | objlist[0].GetPartName(objlist[0].RootPart.LocalId), |
@@ -470,17 +298,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
470 | Utils.StringToBytes(itemXml), | 298 | Utils.StringToBytes(itemXml), |
471 | objlist[0].OwnerID.ToString()); | 299 | objlist[0].OwnerID.ToString()); |
472 | m_Scene.AssetService.Store(asset); | 300 | m_Scene.AssetService.Store(asset); |
473 | assetID = asset.FullID; | 301 | |
302 | item.AssetID = asset.FullID; | ||
303 | assetID = asset.FullID; | ||
474 | 304 | ||
475 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | 305 | if (DeRezAction.SaveToExistingUserInventoryItem == action) |
476 | { | 306 | { |
477 | item.AssetID = asset.FullID; | ||
478 | m_Scene.InventoryService.UpdateItem(item); | 307 | m_Scene.InventoryService.UpdateItem(item); |
479 | } | 308 | } |
480 | else | 309 | else |
481 | { | 310 | { |
482 | item.AssetID = asset.FullID; | ||
483 | |||
484 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; | 311 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; |
485 | foreach (SceneObjectGroup grp in objlist) | 312 | foreach (SceneObjectGroup grp in objlist) |
486 | effectivePerms &= grp.GetEffectivePermissions(); | 313 | effectivePerms &= grp.GetEffectivePermissions(); |
@@ -545,9 +372,156 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
545 | } | 372 | } |
546 | } | 373 | } |
547 | } | 374 | } |
375 | |||
548 | return assetID; | 376 | return assetID; |
549 | } | 377 | } |
378 | |||
379 | /// <summary> | ||
380 | /// Create an item using details for the given scene object. | ||
381 | /// </summary> | ||
382 | /// <param name="action"></param> | ||
383 | /// <param name="remoteClient"></param> | ||
384 | /// <param name="so"></param> | ||
385 | /// <param name="folderID"></param> | ||
386 | /// <returns></returns> | ||
387 | protected InventoryItemBase CreateItemForObject( | ||
388 | DeRezAction action, IClientAPI remoteClient, SceneObjectGroup so, UUID folderID) | ||
389 | { | ||
390 | // Get the user info of the item destination | ||
391 | // | ||
392 | UUID userID = UUID.Zero; | ||
393 | |||
394 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || | ||
395 | action == DeRezAction.SaveToExistingUserInventoryItem) | ||
396 | { | ||
397 | // Take or take copy require a taker | ||
398 | // Saving changes requires a local user | ||
399 | // | ||
400 | if (remoteClient == null) | ||
401 | return null; | ||
402 | |||
403 | userID = remoteClient.AgentId; | ||
404 | } | ||
405 | else | ||
406 | { | ||
407 | // All returns / deletes go to the object owner | ||
408 | // | ||
409 | userID = so.RootPart.OwnerID; | ||
410 | } | ||
411 | |||
412 | if (userID == UUID.Zero) // Can't proceed | ||
413 | { | ||
414 | return null; | ||
415 | } | ||
416 | |||
417 | // If we're returning someone's item, it goes back to the | ||
418 | // owner's Lost And Found folder. | ||
419 | // Delete is treated like return in this case | ||
420 | // Deleting your own items makes them go to trash | ||
421 | // | ||
422 | |||
423 | InventoryFolderBase folder = null; | ||
424 | InventoryItemBase item = null; | ||
425 | |||
426 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | ||
427 | { | ||
428 | item = new InventoryItemBase(so.RootPart.FromUserInventoryItemID, userID); | ||
429 | item = m_Scene.InventoryService.GetItem(item); | ||
430 | |||
431 | //item = userInfo.RootFolder.FindItem( | ||
432 | // objectGroup.RootPart.FromUserInventoryItemID); | ||
433 | |||
434 | if (null == item) | ||
435 | { | ||
436 | m_log.DebugFormat( | ||
437 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", | ||
438 | so.Name, so.UUID); | ||
439 | |||
440 | return null; | ||
441 | } | ||
442 | } | ||
443 | else | ||
444 | { | ||
445 | // Folder magic | ||
446 | // | ||
447 | if (action == DeRezAction.Delete) | ||
448 | { | ||
449 | // Deleting someone else's item | ||
450 | // | ||
451 | if (remoteClient == null || | ||
452 | so.OwnerID != remoteClient.AgentId) | ||
453 | { | ||
454 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
455 | } | ||
456 | else | ||
457 | { | ||
458 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | ||
459 | } | ||
460 | } | ||
461 | else if (action == DeRezAction.Return) | ||
462 | { | ||
463 | // Dump to lost + found unconditionally | ||
464 | // | ||
465 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
466 | } | ||
550 | 467 | ||
468 | if (folderID == UUID.Zero && folder == null) | ||
469 | { | ||
470 | if (action == DeRezAction.Delete) | ||
471 | { | ||
472 | // Deletes go to trash by default | ||
473 | // | ||
474 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | ||
475 | } | ||
476 | else | ||
477 | { | ||
478 | if (remoteClient == null || so.OwnerID != remoteClient.AgentId) | ||
479 | { | ||
480 | // Taking copy of another person's item. Take to | ||
481 | // Objects folder. | ||
482 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); | ||
483 | } | ||
484 | else | ||
485 | { | ||
486 | // Catch all. Use lost & found | ||
487 | // | ||
488 | |||
489 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
490 | } | ||
491 | } | ||
492 | } | ||
493 | |||
494 | // Override and put into where it came from, if it came | ||
495 | // from anywhere in inventory | ||
496 | // | ||
497 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) | ||
498 | { | ||
499 | if (so.RootPart.FromFolderID != UUID.Zero) | ||
500 | { | ||
501 | InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID); | ||
502 | folder = m_Scene.InventoryService.GetFolder(f); | ||
503 | } | ||
504 | } | ||
505 | |||
506 | if (folder == null) // None of the above | ||
507 | { | ||
508 | folder = new InventoryFolderBase(folderID); | ||
509 | |||
510 | if (folder == null) // Nowhere to put it | ||
511 | { | ||
512 | return null; | ||
513 | } | ||
514 | } | ||
515 | |||
516 | item = new InventoryItemBase(); | ||
517 | item.ID = UUID.Random(); | ||
518 | item.InvType = (int)InventoryType.Object; | ||
519 | item.Folder = folder.ID; | ||
520 | item.Owner = userID; | ||
521 | } | ||
522 | |||
523 | return item; | ||
524 | } | ||
551 | 525 | ||
552 | /// <summary> | 526 | /// <summary> |
553 | /// Rez an object into the scene from the user's inventory | 527 | /// Rez an object into the scene from the user's inventory |
@@ -659,9 +633,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
659 | itemId, n.OuterXml); | 633 | itemId, n.OuterXml); |
660 | objlist.Add(g); | 634 | objlist.Add(g); |
661 | XmlElement el = (XmlElement)n; | 635 | XmlElement el = (XmlElement)n; |
662 | float x = Convert.ToSingle(el.GetAttribute("offsetx")); | 636 | |
663 | float y = Convert.ToSingle(el.GetAttribute("offsety")); | 637 | string rawX = el.GetAttribute("offsetx"); |
664 | float z = Convert.ToSingle(el.GetAttribute("offsetz")); | 638 | string rawY = el.GetAttribute("offsety"); |
639 | string rawZ = el.GetAttribute("offsetz"); | ||
640 | // | ||
641 | // m_log.DebugFormat( | ||
642 | // "[INVENTORY ACCESS MODULE]: Converting coalesced object {0} offset <{1}, {2}, {3}>", | ||
643 | // g.Name, rawX, rawY, rawZ); | ||
644 | |||
645 | float x = Convert.ToSingle(rawX); | ||
646 | float y = Convert.ToSingle(rawY); | ||
647 | float z = Convert.ToSingle(rawZ); | ||
665 | veclist.Add(new Vector3(x, y, z)); | 648 | veclist.Add(new Vector3(x, y, z)); |
666 | } | 649 | } |
667 | } | 650 | } |
@@ -753,10 +736,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
753 | // affect the name stored in the serialization, transfer | 736 | // affect the name stored in the serialization, transfer |
754 | // the correct name from the inventory to the | 737 | // the correct name from the inventory to the |
755 | // object itself before we rez. | 738 | // object itself before we rez. |
756 | rootPart.Name = item.Name; | 739 | // |
757 | rootPart.Description = item.Description; | 740 | // Only do these for the first object if we are rezzing a coalescence. |
758 | rootPart.ObjectSaleType = item.SaleType; | 741 | if (i == 0) |
759 | rootPart.SalePrice = item.SalePrice; | 742 | { |
743 | rootPart.Name = item.Name; | ||
744 | rootPart.Description = item.Description; | ||
745 | rootPart.ObjectSaleType = item.SaleType; | ||
746 | rootPart.SalePrice = item.SalePrice; | ||
747 | } | ||
760 | 748 | ||
761 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); | 749 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); |
762 | if ((rootPart.OwnerID != item.Owner) || | 750 | 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..8d53cf1 --- /dev/null +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs | |||
@@ -0,0 +1,174 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | using System.Threading; | ||
33 | using Nini.Config; | ||
34 | using NUnit.Framework; | ||
35 | using OpenMetaverse; | ||
36 | using OpenSim.Data; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Serialization; | ||
39 | using OpenSim.Framework.Serialization.External; | ||
40 | using OpenSim.Framework.Communications; | ||
41 | using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; | ||
42 | using OpenSim.Region.CoreModules.Framework.InventoryAccess; | ||
43 | using OpenSim.Region.Framework.Scenes; | ||
44 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
45 | using OpenSim.Services.Interfaces; | ||
46 | using OpenSim.Tests.Common; | ||
47 | using OpenSim.Tests.Common.Mock; | ||
48 | using OpenSim.Tests.Common.Setup; | ||
49 | |||
50 | namespace 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(); | ||
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 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object1", 0x20); | ||
91 | object1.AbsolutePosition = new Vector3(15, 30, 45); | ||
92 | |||
93 | SceneObjectGroup object2 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object2", 0x40); | ||
94 | object2.AbsolutePosition = new Vector3(25, 50, 75); | ||
95 | |||
96 | CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2); | ||
97 | |||
98 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); | ||
99 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, coa); | ||
100 | m_scene.AssetService.Store(asset1); | ||
101 | |||
102 | // Create item | ||
103 | UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080"); | ||
104 | string item1Name = "My Little Dog"; | ||
105 | InventoryItemBase item1 = new InventoryItemBase(); | ||
106 | item1.Name = item1Name; | ||
107 | item1.AssetID = asset1.FullID; | ||
108 | item1.ID = item1Id; | ||
109 | InventoryFolderBase objsFolder | ||
110 | = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, m_userId, "Objects")[0]; | ||
111 | item1.Folder = objsFolder.ID; | ||
112 | m_scene.AddInventoryItem(item1); | ||
113 | |||
114 | SceneObjectGroup so | ||
115 | = m_iam.RezObject( | ||
116 | m_tc, item1Id, new Vector3(100, 100, 100), Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false); | ||
117 | |||
118 | Assert.That(so, Is.Not.Null); | ||
119 | |||
120 | Assert.That(m_scene.SceneGraph.GetTotalObjectsCount(), Is.EqualTo(2)); | ||
121 | |||
122 | SceneObjectPart retrievedObj1Part = m_scene.GetSceneObjectPart(object1.Name); | ||
123 | Assert.That(retrievedObj1Part, Is.Null); | ||
124 | |||
125 | retrievedObj1Part = m_scene.GetSceneObjectPart(item1.Name); | ||
126 | Assert.That(retrievedObj1Part, Is.Not.Null); | ||
127 | Assert.That(retrievedObj1Part.Name, Is.EqualTo(item1.Name)); | ||
128 | |||
129 | // Bottom of coalescence is placed on ground, hence we end up with 100.5 rather than 85 since the bottom | ||
130 | // object is unit square. | ||
131 | Assert.That(retrievedObj1Part.AbsolutePosition, Is.EqualTo(new Vector3(95, 90, 100.5f))); | ||
132 | |||
133 | SceneObjectPart retrievedObj2Part = m_scene.GetSceneObjectPart(object2.Name); | ||
134 | Assert.That(retrievedObj2Part, Is.Not.Null); | ||
135 | Assert.That(retrievedObj2Part.Name, Is.EqualTo(object2.Name)); | ||
136 | Assert.That(retrievedObj2Part.AbsolutePosition, Is.EqualTo(new Vector3(105, 110, 130.5f))); | ||
137 | } | ||
138 | |||
139 | [Test] | ||
140 | public void TestRezObject() | ||
141 | { | ||
142 | TestHelper.InMethod(); | ||
143 | // log4net.Config.XmlConfigurator.Configure(); | ||
144 | |||
145 | // Create asset | ||
146 | SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "My Little Dog Object", 0x40); | ||
147 | |||
148 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); | ||
149 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); | ||
150 | m_scene.AssetService.Store(asset1); | ||
151 | |||
152 | // Create item | ||
153 | UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080"); | ||
154 | string item1Name = "My Little Dog"; | ||
155 | InventoryItemBase item1 = new InventoryItemBase(); | ||
156 | item1.Name = item1Name; | ||
157 | item1.AssetID = asset1.FullID; | ||
158 | item1.ID = item1Id; | ||
159 | InventoryFolderBase objsFolder | ||
160 | = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, m_userId, "Objects")[0]; | ||
161 | item1.Folder = objsFolder.ID; | ||
162 | m_scene.AddInventoryItem(item1); | ||
163 | |||
164 | SceneObjectGroup so | ||
165 | = m_iam.RezObject( | ||
166 | m_tc, item1Id, Vector3.Zero, Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false); | ||
167 | |||
168 | Assert.That(so, Is.Not.Null); | ||
169 | |||
170 | SceneObjectPart retrievedPart = m_scene.GetSceneObjectPart(so.UUID); | ||
171 | Assert.That(retrievedPart, Is.Not.Null); | ||
172 | } | ||
173 | } | ||
174 | } \ 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; | |||
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers.HttpServer; | ||
35 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Server.Base; | 36 | using 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; | |||
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers.HttpServer; | ||
35 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Server.Base; | 36 | using 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; | |||
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers.HttpServer; | ||
35 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Server.Base; | 36 | using 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; | |||
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers.HttpServer; | ||
35 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Server.Base; | 36 | using 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; | |||
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers.HttpServer; | ||
35 | using OpenSim.Region.Framework.Scenes; | ||
36 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
35 | using OpenSim.Region.Framework.Scenes; | ||
37 | using OpenSim.Server.Base; | 36 | using OpenSim.Server.Base; |
38 | using OpenSim.Server.Handlers.Base; | 37 | using 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; | |||
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers.HttpServer; | ||
35 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Server.Base; | 36 | using 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; | |||
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers.HttpServer; | ||
35 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Server.Base; | 36 | using 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; | |||
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers.HttpServer; | ||
35 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Server.Base; | 36 | using 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; | |||
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers.HttpServer; | ||
35 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Server.Base; | 36 | using OpenSim.Server.Base; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index 1b3419d..51d1d59 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs | |||
@@ -195,6 +195,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
195 | 195 | ||
196 | public byte[] GetData(string id) | 196 | public byte[] GetData(string id) |
197 | { | 197 | { |
198 | // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Requesting data for asset {0}", id); | ||
199 | |||
198 | AssetBase asset = m_Cache.Get(id); | 200 | AssetBase asset = m_Cache.Get(id); |
199 | 201 | ||
200 | if (asset != null) | 202 | if (asset != null) |
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/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index dafaa0c..a866fd9 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs | |||
@@ -237,7 +237,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | |||
237 | public void Init() | 237 | public void Init() |
238 | { | 238 | { |
239 | m_serialiserModule = new SerialiserModule(); | 239 | m_serialiserModule = new SerialiserModule(); |
240 | m_scene = SceneSetupHelpers.SetupScene(""); | 240 | m_scene = SceneSetupHelpers.SetupScene(); |
241 | SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule); | 241 | SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule); |
242 | } | 242 | } |
243 | 243 | ||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Linq; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace 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/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 4694e2b..e3ed905 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs | |||
@@ -166,7 +166,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
166 | ScenePresence presence = m_scene.GetScenePresence(client.AgentId); | 166 | ScenePresence presence = m_scene.GetScenePresence(client.AgentId); |
167 | if (presence == null) | 167 | if (presence == null) |
168 | { | 168 | { |
169 | m_log.WarnFormat("[PRIORITIZER] attempt to use agent {0} not in the scene",client.AgentId); | 169 | // this shouldn't happen, it basically means that we are prioritizing |
170 | // updates to send to a client that doesn't have a presence in the scene | ||
171 | // seems like there's race condition here... | ||
172 | |||
173 | // m_log.WarnFormat("[PRIORITIZER] attempt to use agent {0} not in the scene",client.AgentId); | ||
170 | // throw new InvalidOperationException("Prioritization agent not defined"); | 174 | // throw new InvalidOperationException("Prioritization agent not defined"); |
171 | return Int32.MaxValue; | 175 | return Int32.MaxValue; |
172 | } | 176 | } |
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/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index ca7d9d9..9bb50db 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -296,11 +296,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
296 | { | 296 | { |
297 | Vector3 val = value; | 297 | Vector3 val = value; |
298 | 298 | ||
299 | if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) | 299 | if (Scene != null) |
300 | || m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) | ||
301 | && !IsAttachmentCheckFull() && (!m_scene.LoadingPrims)) | ||
302 | { | 300 | { |
303 | m_scene.CrossPrimGroupIntoNewRegion(val, this, true); | 301 | if ((Scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || Scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) |
302 | || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) | ||
303 | && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) | ||
304 | { | ||
305 | m_scene.CrossPrimGroupIntoNewRegion(val, this, true); | ||
306 | } | ||
304 | } | 307 | } |
305 | 308 | ||
306 | if (RootPart.GetStatusSandbox()) | 309 | if (RootPart.GetStatusSandbox()) |
@@ -308,8 +311,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
308 | if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) | 311 | if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10) |
309 | { | 312 | { |
310 | RootPart.ScriptSetPhysicsStatus(false); | 313 | RootPart.ScriptSetPhysicsStatus(false); |
311 | Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), | 314 | |
312 | ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); | 315 | if (Scene != null) |
316 | Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"), | ||
317 | ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); | ||
318 | |||
313 | return; | 319 | return; |
314 | } | 320 | } |
315 | } | 321 | } |
@@ -326,7 +332,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
326 | //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); | 332 | //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); |
327 | //} | 333 | //} |
328 | 334 | ||
329 | m_scene.EventManager.TriggerParcelPrimCountTainted(); | 335 | if (Scene != null) |
336 | Scene.EventManager.TriggerParcelPrimCountTainted(); | ||
330 | } | 337 | } |
331 | } | 338 | } |
332 | 339 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4d5eedf..ce1e6b8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2088,7 +2088,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2088 | 2088 | ||
2089 | axPos *= parentRot; | 2089 | axPos *= parentRot; |
2090 | Vector3 translationOffsetPosition = axPos; | 2090 | Vector3 translationOffsetPosition = axPos; |
2091 | return GroupPosition + translationOffsetPosition; | 2091 | |
2092 | // m_log.DebugFormat("[SCENE OBJECT PART]: Found group pos {0} for part {1}", GroupPosition, Name); | ||
2093 | |||
2094 | Vector3 worldPos = GroupPosition + translationOffsetPosition; | ||
2095 | |||
2096 | // m_log.DebugFormat("[SCENE OBJECT PART]: Found world pos {0} for part {1}", worldPos, Name); | ||
2097 | |||
2098 | return worldPos; | ||
2092 | } | 2099 | } |
2093 | 2100 | ||
2094 | /// <summary> | 2101 | /// <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..babcb54 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs | |||
@@ -0,0 +1,149 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Drawing; | ||
31 | using System.IO; | ||
32 | using System.Reflection; | ||
33 | using System.Xml; | ||
34 | using log4net; | ||
35 | using OpenMetaverse; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Region.Framework.Interfaces; | ||
38 | using OpenSim.Region.Framework.Scenes; | ||
39 | |||
40 | namespace 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 | using (StringWriter sw = new StringWriter()) | ||
60 | { | ||
61 | using (XmlTextWriter writer = new XmlTextWriter(sw)) | ||
62 | { | ||
63 | Vector3 size; | ||
64 | |||
65 | List<SceneObjectGroup> coaObjects = coa.Objects; | ||
66 | |||
67 | // m_log.DebugFormat( | ||
68 | // "[COALESCED SCENE OBJECTS SERIALIZER]: Writing {0} objects for coalesced object", | ||
69 | // coaObjects.Count); | ||
70 | |||
71 | // This is weak - we're relying on the set of coalesced objects still being identical | ||
72 | Vector3[] offsets = coa.GetSizeAndOffsets(out size); | ||
73 | |||
74 | writer.WriteStartElement("CoalescedObject"); | ||
75 | |||
76 | writer.WriteAttributeString("x", size.X.ToString()); | ||
77 | writer.WriteAttributeString("y", size.Y.ToString()); | ||
78 | writer.WriteAttributeString("z", size.Z.ToString()); | ||
79 | |||
80 | // Embed the offsets into the group XML | ||
81 | for (int i = 0; i < coaObjects.Count; i++) | ||
82 | { | ||
83 | SceneObjectGroup obj = coaObjects[i]; | ||
84 | |||
85 | // m_log.DebugFormat( | ||
86 | // "[COALESCED SCENE OBJECTS SERIALIZER]: Writing offset for object {0}, {1}", | ||
87 | // i, obj.Name); | ||
88 | |||
89 | writer.WriteStartElement("SceneObjectGroup"); | ||
90 | writer.WriteAttributeString("offsetx", offsets[i].X.ToString()); | ||
91 | writer.WriteAttributeString("offsety", offsets[i].Y.ToString()); | ||
92 | writer.WriteAttributeString("offsetz", offsets[i].Z.ToString()); | ||
93 | |||
94 | SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, true); | ||
95 | |||
96 | writer.WriteEndElement(); // SceneObjectGroup | ||
97 | } | ||
98 | |||
99 | writer.WriteEndElement(); // CoalescedObject | ||
100 | } | ||
101 | |||
102 | string output = sw.ToString(); | ||
103 | |||
104 | // Console.WriteLine(output); | ||
105 | |||
106 | return output; | ||
107 | } | ||
108 | } | ||
109 | |||
110 | public static bool TryFromXml(string xml, out CoalescedSceneObjects coa) | ||
111 | { | ||
112 | // m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml); | ||
113 | |||
114 | coa = null; | ||
115 | |||
116 | using (StringReader sr = new StringReader(xml)) | ||
117 | { | ||
118 | using (XmlTextReader reader = new XmlTextReader(sr)) | ||
119 | { | ||
120 | reader.Read(); | ||
121 | if (reader.Name != "CoalescedObject") | ||
122 | { | ||
123 | // m_log.DebugFormat( | ||
124 | // "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false", | ||
125 | // reader.Name); | ||
126 | |||
127 | return false; | ||
128 | } | ||
129 | |||
130 | coa = new CoalescedSceneObjects(UUID.Zero); | ||
131 | reader.Read(); | ||
132 | |||
133 | while (reader.NodeType != XmlNodeType.EndElement && reader.Name != "CoalescedObject") | ||
134 | { | ||
135 | if (reader.Name == "SceneObjectGroup") | ||
136 | { | ||
137 | string soXml = reader.ReadOuterXml(); | ||
138 | coa.Add(SceneObjectSerializer.FromOriginalXmlFormat(soXml)); | ||
139 | } | ||
140 | } | ||
141 | |||
142 | reader.ReadEndElement(); // CoalescedObject | ||
143 | } | ||
144 | } | ||
145 | |||
146 | return true; | ||
147 | } | ||
148 | } | ||
149 | } \ 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/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs index 8588f7f..dd28416 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs | |||
@@ -117,11 +117,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
117 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); | 117 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); |
118 | 118 | ||
119 | 119 | ||
120 | Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, "grid"); | 120 | Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010); |
121 | SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); | 121 | SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); |
122 | sceneB.RegisterRegionWithGrid(); | 122 | sceneB.RegisterRegionWithGrid(); |
123 | 123 | ||
124 | Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, "grid"); | 124 | Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000); |
125 | SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); | 125 | SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); |
126 | sceneA.RegisterRegionWithGrid(); | 126 | sceneA.RegisterRegionWithGrid(); |
127 | 127 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index 8138bcc..2aef4b0 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | |||
@@ -101,7 +101,7 @@ namespace OpenSim.Region.Framework.Tests | |||
101 | TestHelper.InMethod(); | 101 | TestHelper.InMethod(); |
102 | // log4net.Config.XmlConfigurator.Configure(); | 102 | // log4net.Config.XmlConfigurator.Configure(); |
103 | 103 | ||
104 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 104 | Scene scene = SceneSetupHelpers.SetupScene(); |
105 | UserAccount user1 = CreateUser(scene); | 105 | UserAccount user1 = CreateUser(scene); |
106 | SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID); | 106 | SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID); |
107 | SceneObjectPart sop1 = sog1.RootPart; | 107 | SceneObjectPart sop1 = sog1.RootPart; |
@@ -127,7 +127,7 @@ namespace OpenSim.Region.Framework.Tests | |||
127 | TestHelper.InMethod(); | 127 | TestHelper.InMethod(); |
128 | // log4net.Config.XmlConfigurator.Configure(); | 128 | // log4net.Config.XmlConfigurator.Configure(); |
129 | 129 | ||
130 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 130 | Scene scene = SceneSetupHelpers.SetupScene(); |
131 | UserAccount user1 = CreateUser(scene); | 131 | UserAccount user1 = CreateUser(scene); |
132 | SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID); | 132 | SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID); |
133 | SceneObjectPart sop1 = sog1.RootPart; | 133 | SceneObjectPart sop1 = sog1.RootPart; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index 6b70865..dbf9e0f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | |||
@@ -47,7 +47,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
47 | [SetUp] | 47 | [SetUp] |
48 | public void Init() | 48 | public void Init() |
49 | { | 49 | { |
50 | m_assetService = new MockAssetService(); | 50 | // FIXME: We don't need a full scene here - it would be enough to set up the asset service. |
51 | Scene scene = SceneSetupHelpers.SetupScene(); | ||
52 | m_assetService = scene.AssetService; | ||
51 | m_uuidGatherer = new UuidGatherer(m_assetService); | 53 | m_uuidGatherer = new UuidGatherer(m_assetService); |
52 | } | 54 | } |
53 | 55 | ||
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/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index a81af43..e1f90b6 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs | |||
@@ -89,6 +89,8 @@ namespace OpenSim.Services.AssetService | |||
89 | 89 | ||
90 | public virtual AssetBase Get(string id) | 90 | public virtual AssetBase Get(string id) |
91 | { | 91 | { |
92 | // m_log.DebugFormat("[ASSET SERVICE]: Get asset for {0}", id); | ||
93 | |||
92 | UUID assetID; | 94 | UUID assetID; |
93 | 95 | ||
94 | if (!UUID.TryParse(id, out assetID)) | 96 | if (!UUID.TryParse(id, out assetID)) |
@@ -107,6 +109,8 @@ namespace OpenSim.Services.AssetService | |||
107 | 109 | ||
108 | public virtual AssetMetadata GetMetadata(string id) | 110 | public virtual AssetMetadata GetMetadata(string id) |
109 | { | 111 | { |
112 | // m_log.DebugFormat("[ASSET SERVICE]: Get asset metadata for {0}", id); | ||
113 | |||
110 | UUID assetID; | 114 | UUID assetID; |
111 | 115 | ||
112 | if (!UUID.TryParse(id, out assetID)) | 116 | if (!UUID.TryParse(id, out assetID)) |
@@ -121,6 +125,8 @@ namespace OpenSim.Services.AssetService | |||
121 | 125 | ||
122 | public virtual byte[] GetData(string id) | 126 | public virtual byte[] GetData(string id) |
123 | { | 127 | { |
128 | // m_log.DebugFormat("[ASSET SERVICE]: Get asset data for {0}", id); | ||
129 | |||
124 | UUID assetID; | 130 | UUID assetID; |
125 | 131 | ||
126 | if (!UUID.TryParse(id, out assetID)) | 132 | if (!UUID.TryParse(id, out assetID)) |
@@ -150,7 +156,9 @@ namespace OpenSim.Services.AssetService | |||
150 | 156 | ||
151 | public virtual string Store(AssetBase asset) | 157 | public virtual string Store(AssetBase asset) |
152 | { | 158 | { |
153 | //m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID); | 159 | // m_log.DebugFormat( |
160 | // "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.ID, asset.Data.Length); | ||
161 | |||
154 | m_Database.StoreAsset(asset); | 162 | m_Database.StoreAsset(asset); |
155 | 163 | ||
156 | return asset.ID; | 164 | return asset.ID; |
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; | |||
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
36 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
37 | using OpenSim.Framework.Servers.HttpServer; | ||
38 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
39 | using OpenMetaverse; | 38 | using 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; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
38 | using OpenSim.Server.Base; | 37 | using OpenSim.Server.Base; |
39 | using OpenMetaverse; | 38 | using 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; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
38 | using OpenMetaverse; | 37 | using 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; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
39 | using IAvatarService = OpenSim.Services.Interfaces.IAvatarService; | 38 | using 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; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
38 | using OpenSim.Server.Base; | 37 | using OpenSim.Server.Base; |
39 | using OpenMetaverse; | 38 | using 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; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
38 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | 37 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; |
39 | using OpenSim.Server.Base; | 38 | using 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; | |||
32 | using OpenSim.Services.Interfaces; | 32 | using OpenSim.Services.Interfaces; |
33 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 33 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
34 | using OpenSim.Server.Base; | 34 | using OpenSim.Server.Base; |
35 | using OpenSim.Framework.Servers.HttpServer; | 35 | using OpenSim.Framework; |
36 | 36 | ||
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | using log4net; | 38 | using 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; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
39 | using OpenSim.Server.Base; | 38 | using 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; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
39 | using OpenSim.Server.Base; | 38 | using 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; | |||
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
36 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
37 | using OpenSim.Framework.Servers.HttpServer; | ||
38 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
39 | using OpenSim.Server.Base; | 38 | using OpenSim.Server.Base; |
40 | using OpenMetaverse; | 39 | using 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; | |||
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
37 | using OpenSim.Framework.Servers.HttpServer; | ||
38 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
39 | using OpenMetaverse; | 38 | using OpenMetaverse; |
40 | using Nwc.XmlRpc; | 39 | using 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; | |||
36 | using Nini.Config; | 36 | using Nini.Config; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Servers.HttpServer; | ||
40 | using OpenSim.Services.Interfaces; | 39 | using OpenSim.Services.Interfaces; |
41 | using OpenMetaverse; | 40 | using OpenMetaverse; |
42 | using OpenMetaverse.StructuredData; | 41 | using 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; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 37 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
39 | using OpenSim.Server.Base; | 38 | using 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; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.Servers.HttpServer; | ||
37 | using OpenSim.Server.Base; | 36 | using OpenSim.Server.Base; |
38 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
39 | using OpenMetaverse; | 38 | using OpenMetaverse; |
diff --git a/OpenSim/Services/Interfaces/IAssetService.cs b/OpenSim/Services/Interfaces/IAssetService.cs index 3be6815..1ac1cec 100644 --- a/OpenSim/Services/Interfaces/IAssetService.cs +++ b/OpenSim/Services/Interfaces/IAssetService.cs | |||
@@ -48,6 +48,11 @@ namespace OpenSim.Services.Interfaces | |||
48 | /// <returns></returns> | 48 | /// <returns></returns> |
49 | AssetMetadata GetMetadata(string id); | 49 | AssetMetadata GetMetadata(string id); |
50 | 50 | ||
51 | /// <summary> | ||
52 | /// Get an asset's data, ignoring the metadata. | ||
53 | /// </summary> | ||
54 | /// <param name="id"></param> | ||
55 | /// <returns>null if there is no such asset</returns> | ||
51 | byte[] GetData(string id); | 56 | byte[] GetData(string id); |
52 | 57 | ||
53 | /// <summary> | 58 | /// <summary> |
diff --git a/OpenSim/Tests/Common/Mock/MockAssetService.cs b/OpenSim/Tests/Common/Mock/MockAssetService.cs deleted file mode 100644 index 4118308..0000000 --- a/OpenSim/Tests/Common/Mock/MockAssetService.cs +++ /dev/null | |||
@@ -1,109 +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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using log4net; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Data; | ||
35 | using OpenSim.Services.Interfaces; | ||
36 | using Nini.Config; | ||
37 | |||
38 | namespace OpenSim.Tests.Common.Mock | ||
39 | { | ||
40 | public class MockAssetService : IAssetService | ||
41 | { | ||
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
44 | private readonly Dictionary<string, AssetBase> Assets = new Dictionary<string, AssetBase>(); | ||
45 | |||
46 | public MockAssetService() {} | ||
47 | |||
48 | /// <summary> | ||
49 | /// This constructor is required if the asset service is being created reflectively (which is the case in some | ||
50 | /// tests). | ||
51 | /// </summary> | ||
52 | /// <param name="config"></param> | ||
53 | public MockAssetService(IConfigSource config) {} | ||
54 | |||
55 | public AssetBase Get(string id) | ||
56 | { | ||
57 | m_log.DebugFormat("[MOCK ASSET SERVICE]: Getting asset with id {0}", id); | ||
58 | |||
59 | AssetBase asset; | ||
60 | if (Assets.ContainsKey(id)) | ||
61 | asset = Assets[id]; | ||
62 | else | ||
63 | asset = null; | ||
64 | |||
65 | return asset; | ||
66 | } | ||
67 | |||
68 | public AssetBase GetCached(string id) | ||
69 | { | ||
70 | return Get(id); | ||
71 | } | ||
72 | |||
73 | public AssetMetadata GetMetadata(string id) | ||
74 | { | ||
75 | throw new System.NotImplementedException(); | ||
76 | } | ||
77 | |||
78 | public byte[] GetData(string id) | ||
79 | { | ||
80 | throw new System.NotImplementedException(); | ||
81 | } | ||
82 | |||
83 | public bool Get(string id, object sender, AssetRetrieved handler) | ||
84 | { | ||
85 | handler(id, sender, Get(id)); | ||
86 | |||
87 | return true; | ||
88 | } | ||
89 | |||
90 | public string Store(AssetBase asset) | ||
91 | { | ||
92 | m_log.DebugFormat("[MOCK ASSET SERVICE]: Storing asset {0}", asset.ID); | ||
93 | |||
94 | Assets[asset.ID] = asset; | ||
95 | |||
96 | return asset.ID; | ||
97 | } | ||
98 | |||
99 | public bool UpdateContent(string id, byte[] data) | ||
100 | { | ||
101 | throw new System.NotImplementedException(); | ||
102 | } | ||
103 | |||
104 | public bool Delete(string id) | ||
105 | { | ||
106 | throw new System.NotImplementedException(); | ||
107 | } | ||
108 | } | ||
109 | } \ No newline at end of file | ||
diff --git a/OpenSim/Tests/Common/Mock/MockInventoryService.cs b/OpenSim/Tests/Common/Mock/MockInventoryService.cs deleted file mode 100644 index 4ac1078..0000000 --- a/OpenSim/Tests/Common/Mock/MockInventoryService.cs +++ /dev/null | |||
@@ -1,186 +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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Services.Interfaces; | ||
34 | using Nini.Config; | ||
35 | |||
36 | namespace OpenSim.Tests.Common.Mock | ||
37 | { | ||
38 | public class MockInventoryService : IInventoryService | ||
39 | { | ||
40 | public MockInventoryService() {} | ||
41 | |||
42 | public MockInventoryService(IConfigSource config) {} | ||
43 | |||
44 | /// <summary> | ||
45 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
46 | /// </summary> | ||
47 | /// <param name="userId"></param> | ||
48 | /// <returns></returns> | ||
49 | public bool CreateUserInventory(UUID userId) | ||
50 | { | ||
51 | return false; | ||
52 | } | ||
53 | |||
54 | /// <summary> | ||
55 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
56 | /// </summary> | ||
57 | /// <param name="userId"></param> | ||
58 | /// <returns></returns> | ||
59 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
60 | { | ||
61 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | ||
62 | InventoryFolderBase folder = new InventoryFolderBase(); | ||
63 | folder.ID = UUID.Random(); | ||
64 | folder.Owner = userId; | ||
65 | folders.Add(folder); | ||
66 | return folders; | ||
67 | } | ||
68 | |||
69 | public InventoryFolderBase GetRootFolder(UUID userID) | ||
70 | { | ||
71 | return new InventoryFolderBase(); | ||
72 | } | ||
73 | |||
74 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | ||
75 | { | ||
76 | return null; | ||
77 | } | ||
78 | |||
79 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
80 | { | ||
81 | return null; | ||
82 | } | ||
83 | |||
84 | /// <summary> | ||
85 | /// Returns a list of all the active gestures in a user's inventory. | ||
86 | /// </summary> | ||
87 | /// <param name="userId"> | ||
88 | /// The <see cref="UUID"/> of the user | ||
89 | /// </param> | ||
90 | /// <returns> | ||
91 | /// A flat list of the gesture items. | ||
92 | /// </returns> | ||
93 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
94 | { | ||
95 | return null; | ||
96 | } | ||
97 | |||
98 | public InventoryCollection GetUserInventory(UUID userID) | ||
99 | { | ||
100 | return null; | ||
101 | } | ||
102 | |||
103 | public void GetUserInventory(UUID userID, OpenSim.Services.Interfaces.InventoryReceiptCallback callback) | ||
104 | { | ||
105 | } | ||
106 | |||
107 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
108 | { | ||
109 | return null; | ||
110 | } | ||
111 | |||
112 | public bool AddFolder(InventoryFolderBase folder) | ||
113 | { | ||
114 | return false; | ||
115 | } | ||
116 | |||
117 | public bool UpdateFolder(InventoryFolderBase folder) | ||
118 | { | ||
119 | return false; | ||
120 | } | ||
121 | |||
122 | public bool MoveFolder(InventoryFolderBase folder) | ||
123 | { | ||
124 | return false; | ||
125 | } | ||
126 | |||
127 | public bool DeleteFolders(UUID ownerID, List<UUID> ids) | ||
128 | { | ||
129 | return false; | ||
130 | } | ||
131 | |||
132 | public bool PurgeFolder(InventoryFolderBase folder) | ||
133 | { | ||
134 | return false; | ||
135 | } | ||
136 | |||
137 | public bool AddItem(InventoryItemBase item) | ||
138 | { | ||
139 | return true; | ||
140 | } | ||
141 | |||
142 | public bool UpdateItem(InventoryItemBase item) | ||
143 | { | ||
144 | return false; | ||
145 | } | ||
146 | |||
147 | public bool MoveItems(UUID ownerID, List<InventoryItemBase> items) | ||
148 | { | ||
149 | return false; | ||
150 | } | ||
151 | |||
152 | public bool DeleteItems(UUID ownerID, List<UUID> itemIDs) | ||
153 | { | ||
154 | return false; | ||
155 | } | ||
156 | |||
157 | public InventoryItemBase GetItem(InventoryItemBase item) | ||
158 | { | ||
159 | return null; | ||
160 | } | ||
161 | |||
162 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | ||
163 | { | ||
164 | return null; | ||
165 | } | ||
166 | |||
167 | public bool HasInventoryForUser(UUID userID) | ||
168 | { | ||
169 | return false; | ||
170 | } | ||
171 | |||
172 | public InventoryFolderBase RequestRootFolder(UUID userID) | ||
173 | { | ||
174 | InventoryFolderBase root = new InventoryFolderBase(); | ||
175 | root.ID = UUID.Random(); | ||
176 | root.Owner = userID; | ||
177 | root.ParentID = UUID.Zero; | ||
178 | return root; | ||
179 | } | ||
180 | |||
181 | public int GetAssetPermissions(UUID userID, UUID assetID) | ||
182 | { | ||
183 | return 1; | ||
184 | } | ||
185 | } | ||
186 | } \ No newline at end of file | ||
diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs index ff4423f..d572249 100644 --- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs +++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs | |||
@@ -30,6 +30,7 @@ using OpenMetaverse; | |||
30 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenSim.Region.Framework.Scenes; | 31 | using OpenSim.Region.Framework.Scenes; |
32 | using OpenSim.Region.Framework.Scenes.Serialization; | 32 | using OpenSim.Region.Framework.Scenes.Serialization; |
33 | using OpenSim.Services.Interfaces; | ||
33 | 34 | ||
34 | namespace OpenSim.Tests.Common | 35 | namespace OpenSim.Tests.Common |
35 | { | 36 | { |
@@ -55,7 +56,7 @@ namespace OpenSim.Tests.Common | |||
55 | AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId); | 56 | AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId); |
56 | scene.AssetService.Store(asset); | 57 | scene.AssetService.Store(asset); |
57 | return asset; | 58 | return asset; |
58 | } | 59 | } |
59 | 60 | ||
60 | /// <summary> | 61 | /// <summary> |
61 | /// Create an asset from the given scene object. | 62 | /// Create an asset from the given scene object. |
@@ -71,6 +72,35 @@ namespace OpenSim.Tests.Common | |||
71 | Encoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)), | 72 | Encoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)), |
72 | sog.OwnerID); | 73 | sog.OwnerID); |
73 | } | 74 | } |
75 | |||
76 | /// <summary> | ||
77 | /// Create an asset from the given scene object. | ||
78 | /// </summary> | ||
79 | /// <param name="assetUuidTailZ"> | ||
80 | /// The hexadecimal last part of the UUID for the asset created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}" | ||
81 | /// will be used. | ||
82 | /// </param> | ||
83 | /// <param name="coa"></param> | ||
84 | /// <returns></returns> | ||
85 | public static AssetBase CreateAsset(int assetUuidTail, CoalescedSceneObjects coa) | ||
86 | { | ||
87 | return CreateAsset(new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", assetUuidTail)), coa); | ||
88 | } | ||
89 | |||
90 | /// <summary> | ||
91 | /// Create an asset from the given scene object. | ||
92 | /// </summary> | ||
93 | /// <param name="assetUuid"></param> | ||
94 | /// <param name="coa"></param> | ||
95 | /// <returns></returns> | ||
96 | public static AssetBase CreateAsset(UUID assetUuid, CoalescedSceneObjects coa) | ||
97 | { | ||
98 | return CreateAsset( | ||
99 | assetUuid, | ||
100 | AssetType.Object, | ||
101 | Encoding.ASCII.GetBytes(CoalescedSceneObjectsSerializer.ToXml(coa)), | ||
102 | coa.CreatorId); | ||
103 | } | ||
74 | 104 | ||
75 | /// <summary> | 105 | /// <summary> |
76 | /// Create an asset from the given data. | 106 | /// Create an asset from the given data. |
@@ -89,5 +119,11 @@ namespace OpenSim.Tests.Common | |||
89 | asset.Data = data; | 119 | asset.Data = data; |
90 | return asset; | 120 | return asset; |
91 | } | 121 | } |
122 | |||
123 | public static string ReadAssetAsString(IAssetService assetService, UUID uuid) | ||
124 | { | ||
125 | byte[] assetData = assetService.GetData(uuid.ToString()); | ||
126 | return Encoding.ASCII.GetString(assetData); | ||
127 | } | ||
92 | } | 128 | } |
93 | } | 129 | } |
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 709dd78..99517d2 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | |||
@@ -66,32 +66,7 @@ namespace OpenSim.Tests.Common.Setup | |||
66 | /// <returns></returns> | 66 | /// <returns></returns> |
67 | public static TestScene SetupScene() | 67 | public static TestScene SetupScene() |
68 | { | 68 | { |
69 | return SetupScene(""); | 69 | return SetupScene("Unit test region", UUID.Random(), 1000, 1000); |
70 | } | ||
71 | |||
72 | /// <summary> | ||
73 | /// Set up a test scene | ||
74 | /// </summary> | ||
75 | /// | ||
76 | /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param> | ||
77 | /// <returns></returns> | ||
78 | public static TestScene SetupScene(String realServices) | ||
79 | { | ||
80 | return SetupScene("Unit test region", UUID.Random(), 1000, 1000, realServices); | ||
81 | } | ||
82 | |||
83 | /// <summary> | ||
84 | /// Set up a test scene | ||
85 | /// </summary> | ||
86 | /// <param name="name">Name of the region</param> | ||
87 | /// <param name="id">ID of the region</param> | ||
88 | /// <param name="x">X co-ordinate of the region</param> | ||
89 | /// <param name="y">Y co-ordinate of the region</param> | ||
90 | /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> | ||
91 | /// <returns></returns> | ||
92 | public static TestScene SetupScene(string name, UUID id, uint x, uint y) | ||
93 | { | ||
94 | return SetupScene(name, id, x, y, ""); | ||
95 | } | 70 | } |
96 | 71 | ||
97 | /// <summary> | 72 | /// <summary> |
@@ -103,10 +78,8 @@ namespace OpenSim.Tests.Common.Setup | |||
103 | /// <param name="x">X co-ordinate of the region</param> | 78 | /// <param name="x">X co-ordinate of the region</param> |
104 | /// <param name="y">Y co-ordinate of the region</param> | 79 | /// <param name="y">Y co-ordinate of the region</param> |
105 | /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> | 80 | /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> |
106 | /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param> | ||
107 | /// <returns></returns> | 81 | /// <returns></returns> |
108 | public static TestScene SetupScene( | 82 | public static TestScene SetupScene(string name, UUID id, uint x, uint y) |
109 | string name, UUID id, uint x, uint y, String realServices) | ||
110 | { | 83 | { |
111 | Console.WriteLine("Setting up test scene {0}", name); | 84 | Console.WriteLine("Setting up test scene {0}", name); |
112 | 85 | ||
@@ -130,15 +103,11 @@ namespace OpenSim.Tests.Common.Setup | |||
130 | IRegionModule godsModule = new GodsModule(); | 103 | IRegionModule godsModule = new GodsModule(); |
131 | godsModule.Initialise(testScene, new IniConfigSource()); | 104 | godsModule.Initialise(testScene, new IniConfigSource()); |
132 | testScene.AddModule(godsModule.Name, godsModule); | 105 | testScene.AddModule(godsModule.Name, godsModule); |
133 | realServices = realServices.ToLower(); | ||
134 | |||
135 | LocalAssetServicesConnector assetService = StartAssetService(testScene, realServices.Contains("asset")); | ||
136 | |||
137 | // For now, always started a 'real' authentication service | ||
138 | StartAuthenticationService(testScene, true); | ||
139 | 106 | ||
140 | LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene, realServices.Contains("inventory")); | 107 | LocalAssetServicesConnector assetService = StartAssetService(testScene); |
141 | StartGridService(testScene, true); | 108 | StartAuthenticationService(testScene); |
109 | LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene); | ||
110 | StartGridService(testScene); | ||
142 | LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); | 111 | LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); |
143 | LocalPresenceServicesConnector presenceService = StartPresenceService(testScene); | 112 | LocalPresenceServicesConnector presenceService = StartPresenceService(testScene); |
144 | 113 | ||
@@ -164,18 +133,17 @@ namespace OpenSim.Tests.Common.Setup | |||
164 | return testScene; | 133 | return testScene; |
165 | } | 134 | } |
166 | 135 | ||
167 | private static LocalAssetServicesConnector StartAssetService(Scene testScene, bool real) | 136 | private static LocalAssetServicesConnector StartAssetService(Scene testScene) |
168 | { | 137 | { |
169 | LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); | 138 | LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); |
170 | IConfigSource config = new IniConfigSource(); | 139 | IConfigSource config = new IniConfigSource(); |
171 | config.AddConfig("Modules"); | 140 | |
141 | config.AddConfig("Modules"); | ||
142 | config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); | ||
172 | config.AddConfig("AssetService"); | 143 | config.AddConfig("AssetService"); |
173 | config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); | 144 | config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); |
174 | if (real) | ||
175 | config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); | ||
176 | else | ||
177 | config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService"); | ||
178 | config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); | 145 | config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); |
146 | |||
179 | assetService.Initialise(config); | 147 | assetService.Initialise(config); |
180 | assetService.AddRegion(testScene); | 148 | assetService.AddRegion(testScene); |
181 | assetService.RegionLoaded(testScene); | 149 | assetService.RegionLoaded(testScene); |
@@ -184,20 +152,18 @@ namespace OpenSim.Tests.Common.Setup | |||
184 | return assetService; | 152 | return assetService; |
185 | } | 153 | } |
186 | 154 | ||
187 | private static void StartAuthenticationService(Scene testScene, bool real) | 155 | private static void StartAuthenticationService(Scene testScene) |
188 | { | 156 | { |
189 | ISharedRegionModule service = new LocalAuthenticationServicesConnector(); | 157 | ISharedRegionModule service = new LocalAuthenticationServicesConnector(); |
190 | IConfigSource config = new IniConfigSource(); | 158 | IConfigSource config = new IniConfigSource(); |
159 | |||
191 | config.AddConfig("Modules"); | 160 | config.AddConfig("Modules"); |
192 | config.AddConfig("AuthenticationService"); | 161 | config.AddConfig("AuthenticationService"); |
193 | config.Configs["Modules"].Set("AuthenticationServices", "LocalAuthenticationServicesConnector"); | 162 | config.Configs["Modules"].Set("AuthenticationServices", "LocalAuthenticationServicesConnector"); |
194 | if (real) | 163 | config.Configs["AuthenticationService"].Set( |
195 | config.Configs["AuthenticationService"].Set( | 164 | "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"); |
196 | "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"); | ||
197 | else | ||
198 | config.Configs["AuthenticationService"].Set( | ||
199 | "LocalServiceModule", "OpenSim.Tests.Common.dll:MockAuthenticationService"); | ||
200 | config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); | 165 | config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); |
166 | |||
201 | service.Initialise(config); | 167 | service.Initialise(config); |
202 | service.AddRegion(testScene); | 168 | service.AddRegion(testScene); |
203 | service.RegionLoaded(testScene); | 169 | service.RegionLoaded(testScene); |
@@ -205,24 +171,17 @@ namespace OpenSim.Tests.Common.Setup | |||
205 | //m_authenticationService = service; | 171 | //m_authenticationService = service; |
206 | } | 172 | } |
207 | 173 | ||
208 | private static LocalInventoryServicesConnector StartInventoryService(Scene testScene, bool real) | 174 | private static LocalInventoryServicesConnector StartInventoryService(Scene testScene) |
209 | { | 175 | { |
210 | LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector(); | 176 | LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector(); |
211 | IConfigSource config = new IniConfigSource(); | 177 | |
178 | IConfigSource config = new IniConfigSource(); | ||
212 | config.AddConfig("Modules"); | 179 | config.AddConfig("Modules"); |
213 | config.AddConfig("InventoryService"); | 180 | config.AddConfig("InventoryService"); |
214 | config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); | 181 | config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); |
215 | 182 | config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); | |
216 | if (real) | ||
217 | { | ||
218 | config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); | ||
219 | } | ||
220 | else | ||
221 | { | ||
222 | config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockInventoryService"); | ||
223 | } | ||
224 | |||
225 | config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); | 183 | config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); |
184 | |||
226 | inventoryService.Initialise(config); | 185 | inventoryService.Initialise(config); |
227 | inventoryService.AddRegion(testScene); | 186 | inventoryService.AddRegion(testScene); |
228 | inventoryService.RegionLoaded(testScene); | 187 | inventoryService.RegionLoaded(testScene); |
@@ -231,24 +190,19 @@ namespace OpenSim.Tests.Common.Setup | |||
231 | return inventoryService; | 190 | return inventoryService; |
232 | } | 191 | } |
233 | 192 | ||
234 | private static LocalGridServicesConnector StartGridService(Scene testScene, bool real) | 193 | private static LocalGridServicesConnector StartGridService(Scene testScene) |
235 | { | 194 | { |
236 | IConfigSource config = new IniConfigSource(); | 195 | IConfigSource config = new IniConfigSource(); |
237 | config.AddConfig("Modules"); | 196 | config.AddConfig("Modules"); |
238 | config.AddConfig("GridService"); | 197 | config.AddConfig("GridService"); |
239 | config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); | 198 | config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); |
240 | config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData"); | 199 | config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData"); |
241 | if (real) | 200 | config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); |
242 | config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); | ||
243 | 201 | ||
244 | LocalGridServicesConnector gridService = new LocalGridServicesConnector(); | 202 | LocalGridServicesConnector gridService = new LocalGridServicesConnector(); |
245 | gridService.Initialise(config); | 203 | gridService.Initialise(config); |
246 | |||
247 | //else | ||
248 | // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService"); | ||
249 | gridService.AddRegion(testScene); | 204 | gridService.AddRegion(testScene); |
250 | gridService.RegionLoaded(testScene); | 205 | gridService.RegionLoaded(testScene); |
251 | //testScene.AddRegionModule(m_gridService.Name, m_gridService); | ||
252 | 206 | ||
253 | return gridService; | 207 | return gridService; |
254 | } | 208 | } |
@@ -472,10 +426,10 @@ namespace OpenSim.Tests.Common.Setup | |||
472 | /// <param name="ownerId"></param> | 426 | /// <param name="ownerId"></param> |
473 | /// <returns></returns> | 427 | /// <returns></returns> |
474 | public static SceneObjectPart CreateSceneObjectPart(string name, UUID id, UUID ownerId) | 428 | public static SceneObjectPart CreateSceneObjectPart(string name, UUID id, UUID ownerId) |
475 | { | 429 | { |
476 | return new SceneObjectPart( | 430 | return new SceneObjectPart( |
477 | ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | 431 | ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) |
478 | { Name = name, UUID = id }; | 432 | { Name = name, UUID = id, Scale = new Vector3(1, 1, 1) }; |
479 | } | 433 | } |
480 | 434 | ||
481 | /// <summary> | 435 | /// <summary> |
diff --git a/prebuild.xml b/prebuild.xml index 870ebf3..49063da 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -931,7 +931,6 @@ | |||
931 | <Reference name="OpenSim.Framework"/> | 931 | <Reference name="OpenSim.Framework"/> |
932 | <Reference name="OpenSim.Framework.Communications"/> | 932 | <Reference name="OpenSim.Framework.Communications"/> |
933 | <Reference name="OpenSim.Framework.Console"/> | 933 | <Reference name="OpenSim.Framework.Console"/> |
934 | <Reference name="OpenSim.Framework.Servers.HttpServer"/> | ||
935 | <Reference name="OpenSim.Region.Framework"/> | 934 | <Reference name="OpenSim.Region.Framework"/> |
936 | <Reference name="OpenSim.Server.Base"/> | 935 | <Reference name="OpenSim.Server.Base"/> |
937 | <Reference name="OpenSim.Services.Base"/> | 936 | <Reference name="OpenSim.Services.Base"/> |
@@ -2889,6 +2888,7 @@ | |||
2889 | <!-- SADLY the way this works means you need to keep adding these paths --> | 2888 | <!-- SADLY the way this works means you need to keep adding these paths --> |
2890 | <Match path="Agent/TextureSender/Tests" pattern="*.cs" recurse="true"/> | 2889 | <Match path="Agent/TextureSender/Tests" pattern="*.cs" recurse="true"/> |
2891 | <Match path="Avatar/Inventory/Archiver/Tests" pattern="*.cs" recurse="true"/> | 2890 | <Match path="Avatar/Inventory/Archiver/Tests" pattern="*.cs" recurse="true"/> |
2891 | <Match path="Framework/InventoryAccess/Tests" pattern="*.cs" recurse="true"/> | ||
2892 | <Match path="World/Archiver/Tests" pattern="*.cs" recurse="true"/> | 2892 | <Match path="World/Archiver/Tests" pattern="*.cs" recurse="true"/> |
2893 | <Match buildAction="EmbeddedResource" path="World/Archiver/Tests/Resources" pattern="*"/> | 2893 | <Match buildAction="EmbeddedResource" path="World/Archiver/Tests/Resources" pattern="*"/> |
2894 | <Match path="World/Land/Tests" pattern="*.cs" recurse="true"/> | 2894 | <Match path="World/Land/Tests" pattern="*.cs" recurse="true"/> |