aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/AuraMetaEntity.cs161
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/BeamMetaEntity.cs139
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs756
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs193
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs365
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/CMView.cs206
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs375
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs163
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/FileSystemDatabase.cs317
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/GitDatabase.cs167
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/IContentDatabase.cs94
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs270
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs104
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/README52
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/SceneObjectGroupDiff.cs216
15 files changed, 0 insertions, 3578 deletions
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/AuraMetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/AuraMetaEntity.cs
deleted file mode 100644
index 4a402bf..0000000
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/AuraMetaEntity.cs
+++ /dev/null
@@ -1,161 +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#region Header
29
30// AuraMetaEntity.cs created with MonoDevelop
31// User: bongiojp at 3:03 PMĀ 8/6/2008
32//
33// To change standard headers go to Edit->Preferences->Coding->Standard Headers
34//
35
36#endregion Header
37
38using System;
39using System.Collections.Generic;
40using System.Drawing;
41
42using OpenMetaverse;
43
44using Nini.Config;
45
46using OpenSim.Framework;
47using OpenSim.Region.Framework.Interfaces;
48using OpenSim.Region.Framework.Scenes;
49using OpenSim.Region.Physics.Manager;
50
51using log4net;
52
53namespace OpenSim.Region.OptionalModules.ContentManagement
54{
55 public class AuraMetaEntity : PointMetaEntity
56 {
57 #region Constructors
58
59 //transparency of root part, NOT particle system. Should probably add support for changing particle system transparency.
60 public AuraMetaEntity(Scene scene, Vector3 groupPos, float transparency, Vector3 color, Vector3 scale)
61 : base(scene, groupPos, transparency)
62 {
63 SetAura(color, scale);
64 }
65
66 public AuraMetaEntity(Scene scene, UUID uuid, Vector3 groupPos, float transparency, Vector3 color, Vector3 scale)
67 : base(scene, uuid, groupPos, transparency)
68 {
69 SetAura(color, scale);
70 }
71
72 #endregion Constructors
73
74 #region Private Methods
75
76 private float Average(Vector3 values)
77 {
78 return (values.X + values.Y + values.Z)/3f;
79 }
80
81 #endregion Private Methods
82
83 #region Public Methods
84
85 public void SetAura(Vector3 color, Vector3 scale)
86 {
87 SetAura(color, Average(scale) * 2.0f);
88 }
89
90 public void SetAura(Vector3 color, float radius)
91 {
92 SceneObjectPart From = m_Entity.RootPart;
93
94 //m_log.Debug("[META ENTITY] BEFORE: radius = " + radius);
95 float burstRadius = 0.1f;
96 Primitive.ParticleSystem.SourcePattern patternFlags = Primitive.ParticleSystem.SourcePattern.None;
97 float age = 1.5f;
98 float burstRate = 0.4f;
99 if (radius >= 8.0f)
100 {
101 //float sizeOfObject = radius / 2.0f;
102 burstRadius = (radius - 8.0f)/3f;
103 burstRate = 1.5f;
104 radius = 7.99f;
105 patternFlags = Primitive.ParticleSystem.SourcePattern.Explode;
106 age = 4.0f;
107 }
108 SetAura(From, color, radius, burstRadius, age, burstRate, patternFlags);
109 }
110
111 public void SetAura(SceneObjectPart From, Vector3 color, float radius, float burstRadius, float age, float burstRate, Primitive.ParticleSystem.SourcePattern patternFlags)
112 {
113 Primitive.ParticleSystem prules = new Primitive.ParticleSystem();
114 //prules.PartDataFlags = Primitive.ParticleSystem.ParticleDataFlags.Emissive |
115 // Primitive.ParticleSystem.ParticleDataFlags.FollowSrc; //PSYS_PART_FLAGS
116 //prules.PartDataFlags = Primitive.ParticleSystem.ParticleDataFlags.Beam |
117 // Primitive.ParticleSystem.ParticleDataFlags.TargetPos;
118 prules.PartStartColor.R = color.X; //PSYS_PART_START_COLOR
119 prules.PartStartColor.G = color.Y;
120 prules.PartStartColor.B = color.Z;
121 prules.PartStartColor.A = 0.5f; //PSYS_PART_START_ALPHA, transparency
122 prules.PartEndColor.R = color.X; //PSYS_PART_END_COLOR
123 prules.PartEndColor.G = color.Y;
124 prules.PartEndColor.B = color.Z;
125 prules.PartEndColor.A = 0.5f; //PSYS_PART_END_ALPHA, transparency
126 /*prules.PartStartScaleX = 0.5f; //PSYS_PART_START_SCALE
127 prules.PartStartScaleY = 0.5f;
128 prules.PartEndScaleX = 0.5f; //PSYS_PART_END_SCALE
129 prules.PartEndScaleY = 0.5f;
130 */
131 prules.PartStartScaleX = radius; //PSYS_PART_START_SCALE
132 prules.PartStartScaleY = radius;
133 prules.PartEndScaleX = radius; //PSYS_PART_END_SCALE
134 prules.PartEndScaleY = radius;
135 prules.PartMaxAge = age; //PSYS_PART_MAX_AGE
136 prules.PartAcceleration.X = 0.0f; //PSYS_SRC_ACCEL
137 prules.PartAcceleration.Y = 0.0f;
138 prules.PartAcceleration.Z = 0.0f;
139 prules.Pattern = patternFlags; //PSYS_SRC_PATTERN
140 //prules.Texture = UUID.Zero;//= UUID //PSYS_SRC_TEXTURE, default used if blank
141 prules.BurstRate = burstRate; //PSYS_SRC_BURST_RATE
142 prules.BurstPartCount = 2; //PSYS_SRC_BURST_PART_COUNT
143 //prules.BurstRadius = radius; //PSYS_SRC_BURST_RADIUS
144 prules.BurstRadius = burstRadius; //PSYS_SRC_BURST_RADIUS
145 prules.BurstSpeedMin = 0.001f; //PSYS_SRC_BURST_SPEED_MIN
146 prules.BurstSpeedMax = 0.001f; //PSYS_SRC_BURST_SPEED_MAX
147 prules.MaxAge = 0.0f; //PSYS_SRC_MAX_AGE
148 //prules.Target = To; //PSYS_SRC_TARGET_KEY
149 prules.AngularVelocity.X = 0.0f; //PSYS_SRC_OMEGA
150 prules.AngularVelocity.Y = 0.0f;
151 prules.AngularVelocity.Z = 0.0f;
152 prules.InnerAngle = 0.0f; //PSYS_SRC_ANGLE_BEGIN
153 prules.OuterAngle = 0.0f; //PSYS_SRC_ANGLE_END
154
155 prules.CRC = 1; //activates the particle system??
156 From.AddNewParticleSystem(prules);
157 }
158
159 #endregion Public Methods
160 }
161}
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/BeamMetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/BeamMetaEntity.cs
deleted file mode 100644
index 6966de0..0000000
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/BeamMetaEntity.cs
+++ /dev/null
@@ -1,139 +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#region Header
29
30// BeamMetaEntity.cs created with MonoDevelop
31// User: bongiojp at 3:03 PMĀ 8/6/2008
32//
33// To change standard headers go to Edit->Preferences->Coding->Standard Headers
34//
35
36#endregion Header
37
38using System;
39using System.Collections.Generic;
40using System.Drawing;
41
42using OpenMetaverse;
43
44using Nini.Config;
45
46using OpenSim.Framework;
47using OpenSim.Region.Framework.Interfaces;
48using OpenSim.Region.Framework.Scenes;
49using OpenSim.Region.Physics.Manager;
50
51using log4net;
52
53namespace OpenSim.Region.OptionalModules.ContentManagement
54{
55 public class BeamMetaEntity : PointMetaEntity
56 {
57 #region Constructors
58
59 public BeamMetaEntity(Scene scene, Vector3 groupPos, float transparency, SceneObjectPart To, Vector3 color)
60 : base(scene, groupPos, transparency)
61 {
62 SetBeamToUUID(To, color);
63 }
64
65 public BeamMetaEntity(Scene scene, UUID uuid, Vector3 groupPos, float transparency, SceneObjectPart To, Vector3 color)
66 : base(scene, uuid, groupPos, transparency)
67 {
68 SetBeamToUUID(To, color);
69 }
70
71 #endregion Constructors
72
73 #region Public Methods
74
75 public void SetBeamToUUID(SceneObjectPart To, Vector3 color)
76 {
77 SceneObjectPart From = m_Entity.RootPart;
78 //Scale size of particles to distance objects are apart (for better visibility)
79 Vector3 FromPos = From.GetWorldPosition();
80 Vector3 ToPos = From.GetWorldPosition();
81 // UUID toUUID = To.UUID;
82 float distance = (float) (Math.Sqrt(Math.Pow(FromPos.X-ToPos.X, 2) +
83 Math.Pow(FromPos.X-ToPos.Y, 2) +
84 Math.Pow(FromPos.X-ToPos.Z, 2)
85 )
86 );
87 //float rate = (float) (distance/4f);
88 float rate = 0.5f;
89 float scale = (float) (distance/128f);
90 float speed = (float) (2.0f - distance/128f);
91
92 SetBeamToUUID(From, To, color, rate, scale, speed);
93 }
94
95 public void SetBeamToUUID(SceneObjectPart From, SceneObjectPart To, Vector3 color, float rate, float scale, float speed)
96 {
97 Primitive.ParticleSystem prules = new Primitive.ParticleSystem();
98 //prules.PartDataFlags = Primitive.ParticleSystem.ParticleDataFlags.Emissive |
99 // Primitive.ParticleSystem.ParticleDataFlags.FollowSrc; //PSYS_PART_FLAGS
100 prules.PartDataFlags = Primitive.ParticleSystem.ParticleDataFlags.Beam |
101 Primitive.ParticleSystem.ParticleDataFlags.TargetPos;
102 prules.PartStartColor.R = color.X; //PSYS_PART_START_COLOR
103 prules.PartStartColor.G = color.Y;
104 prules.PartStartColor.B = color.Z;
105 prules.PartStartColor.A = 1.0f; //PSYS_PART_START_ALPHA, transparency
106 prules.PartEndColor.R = color.X; //PSYS_PART_END_COLOR
107 prules.PartEndColor.G = color.Y;
108 prules.PartEndColor.B = color.Z;
109 prules.PartEndColor.A = 1.0f; //PSYS_PART_END_ALPHA, transparency
110 prules.PartStartScaleX = scale; //PSYS_PART_START_SCALE
111 prules.PartStartScaleY = scale;
112 prules.PartEndScaleX = scale; //PSYS_PART_END_SCALE
113 prules.PartEndScaleY = scale;
114 prules.PartMaxAge = 1.0f; //PSYS_PART_MAX_AGE
115 prules.PartAcceleration.X = 0.0f; //PSYS_SRC_ACCEL
116 prules.PartAcceleration.Y = 0.0f;
117 prules.PartAcceleration.Z = 0.0f;
118 //prules.Pattern = Primitive.ParticleSystem.SourcePattern.Explode; //PSYS_SRC_PATTERN
119 //prules.Texture = UUID.Zero;//= UUID //PSYS_SRC_TEXTURE, default used if blank
120 prules.BurstRate = rate; //PSYS_SRC_BURST_RATE
121 prules.BurstPartCount = 1; //PSYS_SRC_BURST_PART_COUNT
122 prules.BurstRadius = 0.5f; //PSYS_SRC_BURST_RADIUS
123 prules.BurstSpeedMin = speed; //PSYS_SRC_BURST_SPEED_MIN
124 prules.BurstSpeedMax = speed; //PSYS_SRC_BURST_SPEED_MAX
125 prules.MaxAge = 0.0f; //PSYS_SRC_MAX_AGE
126 prules.Target = To.UUID; //PSYS_SRC_TARGET_KEY
127 prules.AngularVelocity.X = 0.0f; //PSYS_SRC_OMEGA
128 prules.AngularVelocity.Y = 0.0f;
129 prules.AngularVelocity.Z = 0.0f;
130 prules.InnerAngle = 0.0f; //PSYS_SRC_ANGLE_BEGIN
131 prules.OuterAngle = 0.0f; //PSYS_SRC_ANGLE_END
132
133 prules.CRC = 1; //activates the particle system??
134 From.AddNewParticleSystem(prules);
135 }
136
137 #endregion Public Methods
138 }
139}
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs
deleted file mode 100644
index 8d6c41d..0000000
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs
+++ /dev/null
@@ -1,756 +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#region Header
29
30// CMController.cs
31// User: bongiojp
32//
33
34#endregion Header
35
36using System;
37using System.Collections;
38using System.Collections.Generic;
39using System.Diagnostics;
40using System.Threading;
41
42using OpenMetaverse;
43
44using OpenSim;
45using OpenSim.Framework;
46using OpenSim.Region.Framework.Interfaces;
47using OpenSim.Region.Framework.Scenes;
48using OpenSim.Region.Physics.Manager;
49
50using log4net;
51
52namespace OpenSim.Region.OptionalModules.ContentManagement
53{
54 /// <summary>
55 /// The controller in a Model-View-Controller framework. This controller catches actions by the avatars, creates work packets, loops through these work packets in a separate thread,
56 /// then dictates to the model how the data should change and dictates to the view which data should be displayed. The main mechanism for interaction is through the simchat system.
57 /// </summary>
58 public class CMController
59 {
60 #region Static Fields
61
62 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
63
64 /// <value>
65 /// The queue that keeps track of which actions have happened. The MainLoop thread eats through this queue.
66 /// </value>
67 private static OpenSim.Framework.BlockingQueue<Work> m_WorkQueue = new OpenSim.Framework.BlockingQueue<Work>();
68
69 #endregion Static Fields
70
71 #region Fields
72
73 //bool init = false;
74 int m_channel = -1;
75
76 /// <value>
77 /// The estate module is used to identify which clients are estateManagers. Presently, the controller only pays attention to estate managers.
78 /// </value>
79 IEstateModule m_estateModule = null;
80
81 //These have to be global variables, threading doesn't allow for passing parameters. (Used in MainLoop)
82 CMModel m_model = null;
83
84 /// <value>
85 /// A list of all the scenes that should be revisioned. Controller is the only class that keeps track of all scenes in the region.
86 /// </value>
87 Hashtable m_sceneList = Hashtable.Synchronized(new Hashtable());
88 State m_state = State.NONE;
89 CMView m_view = null;
90
91 #endregion Fields
92
93 #region Constructors
94
95 /// <summary>
96 /// Initializes a work thread with an initial scene. Additional scenes should be added through the RegisterNewRegion method.
97 /// </summary>
98 /// <param name="model">
99 /// <see cref="CMModel"/>
100 /// </param>
101 /// <param name="view">
102 /// <see cref="CMView"/>
103 /// </param>
104 /// <param name="scene">
105 /// The first scene to keep track of. <see cref="Scene"/>
106 /// </param>
107 /// <param name="channel">
108 /// The simchat channel number to listen to for instructions <see cref="System.Int32"/>
109 /// </param>
110 public CMController(CMModel model, CMView view, Scene scene, int channel)
111 {
112 m_model = model; m_view = view; m_channel = channel;
113 RegisterNewRegion(scene);
114 Initialize(model, view, scene, channel);
115 }
116
117 #endregion Constructors
118
119 #region Private Methods
120
121 //------------------------------------------------ EVENTS ----------------------------------------------------//
122// private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, LLUUID regionID)
123// {
124// }
125
126 /// <summary>
127 /// Searches in all scenes for a SceneObjectGroup that contains a part with a specific localID. If found, the object is returned. Else null is returned.
128 /// </summary>
129 private SceneObjectGroup GetGroupByPrim(uint localID)
130 {
131 foreach (Object currScene in m_sceneList.Values)
132 {
133 foreach (EntityBase ent in ((Scene)currScene).GetEntities())
134 {
135 if (ent is SceneObjectGroup)
136 {
137 if (((SceneObjectGroup)ent).HasChildPrim(localID))
138 return (SceneObjectGroup)ent;
139 }
140 }
141 }
142 return null;
143 }
144
145 private void Initialize(CMModel model, CMView view, Scene scene, int channel)
146 {
147 lock (this)
148 {
149 m_estateModule = scene.RequestModuleInterface<IEstateModule>();
150 Watchdog.StartThread(MainLoop, "Content Management", ThreadPriority.Normal, true);
151 m_state = State.NONE;
152 }
153 }
154
155 /// <summary>
156 /// Run in a thread of its own. A endless loop that consumes (or blocks on) and work queue. Thw work queue is filled through client actions.
157 /// </summary>
158 private void MainLoop()
159 {
160 try
161 {
162 CMModel model = m_model; CMView view = m_view; int channel = m_channel;
163 Work currentJob = new Work();
164 while (true)
165 {
166 currentJob = m_WorkQueue.Dequeue();
167 m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- DeQueued a request");
168 m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- Work type: " + currentJob.Type);
169 switch (currentJob.Type)
170 {
171 case WorkType.NONE:
172 break;
173 case WorkType.OBJECTATTRIBUTECHANGE:
174 ObjectAttributeChanged(model, view, currentJob.LocalId);
175 break;
176 case WorkType.PRIMITIVEADDED:
177 PrimitiveAdded(model, view, currentJob);
178 break;
179 case WorkType.OBJECTDUPLICATED:
180 ObjectDuplicated(model, view, currentJob.LocalId);
181 break;
182 case WorkType.OBJECTKILLED:
183 ObjectKilled(model, view, (SceneObjectGroup) currentJob.Data1);
184 break;
185 case WorkType.UNDODID:
186 UndoDid(model, view, currentJob.UUID);
187 break;
188 case WorkType.NEWCLIENT:
189 NewClient(view, (IClientAPI) currentJob.Data1);
190 break;
191 case WorkType.SIMCHAT:
192 m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- Message received: " + ((OSChatMessage) currentJob.Data1).Message);
193 SimChat(model, view, (OSChatMessage) currentJob.Data1, channel);
194 break;
195 default:
196 m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- uuuuuuuuuh, what?");
197 break;
198 }
199
200 Watchdog.UpdateThread();
201 }
202 }
203 catch (Exception e)
204 {
205 // TODO: Let users in the sim and those entering it and possibly an external watchdog know what has happened
206 m_log.ErrorFormat(
207 "[CONTENT MANAGEMENT]: Content management thread terminating with exception. PLEASE REBOOT YOUR SIM - CONTENT MANAGEMENT WILL NOT BE AVAILABLE UNTIL YOU DO. Exception is {0}",
208 e);
209 }
210
211 Watchdog.RemoveThread();
212 }
213
214 /// <summary>
215 /// Only called by the MainLoop. Updates the view of a new client with metaentities if diff-mode is currently enabled.
216 /// </summary>
217 private void NewClient(CMView view, IClientAPI client)
218 {
219 if ((m_state & State.SHOWING_CHANGES) > 0)
220 view.SendMetaEntitiesToNewClient(client);
221 }
222
223 /// <summary>
224 /// Only called by the MainLoop.
225 /// </summary>
226 private void ObjectAttributeChanged(CMModel model, CMView view, uint LocalId)
227 {
228 SceneObjectGroup group = null;
229 if ((m_state & State.SHOWING_CHANGES) > 0)
230 {
231 group = GetGroupByPrim(LocalId);
232 if (group != null)
233 {
234 view.DisplayAuras(model.UpdateNormalEntityEffects(group)); //Might be a normal entity (green aura)
235 m_view.DisplayMetaEntity(group.UUID); //Might be a meta entity (blue aura)
236 }
237 }
238 }
239
240 /// <summary>
241 /// Only called by the MainLoop. Displays new green auras over the newly created part when a part is shift copied.
242 /// </summary>
243 private void ObjectDuplicated(CMModel model, CMView view, uint localId)
244 {
245 if ((m_state & State.SHOWING_CHANGES) > 0)
246 view.DisplayAuras(model.CheckForNewEntitiesMissingAuras(GetGroupByPrim(localId).Scene));
247 }
248
249 /// <summary>
250 /// Only called by the MainLoop.
251 /// </summary>
252 private void ObjectKilled(CMModel model, CMView view, SceneObjectGroup group)
253 {
254 if ((m_state & State.SHOWING_CHANGES) > 0)
255 {
256 view.RemoveOrUpdateDeletedEntity(group);
257 model.RemoveOrUpdateDeletedEntity(group);
258 }
259 }
260
261 /// <summary>
262 /// Only called by the MainLoop.
263 /// </summary>
264 private void PrimitiveAdded(CMModel model, CMView view, Work currentJob)
265 {
266 if ((m_state & State.SHOWING_CHANGES) > 0)
267 {
268 foreach (Object scene in m_sceneList.Values)
269 m_view.DisplayAuras(model.CheckForNewEntitiesMissingAuras((Scene) scene));
270 }
271 }
272
273 /// <summary>
274 /// Only called by the MainLoop.
275 /// </summary>
276 private void UndoDid(CMModel model, CMView view, UUID uuid)
277 {
278 if ((m_state & State.SHOWING_CHANGES) > 0)
279 {
280 ContentManagementEntity ent = model.FindMetaEntityAffectedByUndo(uuid);
281 if (ent != null)
282 view.DisplayEntity(ent);
283 }
284 }
285
286 #endregion Private Methods
287
288 #region Protected Methods
289
290 protected void GroupBeingDeleted(SceneObjectGroup group)
291 {
292 m_log.Debug("[CONTENT MANAGEMENT] Something was deleted!!!");
293 Work moreWork = new Work();
294 moreWork.Type = WorkType.OBJECTKILLED;
295 moreWork.Data1 = group.Copy();
296 m_WorkQueue.Enqueue(moreWork);
297 }
298
299 protected void ObjectDuplicated(uint localID, Vector3 offset, uint dupeFlags, UUID AgentID, UUID GroupID)
300 {
301 Work moreWork = new Work();
302 moreWork.Type = WorkType.OBJECTDUPLICATED;
303 moreWork.LocalId = localID;
304 m_WorkQueue.Enqueue(moreWork);
305 m_log.Debug("[CONTENT MANAGEMENT] dup queue");
306 }
307
308 protected void ObjectDuplicatedOnRay(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID,
309 UUID RayTargetObj, Vector3 RayEnd, Vector3 RayStart,
310 bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates)
311 {
312 Work moreWork = new Work();
313 moreWork.Type = WorkType.OBJECTDUPLICATED;
314 moreWork.LocalId = localID;
315 m_WorkQueue.Enqueue(moreWork);
316 m_log.Debug("[CONTENT MANAGEMENT] dup queue");
317 }
318
319 protected void OnNewClient(IClientAPI client)
320 {
321 Work moreWork = new Work();
322 moreWork.Type = WorkType.NEWCLIENT;
323 moreWork.Data1 = client;
324 m_WorkQueue.Enqueue(moreWork);
325 m_log.Debug("[CONTENT MANAGEMENT] new client");
326 }
327
328 protected void OnUnDid(IClientAPI remoteClient, UUID primId)
329 {
330 Work moreWork = new Work();
331 moreWork.Type = WorkType.UNDODID;
332 moreWork.UUID = primId;
333 m_WorkQueue.Enqueue(moreWork);
334 m_log.Debug("[CONTENT MANAGEMENT] undid");
335 }
336
337 /// <summary>
338 /// Takes a list of scenes and forms a new orderd list according to the proximity of scenes to the second argument.
339 /// </summary>
340 protected static System.Collections.Generic.List<Scene> ScenesInOrderOfProximity(Hashtable sceneList, Scene scene)
341 {
342 int somethingAddedToList = 1;
343 System.Collections.Generic.List<Scene> newList = new List<Scene>();
344 newList.Add(scene);
345
346 if (!sceneList.ContainsValue(scene))
347 {
348 foreach (Object sceneObj in sceneList)
349 newList.Add((Scene) sceneObj);
350 return newList;
351 }
352
353 while (somethingAddedToList > 0)
354 {
355 somethingAddedToList = 0;
356 for (int i = 0; i < newList.Count; i++)
357 {
358 foreach (Object sceneObj in sceneList.Values)
359 {
360 if (newList[i].CheckNeighborRegion(((Scene)sceneObj).RegionInfo) && (!newList.Contains((Scene)sceneObj)))
361 {
362 newList.Add((Scene)sceneObj);
363 somethingAddedToList++;
364 }
365 }
366 }
367 }
368
369 foreach (Object sceneObj in sceneList.Values)
370 if (!newList.Contains((Scene)sceneObj))
371 newList.Add((Scene)sceneObj);
372
373 return newList;
374 }
375
376 //This is stupid, the same information is contained in the first and second argument
377 protected void SimChatSent(Object x, OSChatMessage e)
378 {
379 m_log.Debug("[CONTENT MANAGEMENT] SIMCHAT SENT !!!!!!!");
380 m_log.Debug("[CONTENT MANAGEMENT] message was: " + e.Message);
381 Work moreWork = new Work();
382 moreWork.Type = WorkType.SIMCHAT;
383 moreWork.Data1 = e;
384 m_WorkQueue.Enqueue(moreWork);
385 }
386
387 /// <summary>
388 /// Adds extra handlers to a number of events so that the controller can produce work based on the client's actions.
389 /// </summary>
390 protected void StartManaging(IClientAPI client)
391 {
392 m_log.Debug("[CONTENT MANAGEMENT] Registering channel with chat services.");
393 // client.OnChatFromClient += SimChatSent;
394 //init = true;
395
396 OnNewClient(client);
397
398 m_log.Debug("[CONTENT MANAGEMENT] Adding handlers to client.");
399 client.OnUpdatePrimScale += UpdateSingleScale;
400 client.OnUpdatePrimGroupScale += UpdateMultipleScale;
401 client.OnUpdatePrimGroupPosition += UpdateMultiplePosition;
402 client.OnUpdatePrimSinglePosition += UpdateSinglePosition;
403 client.OnUpdatePrimGroupRotation += UpdateMultipleRotation;
404 client.OnUpdatePrimSingleRotation += UpdateSingleRotation;
405 client.OnAddPrim += UpdateNewParts;
406 client.OnObjectDuplicate += ObjectDuplicated;
407 client.OnObjectDuplicateOnRay += ObjectDuplicatedOnRay;
408 client.OnUndo += OnUnDid;
409 //client.OnUpdatePrimGroupMouseRotation += m_innerScene.UpdatePrimRotation;
410 }
411
412 /// <summary>
413 ///
414 /// </summary>
415 protected void StopManaging(UUID clientUUID)
416 {
417 foreach (Object sceneobj in m_sceneList.Values)
418 {
419 ScenePresence presence = ((Scene)sceneobj).GetScenePresence(clientUUID);
420 if (presence != null)
421 {
422 IClientAPI client = presence.ControllingClient;
423 m_log.Debug("[CONTENT MANAGEMENT] Unregistering channel with chat services.");
424 // client.OnChatFromViewer -= SimChatSent;
425
426 m_log.Debug("[CONTENT MANAGEMENT] Removing handlers to client");
427 client.OnUpdatePrimScale -= UpdateSingleScale;
428 client.OnUpdatePrimGroupScale -= UpdateMultipleScale;
429 client.OnUpdatePrimGroupPosition -= UpdateMultiplePosition;
430 client.OnUpdatePrimSinglePosition -= UpdateSinglePosition;
431 client.OnUpdatePrimGroupRotation -= UpdateMultipleRotation;
432 client.OnUpdatePrimSingleRotation -= UpdateSingleRotation;
433 client.OnAddPrim -= UpdateNewParts;
434 client.OnObjectDuplicate -= ObjectDuplicated;
435 client.OnObjectDuplicateOnRay -= ObjectDuplicatedOnRay;
436 client.OnUndo -= OnUnDid;
437 //client.OnUpdatePrimGroupMouseRotation += m_innerScene.UpdatePrimRotation;
438 return;
439 }
440 }
441 }
442
443 protected void UpdateMultiplePosition(uint localID, Vector3 pos, IClientAPI remoteClient)
444 {
445 Work moreWork = new Work();
446 moreWork.Type = WorkType.OBJECTATTRIBUTECHANGE;
447 moreWork.LocalId = localID;
448 m_WorkQueue.Enqueue(moreWork);
449 m_log.Debug("[CONTENT MANAGEMENT] pos");
450 }
451
452 protected void UpdateMultipleRotation(uint localID, Quaternion rot, IClientAPI remoteClient)
453 {
454 Work moreWork = new Work();
455 moreWork.Type = WorkType.OBJECTATTRIBUTECHANGE;
456 moreWork.LocalId = localID;
457 m_WorkQueue.Enqueue(moreWork);
458 m_log.Debug("[CONTENT MANAGEMENT] rot");
459 }
460
461 protected void UpdateMultipleScale(uint localID, Vector3 scale, IClientAPI remoteClient)
462 {
463 Work moreWork = new Work();
464 moreWork.Type = WorkType.OBJECTATTRIBUTECHANGE;
465 moreWork.LocalId = localID;
466 m_WorkQueue.Enqueue(moreWork);
467 m_log.Debug("[CONTENT MANAGEMENT]scale");
468 }
469
470 protected void UpdateNewParts(UUID ownerID, UUID groupID, Vector3 RayEnd, Quaternion rot, PrimitiveBaseShape shape,
471 byte bypassRaycast, Vector3 RayStart, UUID RayTargetID,
472 byte RayEndIsIntersection)
473 {
474 Work moreWork = new Work();
475 moreWork.Type = WorkType.PRIMITIVEADDED;
476 moreWork.UUID = ownerID;
477 m_WorkQueue.Enqueue(moreWork);
478 m_log.Debug("[CONTENT MANAGEMENT] new parts");
479 }
480
481 protected void UpdateSinglePosition(uint localID, Vector3 pos, IClientAPI remoteClient)
482 {
483 Work moreWork = new Work();
484 moreWork.Type = WorkType.OBJECTATTRIBUTECHANGE;
485 moreWork.LocalId = localID;
486 m_WorkQueue.Enqueue(moreWork);
487 m_log.Debug("[CONTENT MANAGEMENT] move");
488 }
489
490 /// <summary>
491 ///
492 /// </summary>
493 protected void UpdateSingleRotation(uint localID, Quaternion rot, IClientAPI remoteClient)
494 {
495 Work moreWork = new Work();
496 moreWork.Type = WorkType.OBJECTATTRIBUTECHANGE;
497 moreWork.LocalId = localID;
498 m_WorkQueue.Enqueue(moreWork);
499 m_log.Debug("[CONTENT MANAGEMENT] rot");
500 }
501
502 protected void UpdateSingleScale(uint localID, Vector3 scale, IClientAPI remoteClient)
503 {
504 Work moreWork = new Work();
505 moreWork.Type = WorkType.OBJECTATTRIBUTECHANGE;
506 moreWork.LocalId = localID;
507 m_WorkQueue.Enqueue(moreWork);
508 m_log.Debug("[CONTENT MANAGEMENT] scale");
509 }
510
511 /// <summary>
512 /// Only called from within the SimChat method.
513 /// </summary>
514 protected void commit(string message, Scene scene, CMModel model, CMView view)
515 {
516 System.Collections.Generic.List<Scene> proximitySceneList = ScenesInOrderOfProximity(m_sceneList, scene);
517
518 string[] args = message.Split(new char[] {' '});
519
520 char[] logMessage = {' '};
521 if (args.Length > 1)
522 {
523 logMessage = new char[message.Length - (args[0].Length)];
524 message.CopyTo(args[0].Length, logMessage, 0, message.Length - (args[0].Length));
525 }
526
527 m_log.Debug("[CONTENT MANAGEMENT] Saving terrain and objects of region.");
528 foreach (Scene currScene in proximitySceneList)
529 {
530 model.CommitRegion(currScene, new String(logMessage));
531 view.SendSimChatMessage(scene, "Region Saved Successfully: " + currScene.RegionInfo.RegionName);
532 }
533
534 view.SendSimChatMessage(scene, "Successfully saved all regions.");
535 m_state |= State.DIRTY;
536
537 if ((m_state & State.SHOWING_CHANGES) > 0) //DISPLAY NEW CHANGES INSTEAD OF OLD CHANGES
538 {
539 view.SendSimChatMessage(scene, "Updating differences between new revision and current environment.");
540 //Hide objects from users and Forget about them
541 view.HideAllMetaEntities();
542 view.HideAllAuras();
543 model.DeleteAllMetaObjects();
544
545 //Recreate them from backend files
546 foreach (Scene currScene in proximitySceneList)
547 {
548 model.UpdateCMEntities(currScene);
549 view.SendSimChatMessage(scene, "Finished updating differences between current scene and last revision: " + currScene.RegionInfo.RegionName);
550 }
551
552 //Display new objects to users1
553 view.DisplayRecentChanges();
554 view.SendSimChatMessage(scene, "Finished updating for DIFF-MODE.");
555 m_state &= ~(State.DIRTY);
556 m_state |= State.SHOWING_CHANGES;
557 }
558 }
559
560 /// <summary>
561 /// Only called from within the SimChat method.
562 /// </summary>
563 protected void diffmode(Scene scene, CMModel model, CMView view)
564 {
565 System.Collections.Generic.List<Scene> proximitySceneList = ScenesInOrderOfProximity(m_sceneList, scene);
566
567 if ((m_state & State.SHOWING_CHANGES) > 0) // TURN OFF
568 {
569 view.SendSimChatMessage(scene, "Hiding all meta objects.");
570 view.HideAllMetaEntities();
571 view.HideAllAuras();
572 view.SendSimChatMessage(scene, "Diff-mode = OFF");
573
574 m_state &= ~State.SHOWING_CHANGES;
575 return;
576 }
577 else // TURN ON
578 {
579 if ((m_state & State.DIRTY) != 0 || m_state == State.NONE)
580 {
581 view.SendSimChatMessage(scene, "Hiding meta objects and replacing with latest revision");
582 //Hide objects from users and Forget about them
583 view.HideAllMetaEntities();
584 view.HideAllAuras();
585 model.DeleteAllMetaObjects();
586 //Recreate them from backend files
587 foreach (Object currScene in m_sceneList.Values)
588 model.UpdateCMEntities((Scene) currScene);
589 }
590 else if ((m_state & State.DIRTY) != 0) {
591 view.SendSimChatMessage(scene, "Forming list of meta entities with latest revision");
592 foreach (Scene currScene in proximitySceneList)
593 model.UpdateCMEntities(currScene);
594 }
595
596 view.SendSimChatMessage(scene, "Displaying differences between last revision and current environment");
597 foreach (Scene currScene in proximitySceneList)
598 model.CheckForNewEntitiesMissingAuras(currScene);
599 view.DisplayRecentChanges();
600
601 view.SendSimChatMessage(scene, "Diff-mode = ON");
602 m_state |= State.SHOWING_CHANGES;
603 m_state &= ~State.DIRTY;
604 }
605 }
606
607 /// <summary>
608 /// Only called from within the SimChat method. Hides all auras and meta entities,
609 /// retrieves the current scene object list with the most recent revision retrieved from the model for each scene,
610 /// then lets the view update the clients of the new objects.
611 /// </summary>
612 protected void rollback(Scene scene, CMModel model, CMView view)
613 {
614 if ((m_state & State.SHOWING_CHANGES) > 0)
615 {
616 view.HideAllAuras();
617 view.HideAllMetaEntities();
618 }
619
620 System.Collections.Generic.List<Scene> proximitySceneList = ScenesInOrderOfProximity(m_sceneList, scene);
621 foreach (Scene currScene in proximitySceneList)
622 model.RollbackRegion(currScene);
623
624 if ((m_state & State.DIRTY) != 0)
625 {
626 model.DeleteAllMetaObjects();
627 foreach (Scene currScene in proximitySceneList)
628 model.UpdateCMEntities(currScene);
629 }
630
631 if ((m_state & State.SHOWING_CHANGES) > 0)
632 view.DisplayRecentChanges();
633 }
634
635 #endregion Protected Methods
636
637 #region Public Methods
638
639 /// <summary>
640 /// Register a new scene object to keep track of for revisioning. Starts the controller monitoring actions of clients within the given scene.
641 /// </summary>
642 /// <param name="scene">
643 /// A <see cref="Scene"/>
644 /// </param>
645 public void RegisterNewRegion(Scene scene)
646 {
647 m_sceneList.Add(scene.RegionInfo.RegionID, scene);
648
649 m_log.Debug("[CONTENT MANAGEMENT] Registering new region: " + scene.RegionInfo.RegionID);
650 m_log.Debug("[CONTENT MANAGEMENT] Initializing Content Management System.");
651
652 scene.EventManager.OnNewClient += StartManaging;
653 scene.EventManager.OnChatFromClient += SimChatSent;
654 scene.EventManager.OnRemovePresence += StopManaging;
655 // scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
656 scene.EventManager.OnObjectBeingRemovedFromScene += GroupBeingDeleted;
657 }
658
659 /// <summary>
660 /// Only called by the MainLoop. Takes the message from a user sent to the channel and executes the proper command.
661 /// </summary>
662 public void SimChat(CMModel model, CMView view, OSChatMessage e, int channel)
663 {
664 if (e.Channel != channel)
665 return;
666 if (e.Sender == null)
667 return;
668
669 m_log.Debug("[CONTENT MANAGEMENT] Message received: " + e.Message);
670
671 IClientAPI client = e.Sender;
672 Scene scene = (Scene) e.Scene;
673 string message = e.Message;
674 string[] args = e.Message.Split(new char[] {' '});
675
676 ScenePresence avatar = scene.GetScenePresence(client.AgentId);
677
678 if (!(m_estateModule.IsManager(avatar.UUID)))
679 {
680 m_log.Debug("[CONTENT MANAGEMENT] Message sent from non Estate Manager ... ignoring.");
681 view.SendSimChatMessage(scene, "You must be an estate manager to perform that action.");
682 return;
683 }
684
685 switch (args[0])
686 {
687 case "ci":
688 case "commit":
689 commit(message, scene, model, view);
690 break;
691 case "dm":
692 case "diff-mode":
693 diffmode(scene, model, view);
694 break;
695 case "rb":
696 case "rollback":
697 rollback(scene, model, view);
698 break;
699 case "help":
700 m_view.DisplayHelpMenu(scene);
701 break;
702 default:
703 view.SendSimChatMessage(scene, "Command not found: " + args[0]);
704 break;
705 }
706 }
707
708 #endregion Public Methods
709
710 #region Other
711
712 /// <value>
713 /// Used to keep track of whether a list has been produced yet and whether that list is up-to-date compard to latest revision on disk.
714 /// </value>
715 [Flags]
716 private enum State
717 {
718 NONE = 0,
719 DIRTY = 1, // The meta entities may not correctly represent the last revision.
720 SHOWING_CHANGES = 1<<1 // The meta entities are being shown to user.
721 }
722
723 /// <value>
724 /// The structure that defines the basic unit of work which is produced when a user sends commands to the ContentMangaementSystem.
725 /// </value>
726 private struct Work
727 {
728 #region Fields
729
730 public Object Data1; //Just space for holding data.
731 public Object Data2; //Just more space for holding data.
732 public uint LocalId; //Convenient
733 public WorkType Type;
734 public UUID UUID; //Convenient
735
736 #endregion Fields
737 }
738
739 /// <value>
740 /// Identifies what the data in struct Work should be used for.
741 /// </value>
742 private enum WorkType
743 {
744 NONE,
745 OBJECTATTRIBUTECHANGE,
746 PRIMITIVEADDED,
747 OBJECTDUPLICATED,
748 OBJECTKILLED,
749 UNDODID,
750 NEWCLIENT,
751 SIMCHAT
752 }
753
754 #endregion Other
755 }
756}
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs
deleted file mode 100644
index 7f64ebd..0000000
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs
+++ /dev/null
@@ -1,193 +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#region Header
29
30// CMEntityCollection.cs created with MonoDevelop
31// User: bongiojp at 10:09 AMĀ 7/7/2008
32//
33// Creates, Deletes, Stores ContentManagementEntities
34//
35
36#endregion Header
37
38using System;
39using System.Collections;
40using System.Collections.Generic;
41using System.Threading;
42
43using OpenMetaverse;
44
45using Nini.Config;
46
47using OpenSim;
48using OpenSim.Framework;
49using OpenSim.Region.Framework.Interfaces;
50using OpenSim.Region.Framework.Scenes;
51using OpenSim.Region.Physics.Manager;
52
53using log4net;
54
55namespace OpenSim.Region.OptionalModules.ContentManagement
56{
57 public class CMEntityCollection
58 {
59 #region Fields
60
61 // private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
62 // Any ContentManagementEntities that represent old versions of current SceneObjectGroups or
63 // old versions of deleted SceneObjectGroups will be stored in this hash table.
64 // The UUID keys are from the SceneObjectGroup RootPart UUIDs
65 protected Hashtable m_CMEntityHash = Hashtable.Synchronized(new Hashtable()); //UUID to ContentManagementEntity
66
67 // SceneObjectParts that have not been revisioned will be given green auras stored in this hashtable
68 // The UUID keys are from the SceneObjectPart that they are supposed to be on.
69 protected Hashtable m_NewlyCreatedEntityAura = Hashtable.Synchronized(new Hashtable()); //UUID to AuraMetaEntity
70
71 #endregion Fields
72
73 #region Constructors
74
75 public CMEntityCollection()
76 {
77 }
78
79 #endregion Constructors
80
81 #region Public Properties
82
83 public Hashtable Auras
84 {
85 get {return m_NewlyCreatedEntityAura; }
86 }
87
88 public Hashtable Entities
89 {
90 get { return m_CMEntityHash; }
91 }
92
93 #endregion Public Properties
94
95 #region Public Methods
96
97 public bool AddAura(ContentManagementEntity aura)
98 {
99 if (m_NewlyCreatedEntityAura.ContainsKey(aura.UUID))
100 return false;
101 m_NewlyCreatedEntityAura.Add(aura.UUID, aura);
102 return true;
103 }
104
105 public bool AddEntity(ContentManagementEntity ent)
106 {
107 if (m_CMEntityHash.ContainsKey(ent.UUID))
108 return false;
109 m_CMEntityHash.Add(ent.UUID, ent);
110 return true;
111 }
112
113 // Check if there are SceneObjectGroups in the list that do not have corresponding ContentManagementGroups in the CMEntityHash
114 public System.Collections.ArrayList CheckForMissingEntities(EntityBase[] currList)
115 {
116 System.Collections.ArrayList missingList = new System.Collections.ArrayList();
117 SceneObjectGroup temp = null;
118 foreach (EntityBase currObj in currList)
119 {
120 if (!(currObj is SceneObjectGroup))
121 continue;
122 temp = (SceneObjectGroup) currObj;
123
124 if (m_CMEntityHash.ContainsKey(temp.UUID))
125 {
126 foreach (SceneObjectPart part in temp.Parts)
127 if (!((ContentManagementEntity)m_CMEntityHash[temp.UUID]).HasChildPrim(part.UUID))
128 missingList.Add(part);
129 }
130 else //Entire group is missing from revision. (and is a new part in region)
131 {
132 foreach (SceneObjectPart part in temp.Parts)
133 missingList.Add(part);
134 }
135 }
136 return missingList;
137 }
138
139 public void ClearAll()
140 {
141 m_CMEntityHash.Clear();
142 m_NewlyCreatedEntityAura.Clear();
143 }
144
145 // Old uuid and new sceneobjectgroup
146 public AuraMetaEntity CreateAuraForNewlyCreatedEntity(SceneObjectPart part)
147 {
148 AuraMetaEntity ent = new AuraMetaEntity(part.ParentGroup.Scene,
149 part.GetWorldPosition(),
150 MetaEntity.TRANSLUCENT,
151 new Vector3(0,254,0),
152 part.Scale
153 );
154 m_NewlyCreatedEntityAura.Add(part.UUID, ent);
155 return ent;
156 }
157
158 // Old uuid and new sceneobjectgroup
159 public ContentManagementEntity CreateNewEntity(SceneObjectGroup group)
160 {
161 ContentManagementEntity ent = new ContentManagementEntity(group, false);
162 m_CMEntityHash.Add(group.UUID, ent);
163 return ent;
164 }
165
166 public ContentManagementEntity CreateNewEntity(String xml, Scene scene)
167 {
168 ContentManagementEntity ent = new ContentManagementEntity(xml, scene, false);
169 if (ent == null)
170 return null;
171 m_CMEntityHash.Add(ent.UnchangedEntity.UUID, ent);
172 return ent;
173 }
174
175 public bool RemoveEntity(UUID uuid)
176 {
177 if (!m_CMEntityHash.ContainsKey(uuid))
178 return false;
179 m_CMEntityHash.Remove(uuid);
180 return true;
181 }
182
183 public bool RemoveNewlyCreatedEntityAura(UUID uuid)
184 {
185 if (!m_NewlyCreatedEntityAura.ContainsKey(uuid))
186 return false;
187 m_NewlyCreatedEntityAura.Remove(uuid);
188 return true;
189 }
190
191 #endregion Public Methods
192 }
193}
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
deleted file mode 100644
index 3a6996e..0000000
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs
+++ /dev/null
@@ -1,365 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Diagnostics;
32
33using OpenMetaverse;
34
35using OpenSim;
36using OpenSim.Framework;
37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Region.Framework.Scenes.Serialization;
40using OpenSim.Region.Physics.Manager;
41
42using log4net;
43
44namespace OpenSim.Region.OptionalModules.ContentManagement
45{
46 public class CMModel
47 {
48 #region Static Fields
49
50 static float TimeToUpdate = 0;
51 static float TimeToConvertXml = 0;
52 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
53
54 #endregion Static Fields
55
56 #region Fields
57
58 /// <value>
59 /// The class that contains all auras and metaentities used in the CMS.
60 /// </value>
61 CMEntityCollection m_MetaEntityCollection = new CMEntityCollection();
62 IContentDatabase m_database = null;
63
64 #endregion Fields
65
66 #region Constructors
67
68 public CMModel()
69 {
70 }
71
72 #endregion Constructors
73
74 #region Public Properties
75
76 public CMEntityCollection MetaEntityCollection
77 {
78 get { return m_MetaEntityCollection; }
79 }
80
81 #endregion Public Properties
82
83 #region Public Methods
84
85 /// <summary>
86 /// Compares the scene's object group list to the list of meta entities. If there is an object group that does not have a corresponding meta entity
87 /// it is a new part that must have a green aura (for diff mode).
88 /// Returns list of ContentManagementEntities
89 /// </summary>
90 public ArrayList CheckForNewEntitiesMissingAuras(Scene scene)
91 {
92 ArrayList missingList = null;
93 ArrayList newList = new ArrayList();
94
95 m_log.Debug("[CONTENT MANAGEMENT] Checking for new scene object parts in scene: " + scene.RegionInfo.RegionName);
96
97 //Check if the current scene has groups not included in the current list of MetaEntities
98 //If so, then the current scene's parts that are new should be marked green.
99 missingList = m_MetaEntityCollection.CheckForMissingEntities(scene.GetEntities());
100
101 foreach (Object missingPart in missingList)
102 {
103 if (m_MetaEntityCollection.Auras.ContainsKey(((SceneObjectPart)missingPart).UUID))
104 continue;
105 newList.Add(m_MetaEntityCollection.CreateAuraForNewlyCreatedEntity((SceneObjectPart)missingPart));
106 }
107 m_log.Info("Number of missing objects found: " + newList.Count);
108 return newList;
109 }
110
111 /// <summary>
112 /// Uses the database to serialize all current scene objects into xml and save into a database with an accompanying log message.
113 /// </summary>
114 public void CommitRegion(Scene scene, String logMessage)
115 {
116 m_log.Debug("[CONTENT MANAG] saving " + scene.RegionInfo.RegionName + " with log message: " + logMessage + " length of message: " + logMessage.Length);
117 m_database.SaveRegion(scene.RegionInfo.RegionID, scene.RegionInfo.RegionName, logMessage);
118 m_log.Debug("[CONTENT MANAG] the region name we are dealing with heeeeeeeere: " + scene.RegionInfo.RegionName);
119 }
120
121 public void DeleteAllMetaObjects()
122 {
123 m_MetaEntityCollection.ClearAll();
124 }
125
126 public ContentManagementEntity FindMetaEntityAffectedByUndo(UUID uuid)
127 {
128 ContentManagementEntity ent = GetMetaGroupByPrim(uuid);
129 return ent;
130 }
131
132 //-------------------------------- HELPERS --------------------------------------------------------------------//
133 public ContentManagementEntity GetMetaGroupByPrim(UUID uuid)
134 {
135 foreach (Object ent in m_MetaEntityCollection.Entities.Values)
136 {
137 if (((ContentManagementEntity)ent).HasChildPrim(uuid))
138 return (ContentManagementEntity)ent;
139 }
140 return null;
141 }
142
143 public void Initialise(string database)
144 {
145 if (database == "FileSystemDatabase")
146 m_database = new FileSystemDatabase();
147 else if (database == "GitDatabase")
148 m_database = new GitDatabase();
149 }
150
151 public void InitialiseDatabase(Scene scene, string dir)
152 {
153 m_database.Initialise(scene, dir);
154 }
155
156 /// <summary>
157 /// Should be called just once to finish initializing the database.
158 /// </summary>
159 public void PostInitialise()
160 {
161 m_database.PostInitialise();
162 }
163
164 /// <summary>
165 /// Removes the green aura when an a new scene object group is deleted.
166 /// </summary>
167 public void RemoveOrUpdateDeletedEntity(SceneObjectGroup group)
168 {
169 // Deal with new parts not revisioned that have been deleted.
170 SceneObjectPart[] parts = group.Parts;
171 for (int i = 0; i < parts.Length; i++)
172 {
173 if (m_MetaEntityCollection.Auras.ContainsKey(parts[i].UUID))
174 m_MetaEntityCollection.RemoveNewlyCreatedEntityAura(parts[i].UUID);
175 }
176 }
177
178 /// <summary>
179 /// Retrieves the latest revision of a region in xml form,
180 /// converts it to scene object groups and scene presences,
181 /// swaps the current scene's entity list with the revision's list.
182 /// Note: Since deleted objects while
183 /// </summary>
184 public void RollbackRegion(Scene scene)
185 {
186 System.Collections.ArrayList xmllist = null;
187 SceneObjectGroup temp = null;
188 System.Collections.Hashtable deleteListUUIDs = new Hashtable();
189// Dictionary<LLUUID, EntityBase> SearchList = new Dictionary<LLUUID,EntityBase>();
190 Dictionary<UUID, EntityBase> ReplacementList = new Dictionary<UUID,EntityBase>();
191 int revision = m_database.GetMostRecentRevision(scene.RegionInfo.RegionID);
192// EntityBase[] searchArray;
193
194 xmllist = m_database.GetRegionObjectXMLList(scene.RegionInfo.RegionID, revision);
195 if (xmllist == null)
196 {
197 m_log.Info("[CMMODEL]: Region (" + scene.RegionInfo.RegionID + ") does not have given revision number (" + revision + ").");
198 return;
199 }
200
201 m_log.Info("[CMMODEL]: Region (" + scene.RegionInfo.RegionID + ") revision number (" + revision + ").");
202 m_log.Info("[CMMODEL]: Scene Objects = " + xmllist.Count);
203 m_log.Info("[CMMODEL]: Converting scene entities list to specified revision.");
204
205 m_log.ErrorFormat("[CMMODEL]: 1");
206
207 foreach (string xml in xmllist)
208 {
209 try
210 {
211 temp = SceneObjectSerializer.FromXml2Format(xml);
212 temp.SetScene(scene);
213
214 SceneObjectPart[] parts = temp.Parts;
215 for (int i = 0; i < parts.Length; i++)
216 parts[i].RegionHandle = scene.RegionInfo.RegionHandle;
217
218 ReplacementList.Add(temp.UUID, (EntityBase)temp);
219 }
220 catch (Exception e)
221 {
222 m_log.Info("[CMMODEL]: Error while creating replacement list for rollback: " + e);
223 }
224 }
225
226 //If in scene but not in revision and not a client, remove them
227 while (true)
228 {
229 try
230 {
231 foreach (EntityBase entity in scene.GetEntities())
232 {
233 if (entity == null)
234 continue;
235
236 if (entity is ScenePresence)
237 {
238 ReplacementList.Add(entity.UUID, entity);
239 continue;
240 }
241 else //if (!ReplacementList.ContainsKey(entity.UUID))
242 deleteListUUIDs.Add(entity.UUID, 0);
243 }
244 }
245 catch(Exception e)
246 {
247 m_log.ErrorFormat("[CMMODEL]: " + e);
248 deleteListUUIDs.Clear();
249 ReplacementList.Clear();
250 continue;
251 }
252 break;
253 }
254
255 foreach (UUID uuid in deleteListUUIDs.Keys)
256 {
257 try
258 {
259 // I thought that the DeleteGroup() function would handle all of this, but it doesn't. I'm not sure WHAT it handles.
260 ((SceneObjectGroup)scene.Entities[uuid]).DetachFromBackup();
261 scene.PhysicsScene.RemovePrim(((SceneObjectGroup)scene.Entities[uuid]).RootPart.PhysActor);
262 scene.SendKillObject(scene.Entities[uuid].LocalId);
263 scene.SceneGraph.DeleteSceneObject(uuid, false);
264 ((SceneObjectGroup)scene.Entities[uuid]).DeleteGroupFromScene(false);
265 }
266 catch(Exception e)
267 {
268 m_log.ErrorFormat("[CMMODEL]: Error while removing objects from scene: " + e);
269 }
270 }
271
272 lock (scene)
273 {
274 scene.Entities.Clear();
275
276 foreach (KeyValuePair<UUID,EntityBase> kvp in ReplacementList)
277 {
278 scene.Entities.Add(kvp.Value);
279 }
280 }
281
282 foreach (EntityBase ent in ReplacementList.Values)
283 {
284 try
285 {
286 if (!(ent is SceneObjectGroup))
287 continue;
288
289 if ((((SceneObjectGroup)ent).RootPart.GetEffectiveObjectFlags() & (uint) PrimFlags.Phantom) == 0)
290 ((SceneObjectGroup)ent).ApplyPhysics(true);
291 ((SceneObjectGroup)ent).AttachToBackup();
292 ((SceneObjectGroup)ent).HasGroupChanged = true; // If not true, then attaching to backup does nothing because no change is detected.
293 ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate();
294 }
295 catch(Exception e)
296 {
297 m_log.ErrorFormat("[CMMODEL]: Error while attaching new scene entities to backup and scheduling for a full update: " + e);
298 }
299 }
300 m_log.Info("[CMMODEL]: Scheduling a backup of new scene object groups to backup.");
301 scene.Backup(true);
302 }
303
304 /// <summary>
305 /// Downloads the latest revision of the given scene and converts the xml file to CMEntities. After this method, the view can find the differences
306 /// and display the differences to clients.
307 /// </summary>
308 public void UpdateCMEntities(Scene scene)
309 {
310 Stopwatch x = new Stopwatch();
311 x.Start();
312
313 System.Collections.ArrayList xmllist = null;
314 m_log.Debug("[CONTENT MANAGEMENT] Retrieving object xml files for region: " + scene.RegionInfo.RegionID);
315 xmllist = m_database.GetRegionObjectXMLList(scene.RegionInfo.RegionID);
316 m_log.Info("[FSDB]: got list");
317 if (xmllist == null)
318 return;
319
320 Stopwatch y = new Stopwatch();
321 y.Start();
322 foreach (string xml in xmllist)
323 m_MetaEntityCollection.CreateNewEntity(xml, scene);
324 y.Stop();
325 TimeToConvertXml += y.ElapsedMilliseconds;
326 m_log.Info("[FileSystemDatabase] Time spent converting xml to metaentities for " + scene.RegionInfo.RegionName + ": " + y.ElapsedMilliseconds);
327 m_log.Info("[FileSystemDatabase] Time spent converting xml to metaentities so far: " + TimeToConvertXml);
328
329 m_log.Info("[FSDB]: checking for new scene object parts missing green auras and create the auras");
330 CheckForNewEntitiesMissingAuras(scene);
331
332 x.Stop();
333 TimeToUpdate += x.ElapsedMilliseconds;
334 m_log.Info("[FileSystemDatabase] Time spent Updating entity list for " + scene.RegionInfo.RegionName + ": " + x.ElapsedMilliseconds);
335 m_log.Info("[FileSystemDatabase] Time spent Updating so far: " + TimeToUpdate);
336 }
337
338 /// <summary>
339 /// Detects if a scene object group from the scene list has moved or changed scale. The green aura
340 /// that surrounds the object is then moved or scaled with the group.
341 /// </summary>
342 public System.Collections.ArrayList UpdateNormalEntityEffects(SceneObjectGroup group)
343 {
344 System.Collections.ArrayList auraList = new System.Collections.ArrayList();
345 if (group == null)
346 return null;
347
348 SceneObjectPart[] parts = group.Parts;
349 for (int i = 0; i < parts.Length; i++)
350 {
351 SceneObjectPart part = parts[i];
352 if (m_MetaEntityCollection.Auras.ContainsKey(part.UUID))
353 {
354 ((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]).SetAura(new Vector3(0, 254, 0), part.Scale);
355 ((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]).RootPart.GroupPosition = part.GetWorldPosition();
356 auraList.Add((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]);
357 }
358 }
359
360 return auraList;
361 }
362
363 #endregion Public Methods
364 }
365}
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMView.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMView.cs
deleted file mode 100644
index 3807ccd..0000000
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMView.cs
+++ /dev/null
@@ -1,206 +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#region Header
29
30// CMView.cs created with MonoDevelop
31// User: bongiojp at 11:57 AMĀ 7/3/2008
32//
33// To change standard headers go to Edit->Preferences->Coding->Standard Headers
34//
35
36#endregion Header
37
38using System;
39using System.Collections;
40using System.Collections.Generic;
41
42using OpenMetaverse;
43
44using OpenSim;
45using OpenSim.Framework;
46using OpenSim.Region.Framework.Interfaces;
47using OpenSim.Region.Framework.Scenes;
48using OpenSim.Region.Physics.Manager;
49
50using log4net;
51
52namespace OpenSim.Region.OptionalModules.ContentManagement
53{
54 public class CMView
55 {
56 #region Static Fields
57
58 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
59
60 #endregion Static Fields
61
62 #region Fields
63
64 CMModel m_model = null;
65
66 #endregion Fields
67
68 #region Constructors
69
70 public CMView()
71 {
72 }
73
74 #endregion Constructors
75
76 #region Public Methods
77
78 // Auras To
79 public void DisplayAuras(CMEntityCollection auraCollection)
80 {
81 foreach (Object ent in auraCollection.Auras.Values)
82 ((AuraMetaEntity)ent).SendFullUpdateToAll();
83 }
84
85 // Auras To Client
86 public void DisplayAuras(CMEntityCollection auraCollection, IClientAPI client)
87 {
88 foreach (Object ent in auraCollection.Auras.Values)
89 ((AuraMetaEntity)ent).SendFullUpdate(client);
90 }
91
92 // Auras from List To ALL
93 public void DisplayAuras(ArrayList list)
94 {
95 foreach (Object ent in list)
96 {
97 m_log.Debug("[CONTENT MANAGEMENT] displaying new aura riiiiiiiiiiiight NOW");
98 ((AuraMetaEntity)ent).SendFullUpdateToAll();
99 }
100 }
101
102 // Entities to ALL
103 public void DisplayEntities(CMEntityCollection entityCollection)
104 {
105 foreach (Object ent in entityCollection.Entities.Values)
106 ((ContentManagementEntity)ent).SendFullDiffUpdateToAll();
107 }
108
109 // Entities to Client
110 public void DisplayEntities(CMEntityCollection entityCollection, IClientAPI client)
111 {
112 foreach (Object ent in entityCollection.Entities.Values)
113 ((ContentManagementEntity)ent).SendFullDiffUpdate(client);
114 }
115
116 // Entities from List to ALL
117 public void DisplayEntities(ArrayList list)
118 {
119 foreach (Object ent in list)
120 ((ContentManagementEntity)ent).SendFullDiffUpdateToAll();
121 }
122
123 // Entity to ALL
124 public void DisplayEntity(ContentManagementEntity ent)
125 {
126 ent.SendFullDiffUpdateToAll();
127 }
128
129 public void DisplayHelpMenu(Scene scene)
130 {
131 string menu = "Menu:\n";
132 menu += "commit (ci) - saves current state of the region to a database on the server\n";
133 menu += "diff-mode (dm) - displays those aspects of region that have not been saved but changed since the very last revision. Will dynamically update as you change environment.\n";
134 SendSimChatMessage(scene, menu);
135 }
136
137 public void DisplayMetaEntity(UUID uuid)
138 {
139 ContentManagementEntity group = m_model.GetMetaGroupByPrim(uuid);
140 if (group != null)
141 group.SendFullDiffUpdateToAll();
142 }
143
144 /// <summary>
145 /// update all clients of red/green/blue auras and meta entities that the model knows about.
146 /// </summary>
147 public void DisplayRecentChanges()
148 {
149 m_log.Debug("[CONTENT MANAGEMENT] Sending update to clients for " + m_model.MetaEntityCollection.Entities.Count + " objects.");
150 DisplayEntities(m_model.MetaEntityCollection);
151 DisplayAuras(m_model.MetaEntityCollection);
152 }
153
154 public void Hide(ContentManagementEntity ent)
155 {
156 ent.HideFromAll();
157 }
158
159 public void HideAllAuras()
160 {
161 foreach (Object obj in m_model.MetaEntityCollection.Auras.Values)
162 ((MetaEntity)obj).HideFromAll();
163 }
164
165 public void HideAllMetaEntities()
166 {
167 foreach (Object obj in m_model.MetaEntityCollection.Entities.Values)
168 ((ContentManagementEntity)obj).HideFromAll();
169 }
170
171 public void Initialise(CMModel model)
172 {
173 m_model = model;
174 }
175
176 /// <summary>
177 /// Figures out if the part deleted was a new scene object part or a revisioned part that's been deleted.
178 /// If it's a new scene object, any green aura attached to it is deleted.
179 /// If a revisioned part is deleted, a new full update is sent to the environment of the meta entity, which will
180 /// figure out that there should be a red aura and not a blue aura/beam.
181 /// </summary>
182 public void RemoveOrUpdateDeletedEntity(SceneObjectGroup group)
183 {
184 // Deal with revisioned parts that have been deleted.
185 if (m_model.MetaEntityCollection.Entities.ContainsKey(group.UUID))
186 ((ContentManagementEntity)m_model.MetaEntityCollection.Entities[group.UUID]).SendFullDiffUpdateToAll();
187
188 // Deal with new parts not revisioned that have been deleted.
189 foreach (SceneObjectPart part in group.Parts)
190 if (m_model.MetaEntityCollection.Auras.ContainsKey(part.UUID))
191 ((AuraMetaEntity)m_model.MetaEntityCollection.Auras[part.UUID]).HideFromAll();
192 }
193
194 public void SendMetaEntitiesToNewClient(IClientAPI client)
195 {
196 }
197
198 public void SendSimChatMessage(Scene scene, string message)
199 {
200 scene.SimChat(Utils.StringToBytes(message),
201 ChatTypeEnum.Broadcast, 0, new Vector3(0,0,0), "Content Manager", UUID.Zero, false);
202 }
203
204 #endregion Public Methods
205 }
206}
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
deleted file mode 100644
index 0248f36..0000000
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
+++ /dev/null
@@ -1,375 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Drawing;
31
32using OpenMetaverse;
33
34using Nini.Config;
35
36using OpenSim.Framework;
37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Region.Framework.Scenes.Serialization;
40using OpenSim.Region.Physics.Manager;
41
42using log4net;
43
44namespace OpenSim.Region.OptionalModules.ContentManagement
45{
46 public class ContentManagementEntity : MetaEntity
47 {
48 #region Static Fields
49
50// static float TimeToDiff = 0;
51// static float TimeToCreateEntities = 0;
52
53 #endregion Static Fields
54
55 #region Fields
56
57 protected Dictionary<UUID, AuraMetaEntity> m_AuraEntities = new Dictionary<UUID, AuraMetaEntity>();
58 protected Dictionary<UUID, BeamMetaEntity> m_BeamEntities = new Dictionary<UUID, BeamMetaEntity>();
59
60 // The LinkNum of parts in m_Entity and m_UnchangedEntity are the same though UUID and LocalId are different.
61 // This can come in handy.
62 protected SceneObjectGroup m_UnchangedEntity = null;
63
64 /// <value>
65 /// Should be set to true when there is a difference between m_UnchangedEntity and the corresponding scene object group in the scene entity list.
66 /// </value>
67 bool DiffersFromSceneGroup = false;
68
69 #endregion Fields
70
71 #region Constructors
72
73 public ContentManagementEntity(SceneObjectGroup Unchanged, bool physics)
74 : base(Unchanged, false)
75 {
76 m_UnchangedEntity = Unchanged.Copy(false);
77 }
78
79 public ContentManagementEntity(string objectXML, Scene scene, bool physics)
80 : base(objectXML, scene, false)
81 {
82 m_UnchangedEntity = SceneObjectSerializer.FromXml2Format(objectXML);
83 }
84
85 #endregion Constructors
86
87 #region Public Properties
88
89 public SceneObjectGroup UnchangedEntity
90 {
91 get { return m_UnchangedEntity; }
92 }
93
94 #endregion Public Properties
95
96 #region Private Methods
97
98 /// <summary>
99 /// Check if an entitybase list (like that returned by scene.GetEntities()) contains a group with the rootpart uuid that matches the current uuid.
100 /// </summary>
101 private bool ContainsKey(List<EntityBase> list, UUID uuid)
102 {
103 foreach (EntityBase part in list)
104 if (part.UUID == uuid)
105 return true;
106 return false;
107 }
108
109 private SceneObjectGroup GetGroupByUUID(System.Collections.Generic.List<EntityBase> list, UUID uuid)
110 {
111 foreach (EntityBase ent in list)
112 {
113 if (ent is SceneObjectGroup)
114 if (ent.UUID == uuid)
115 return (SceneObjectGroup)ent;
116 }
117 return null;
118 }
119
120 #endregion Private Methods
121
122 #region Public Methods
123
124 /// <summary>
125 /// Search for a corresponding group UUID in the scene. If not found, then the revisioned group this CMEntity represents has been deleted. Mark the metaentity appropriately.
126 /// If a matching UUID is found in a scene object group, compare the two for differences. If differences exist, Mark the metaentity appropriately.
127 /// </summary>
128 public void FindDifferences()
129 {
130 List<EntityBase> sceneEntityList = new List<EntityBase>(m_Entity.Scene.GetEntities());
131 DiffersFromSceneGroup = false;
132 // if group is not contained in scene's list
133 if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID))
134 {
135 foreach (SceneObjectPart part in m_UnchangedEntity.Parts)
136 {
137 // if scene list no longer contains this part, display translucent part and mark with red aura
138 if (!ContainsKey(sceneEntityList, part.UUID))
139 {
140 // if already displaying a red aura over part, make sure its red
141 if (m_AuraEntities.ContainsKey(part.UUID))
142 {
143 m_AuraEntities[part.UUID].SetAura(new Vector3(254, 0, 0), part.Scale);
144 }
145 else
146 {
147 AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene,
148 part.GetWorldPosition(),
149 MetaEntity.TRANSLUCENT,
150 new Vector3(254, 0, 0),
151 part.Scale
152 );
153 m_AuraEntities.Add(part.UUID, auraGroup);
154 }
155 SceneObjectPart metaPart = m_Entity.GetLinkNumPart(part.LinkNum);
156 SetPartTransparency(metaPart, MetaEntity.TRANSLUCENT);
157 }
158 // otherwise, scene will not contain the part. note: a group can not remove a part without changing group id
159 }
160
161 // a deleted part has no where to point a beam particle system,
162 // if a metapart had a particle system (maybe it represented a moved part) remove it
163 if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID))
164 {
165 m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll();
166 m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID);
167 }
168
169 DiffersFromSceneGroup = true;
170 }
171 // if scene list does contain group, compare each part in group for differences and display beams and auras appropriately
172 else
173 {
174 MarkWithDifferences((SceneObjectGroup)GetGroupByUUID(sceneEntityList, m_UnchangedEntity.UUID));
175 }
176 }
177
178 /// <summary>
179 /// Check if the revisioned scene object group that this CMEntity is based off of contains a child with the given UUID.
180 /// </summary>
181 public bool HasChildPrim(UUID uuid)
182 {
183 return m_UnchangedEntity.ContainsPart(uuid);
184 }
185
186 /// <summary>
187 /// Check if the revisioned scene object group that this CMEntity is based off of contains a child with the given LocalId.
188 /// </summary>
189 public bool HasChildPrim(uint localID)
190 {
191 foreach (SceneObjectPart part in m_UnchangedEntity.Parts)
192 if (part.LocalId == localID)
193 return true;
194
195 return false;
196 }
197
198 public override void Hide(IClientAPI client)
199 {
200 base.Hide(client);
201 foreach (MetaEntity group in m_AuraEntities.Values)
202 group.Hide(client);
203 foreach (MetaEntity group in m_BeamEntities.Values)
204 group.Hide(client);
205 }
206
207 public override void HideFromAll()
208 {
209 base.HideFromAll();
210 foreach (MetaEntity group in m_AuraEntities.Values)
211 group.HideFromAll();
212 foreach (MetaEntity group in m_BeamEntities.Values)
213 group.HideFromAll();
214 }
215
216 /// <summary>
217 /// Returns true if there was a change between meta entity and the entity group, false otherwise.
218 /// If true is returned, it is assumed the metaentity's appearance has changed to reflect the difference (though clients haven't been updated).
219 /// </summary>
220 public bool MarkWithDifferences(SceneObjectGroup sceneEntityGroup)
221 {
222 SceneObjectPart sceneEntityPart;
223 SceneObjectPart metaEntityPart;
224 Diff differences;
225 bool changed = false;
226
227 // Use "UnchangedEntity" to do comparisons because its text, transparency, and other attributes will be just as the user
228 // had originally saved.
229 // m_Entity will NOT necessarily be the same entity as the user had saved.
230 foreach (SceneObjectPart UnchangedPart in m_UnchangedEntity.Parts)
231 {
232 //This is the part that we use to show changes.
233 metaEntityPart = m_Entity.GetLinkNumPart(UnchangedPart.LinkNum);
234 if (sceneEntityGroup.ContainsPart(UnchangedPart.UUID))
235 {
236 sceneEntityPart = sceneEntityGroup.GetChildPart(UnchangedPart.UUID);
237 differences = Difference.FindDifferences(UnchangedPart, sceneEntityPart);
238 if (differences != Diff.NONE)
239 metaEntityPart.Text = "CHANGE: " + differences.ToString();
240 if (differences != 0)
241 {
242 // Root Part that has been modified
243 if ((differences & Diff.POSITION) > 0)
244 {
245 // If the position of any part has changed, make sure the RootPart of the
246 // meta entity is pointing with a beam particle system
247 if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID))
248 {
249 m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll();
250 m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID);
251 }
252 BeamMetaEntity beamGroup = new BeamMetaEntity(m_Entity.Scene,
253 m_UnchangedEntity.RootPart.GetWorldPosition(),
254 MetaEntity.TRANSLUCENT,
255 sceneEntityPart,
256 new Vector3(0, 0, 254)
257 );
258 m_BeamEntities.Add(m_UnchangedEntity.RootPart.UUID, beamGroup);
259 }
260
261 if (m_AuraEntities.ContainsKey(UnchangedPart.UUID))
262 {
263 m_AuraEntities[UnchangedPart.UUID].HideFromAll();
264 m_AuraEntities.Remove(UnchangedPart.UUID);
265 }
266 AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene,
267 UnchangedPart.GetWorldPosition(),
268 MetaEntity.TRANSLUCENT,
269 new Vector3(0, 0, 254),
270 UnchangedPart.Scale
271 );
272 m_AuraEntities.Add(UnchangedPart.UUID, auraGroup);
273 SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT);
274
275 DiffersFromSceneGroup = true;
276 }
277 else // no differences between scene part and meta part
278 {
279 if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID))
280 {
281 m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll();
282 m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID);
283 }
284 if (m_AuraEntities.ContainsKey(UnchangedPart.UUID))
285 {
286 m_AuraEntities[UnchangedPart.UUID].HideFromAll();
287 m_AuraEntities.Remove(UnchangedPart.UUID);
288 }
289 SetPartTransparency(metaEntityPart, MetaEntity.NONE);
290 }
291 }
292 else //The entity currently in the scene is missing parts from the metaentity saved, so mark parts red as deleted.
293 {
294 if (m_AuraEntities.ContainsKey(UnchangedPart.UUID))
295 {
296 m_AuraEntities[UnchangedPart.UUID].HideFromAll();
297 m_AuraEntities.Remove(UnchangedPart.UUID);
298 }
299 AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene,
300 UnchangedPart.GetWorldPosition(),
301 MetaEntity.TRANSLUCENT,
302 new Vector3(254, 0, 0),
303 UnchangedPart.Scale
304 );
305 m_AuraEntities.Add(UnchangedPart.UUID, auraGroup);
306 SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT);
307
308 DiffersFromSceneGroup = true;
309 }
310 }
311
312 return changed;
313 }
314
315 public void SendFullAuraUpdate(IClientAPI client)
316 {
317 if (DiffersFromSceneGroup)
318 {
319 foreach (AuraMetaEntity group in m_AuraEntities.Values)
320 group.SendFullUpdate(client);
321 }
322 }
323
324 public void SendFullAuraUpdateToAll()
325 {
326 if (DiffersFromSceneGroup)
327 {
328 foreach (AuraMetaEntity group in m_AuraEntities.Values)
329 group.SendFullUpdateToAll();
330 }
331 }
332
333 public void SendFullBeamUpdate(IClientAPI client)
334 {
335 if (DiffersFromSceneGroup)
336 {
337 foreach (BeamMetaEntity group in m_BeamEntities.Values)
338 group.SendFullUpdate(client);
339 }
340 }
341
342 public void SendFullBeamUpdateToAll()
343 {
344 if (DiffersFromSceneGroup)
345 {
346 foreach (BeamMetaEntity group in m_BeamEntities.Values)
347 group.SendFullUpdateToAll();
348 }
349 }
350
351 public void SendFullDiffUpdate(IClientAPI client)
352 {
353 FindDifferences();
354 if (DiffersFromSceneGroup)
355 {
356 SendFullUpdate(client);
357 SendFullAuraUpdate(client);
358 SendFullBeamUpdate(client);
359 }
360 }
361
362 public void SendFullDiffUpdateToAll()
363 {
364 FindDifferences();
365 if (DiffersFromSceneGroup)
366 {
367 SendFullUpdateToAll();
368 SendFullAuraUpdateToAll();
369 SendFullBeamUpdateToAll();
370 }
371 }
372
373 #endregion Public Methods
374 }
375}
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs
deleted file mode 100644
index 3d1c346..0000000
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs
+++ /dev/null
@@ -1,163 +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#region Header
29
30// ContentManagementModule.cs
31// User: bongiojp
32
33#endregion Header
34
35using System;
36using System.Collections.Generic;
37using System.Threading;
38
39using OpenMetaverse;
40
41using Nini.Config;
42
43using OpenSim;
44using OpenSim.Framework;
45using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Region.Framework.Scenes;
47using OpenSim.Region.Physics.Manager;
48
49using log4net;
50
51namespace OpenSim.Region.OptionalModules.ContentManagement
52{
53 public class ContentManagementModule : IRegionModule
54 {
55 #region Static Fields
56
57 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
58
59 #endregion Static Fields
60
61 #region Fields
62
63 bool initialised = false;
64 CMController m_control = null;
65 bool m_enabled = false;
66 CMModel m_model = null;
67 bool m_posted = false;
68 CMView m_view = null;
69
70 #endregion Fields
71
72 #region Public Properties
73
74 public bool IsSharedModule
75 {
76 get { return true; }
77 }
78
79 public string Name
80 {
81 get { return "ContentManagementModule"; }
82 }
83
84 #endregion Public Properties
85
86 #region Public Methods
87
88 public void Close()
89 {
90 }
91
92 public void Initialise(Scene scene, IConfigSource source)
93 {
94 string databaseDir = "./";
95 string database = "FileSystemDatabase";
96 int channel = 345;
97 try
98 {
99 if (source.Configs["CMS"] == null)
100 return;
101
102 m_enabled = source.Configs["CMS"].GetBoolean("enabled", false);
103 databaseDir = source.Configs["CMS"].GetString("directory", databaseDir);
104 database = source.Configs["CMS"].GetString("database", database);
105 channel = source.Configs["CMS"].GetInt("channel", channel);
106
107 if (database != "FileSystemDatabase" && database != "GitDatabase")
108 {
109 m_log.ErrorFormat("[Content Management]: The Database attribute must be defined as either FileSystemDatabase or GitDatabase");
110 m_enabled = false;
111 }
112 }
113 catch (Exception e)
114 {
115 m_log.ErrorFormat("[Content Management]: Exception thrown while reading parameters from configuration file. Message: " + e);
116 m_enabled = false;
117 }
118
119 if (!m_enabled)
120 {
121 m_log.Info("[Content Management]: Content Management System is not Enabled.");
122 return;
123 }
124
125 lock (this)
126 {
127 if (!initialised) //only init once
128 {
129 m_view = new CMView();
130 m_model = new CMModel();
131 m_control = new CMController(m_model, m_view, scene, channel);
132 m_model.Initialise(database);
133 m_view.Initialise(m_model);
134
135 initialised = true;
136 m_model.InitialiseDatabase(scene, databaseDir);
137 }
138 else
139 {
140 m_model.InitialiseDatabase(scene, databaseDir);
141 m_control.RegisterNewRegion(scene);
142 }
143 }
144 }
145
146 public void PostInitialise()
147 {
148 if (! m_enabled)
149 return;
150
151 lock (this)
152 {
153 if (!m_posted) //only post once
154 {
155 m_model.PostInitialise();
156 m_posted = true;
157 }
158 }
159 }
160
161 #endregion Public Methods
162 }
163}
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/FileSystemDatabase.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/FileSystemDatabase.cs
deleted file mode 100644
index a3d7977..0000000
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/FileSystemDatabase.cs
+++ /dev/null
@@ -1,317 +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#region Header
29
30// FileSystemDatabase.cs
31// User: bongiojp
32
33#endregion Header
34
35using System;
36using System.Collections.Generic;
37using System.Diagnostics;
38using System.IO;
39using Slash = System.IO.Path;
40using System.Reflection;
41using System.Xml;
42
43using OpenMetaverse;
44
45using Nini.Config;
46
47using OpenSim.Framework;
48using OpenSim.Region.Framework.Interfaces;
49using OpenSim.Region.Framework.Scenes;
50using OpenSim.Region.CoreModules.World.Serialiser;
51using OpenSim.Region.CoreModules.World.Terrain;
52using OpenSim.Region.Physics.Manager;
53
54using log4net;
55
56namespace OpenSim.Region.OptionalModules.ContentManagement
57{
58 public class FileSystemDatabase : IContentDatabase
59 {
60 #region Static Fields
61
62 public static float TimeToDownload = 0;
63 public static float TimeToSave = 0;
64 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
65
66 #endregion Static Fields
67
68 #region Fields
69
70 private string m_repodir = null;
71 private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
72 private Dictionary<UUID, IRegionSerialiserModule> m_serialiser = new Dictionary<UUID, IRegionSerialiserModule>();
73
74 #endregion Fields
75
76 #region Constructors
77
78 public FileSystemDatabase()
79 {
80 }
81
82 #endregion Constructors
83
84 #region Private Methods
85
86 // called by postinitialise
87 private void CreateDirectory()
88 {
89 string scenedir;
90 if (!Directory.Exists(m_repodir))
91 Directory.CreateDirectory(m_repodir);
92
93 foreach (UUID region in m_scenes.Keys)
94 {
95 scenedir = m_repodir + Slash.DirectorySeparatorChar + region + Slash.DirectorySeparatorChar;
96 if (!Directory.Exists(scenedir))
97 Directory.CreateDirectory(scenedir);
98 }
99 }
100
101 // called by postinitialise
102 private void SetupSerialiser()
103 {
104 if (m_serialiser.Count == 0)
105 {
106 foreach (UUID region in m_scenes.Keys)
107 {
108 m_serialiser.Add(region, m_scenes[region].RequestModuleInterface<IRegionSerialiserModule>());
109 }
110 }
111 }
112
113 #endregion Private Methods
114
115 #region Public Methods
116
117 public int GetMostRecentRevision(UUID regionid)
118 {
119 return NumOfRegionRev(regionid);
120 }
121
122 public string GetRegionObjectHeightMap(UUID regionid)
123 {
124 String filename = m_repodir + Slash.DirectorySeparatorChar + regionid +
125 Slash.DirectorySeparatorChar + "heightmap.r32";
126 FileStream fs = new FileStream(filename, FileMode.Open);
127 StreamReader sr = new StreamReader(fs);
128 String result = sr.ReadToEnd();
129 sr.Close();
130 fs.Close();
131 return result;
132 }
133
134 public string GetRegionObjectHeightMap(UUID regionid, int revision)
135 {
136 String filename = m_repodir + Slash.DirectorySeparatorChar + regionid +
137 Slash.DirectorySeparatorChar + "heightmap.r32";
138 FileStream fs = new FileStream(filename, FileMode.Open);
139 StreamReader sr = new StreamReader(fs);
140 String result = sr.ReadToEnd();
141 sr.Close();
142 fs.Close();
143 return result;
144 }
145
146 public System.Collections.ArrayList GetRegionObjectXMLList(UUID regionid, int revision)
147 {
148 System.Collections.ArrayList objectList = new System.Collections.ArrayList();
149 string filename = m_repodir + Slash.DirectorySeparatorChar + regionid + Slash.DirectorySeparatorChar +
150 + revision + Slash.DirectorySeparatorChar + "objects.xml";
151 XmlDocument doc = new XmlDocument();
152 XmlNode rootNode;
153 //int primCount = 0;
154 //SceneObjectGroup obj = null;
155
156 if (File.Exists(filename))
157 {
158 XmlTextReader reader = new XmlTextReader(filename);
159 reader.WhitespaceHandling = WhitespaceHandling.None;
160 doc.Load(reader);
161 reader.Close();
162 rootNode = doc.FirstChild;
163 foreach (XmlNode aPrimNode in rootNode.ChildNodes)
164 {
165 objectList.Add(aPrimNode.OuterXml);
166 }
167 return objectList;
168 }
169 return null;
170 }
171
172 public System.Collections.ArrayList GetRegionObjectXMLList(UUID regionid)
173 {
174 int revision = NumOfRegionRev(regionid);
175 m_log.Info("[FSDB]: found revisions:" + revision);
176 System.Collections.ArrayList xmlList = new System.Collections.ArrayList();
177 string filename = m_repodir + Slash.DirectorySeparatorChar + regionid + Slash.DirectorySeparatorChar +
178 + revision + Slash.DirectorySeparatorChar + "objects.xml";
179 XmlDocument doc = new XmlDocument();
180 XmlNode rootNode;
181
182 m_log.Info("[FSDB]: Checking if " + filename + " exists.");
183 if (File.Exists(filename))
184 {
185 Stopwatch x = new Stopwatch();
186 x.Start();
187
188 XmlTextReader reader = new XmlTextReader(filename);
189 reader.WhitespaceHandling = WhitespaceHandling.None;
190 doc.Load(reader);
191 reader.Close();
192 rootNode = doc.FirstChild;
193
194 foreach (XmlNode aPrimNode in rootNode.ChildNodes)
195 {
196 xmlList.Add(aPrimNode.OuterXml);
197 }
198
199 x.Stop();
200 TimeToDownload += x.ElapsedMilliseconds;
201 m_log.Info("[FileSystemDatabase] Time spent retrieving xml files so far: " + TimeToDownload);
202
203 return xmlList;
204 }
205 return null;
206 }
207
208 public void Initialise(Scene scene, string dir)
209 {
210 lock (this)
211 {
212 if (m_repodir == null)
213 m_repodir = dir;
214 }
215 lock (m_scenes)
216 m_scenes.Add(scene.RegionInfo.RegionID, scene);
217 }
218
219 public System.Collections.Generic.SortedDictionary<string, string> ListOfRegionRevisions(UUID regionid)
220 {
221 SortedDictionary<string, string> revisionDict = new SortedDictionary<string,string>();
222
223 string scenedir = m_repodir + Slash.DirectorySeparatorChar + regionid + Slash.DirectorySeparatorChar;
224 string[] directories = Directory.GetDirectories(scenedir);
225
226 FileStream fs = null;
227 StreamReader sr = null;
228 String logMessage = "";
229 String logLocation = "";
230 foreach (string revisionDir in directories)
231 {
232 try
233 {
234 logLocation = revisionDir + Slash.DirectorySeparatorChar + "log";
235 fs = new FileStream(logLocation, FileMode.Open);
236 sr = new StreamReader(fs);
237 logMessage = sr.ReadToEnd();
238 sr.Close();
239 fs.Close();
240 revisionDict.Add(revisionDir, logMessage);
241 }
242 catch (Exception)
243 {
244 }
245 }
246
247 return revisionDict;
248 }
249
250 public int NumOfRegionRev(UUID regionid)
251 {
252 string scenedir = m_repodir + Slash.DirectorySeparatorChar + regionid + Slash.DirectorySeparatorChar;
253 m_log.Info("[FSDB]: Reading scene dir: " + scenedir);
254 string[] directories = Directory.GetDirectories(scenedir);
255 return directories.Length;
256 }
257
258 // Run once and only once.
259 public void PostInitialise()
260 {
261 SetupSerialiser();
262
263 m_log.Info("[FSDB]: Creating repository in " + m_repodir + ".");
264 CreateDirectory();
265 }
266
267 public void SaveRegion(UUID regionid, string regionName, string logMessage)
268 {
269 m_log.Info("[FSDB]: ...............................");
270 string scenedir = m_repodir + Slash.DirectorySeparatorChar + regionid + Slash.DirectorySeparatorChar;
271
272 m_log.Info("[FSDB]: checking if scene directory exists: " + scenedir);
273 if (!Directory.Exists(scenedir))
274 Directory.CreateDirectory(scenedir);
275
276 int newRevisionNum = GetMostRecentRevision(regionid)+1;
277 string revisiondir = scenedir + newRevisionNum + Slash.DirectorySeparatorChar;
278
279 m_log.Info("[FSDB]: checking if revision directory exists: " + revisiondir);
280 if (!Directory.Exists(revisiondir))
281 Directory.CreateDirectory(revisiondir);
282
283 try {
284 Stopwatch x = new Stopwatch();
285 x.Start();
286 if (m_scenes.ContainsKey(regionid))
287 {
288 m_serialiser[regionid].SerialiseRegion(m_scenes[regionid], revisiondir);
289 }
290 x.Stop();
291 TimeToSave += x.ElapsedMilliseconds;
292 m_log.Info("[FileSystemDatabase] Time spent serialising regions to files on disk for " + regionName + ": " + x.ElapsedMilliseconds);
293 m_log.Info("[FileSystemDatabase] Time spent serialising regions to files on disk so far: " + TimeToSave);
294 }
295 catch (Exception e)
296 {
297 m_log.ErrorFormat("[FSDB]: Serialisation of region failed: " + e);
298 return;
299 }
300
301 try {
302 // Finish by writing log message.
303 FileStream file = new FileStream(revisiondir + "log", FileMode.Create, FileAccess.ReadWrite);
304 StreamWriter sw = new StreamWriter(file);
305 sw.Write(logMessage);
306 sw.Close();
307 }
308 catch (Exception e)
309 {
310 m_log.ErrorFormat("[FSDB]: Failed trying to save log file " + e);
311 return;
312 }
313 }
314
315 #endregion Public Methods
316 }
317}
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/GitDatabase.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/GitDatabase.cs
deleted file mode 100644
index 80a0a93..0000000
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/GitDatabase.cs
+++ /dev/null
@@ -1,167 +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#region Header
29
30// GitDatabase.cs
31//
32//
33//
34
35#endregion Header
36
37using System;
38using System.Collections.Generic;
39using System.IO;
40using Slash = System.IO.Path;
41using System.Reflection;
42using System.Xml;
43
44using OpenMetaverse;
45
46using Nini.Config;
47
48using OpenSim.Framework;
49using OpenSim.Region.Framework.Interfaces;
50using OpenSim.Region.Framework.Scenes;
51using OpenSim.Region.CoreModules.World.Serialiser;
52using OpenSim.Region.CoreModules.World.Terrain;
53using OpenSim.Region.Physics.Manager;
54
55using log4net;
56
57namespace OpenSim.Region.OptionalModules.ContentManagement
58{
59 /// <summary>
60 /// Just a stub :-(
61 /// </summary>
62 public class GitDatabase : IContentDatabase
63 {
64 #region Constructors
65
66 public GitDatabase()
67 {
68 }
69
70 #endregion Constructors
71
72 #region Public Methods
73
74 public SceneObjectGroup GetMostRecentObjectRevision(UUID id)
75 {
76 return null;
77 }
78
79 public int GetMostRecentRevision(UUID regionid)
80 {
81 return 0;
82 }
83
84 public SceneObjectGroup GetObjectRevision(UUID id, int revision)
85 {
86 return null;
87 }
88
89 public System.Collections.ArrayList GetObjectsFromRegion(UUID regionid, int revision)
90 {
91 return null;
92 }
93
94 public string GetRegionObjectHeightMap(UUID regionid)
95 {
96 return null;
97 }
98
99 public string GetRegionObjectHeightMap(UUID regionid, int revision)
100 {
101 return null;
102 }
103
104 public string GetRegionObjectXML(UUID regionid)
105 {
106 return null;
107 }
108
109 public string GetRegionObjectXML(UUID regionid, int revision)
110 {
111 return null;
112 }
113
114 public System.Collections.ArrayList GetRegionObjectXMLList(UUID regionid)
115 {
116 return null;
117 }
118
119 public System.Collections.ArrayList GetRegionObjectXMLList(UUID regionid, int revision)
120 {
121 return null;
122 }
123
124 public bool InRepository(UUID id)
125 {
126 return false;
127 }
128
129 public void Initialise(Scene scene, String dir)
130 {
131 }
132
133 public System.Collections.Generic.SortedDictionary<string, string> ListOfObjectRevisions(UUID id)
134 {
135 return null;
136 }
137
138 public System.Collections.Generic.SortedDictionary<string, string> ListOfRegionRevisions(UUID id)
139 {
140 return null;
141 }
142
143 public int NumOfObjectRev(UUID id)
144 {
145 return 0;
146 }
147
148 public int NumOfRegionRev(UUID regionid)
149 {
150 return 0;
151 }
152
153 public void PostInitialise()
154 {
155 }
156
157 public void SaveObject(SceneObjectGroup entity)
158 {
159 }
160
161 public void SaveRegion(UUID regionid, string regionName, string logMessage)
162 {
163 }
164
165 #endregion Public Methods
166 }
167}
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/IContentDatabase.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/IContentDatabase.cs
deleted file mode 100644
index fc1f115..0000000
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/IContentDatabase.cs
+++ /dev/null
@@ -1,94 +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#region Header
29
30// IContentDatabase.cs
31// User: bongiojp
32//
33//
34//
35
36#endregion Header
37
38using System;
39using OpenMetaverse;
40using OpenSim.Region.Framework.Scenes;
41using Nini.Config;
42
43namespace OpenSim.Region.OptionalModules.ContentManagement
44{
45 public interface IContentDatabase
46 {
47 #region Methods
48
49 /// <summary>
50 /// Returns the most recent revision number of a region.
51 /// </summary>
52 int GetMostRecentRevision(UUID regionid);
53
54 string GetRegionObjectHeightMap(UUID regionid);
55
56 string GetRegionObjectHeightMap(UUID regionid, int revision);
57
58 /// <summary>
59 /// Retrieves the xml that describes each individual object from the last revision or specific revision of the given region.
60 /// </summary>
61 System.Collections.ArrayList GetRegionObjectXMLList(UUID regionid);
62
63 System.Collections.ArrayList GetRegionObjectXMLList(UUID regionid, int revision);
64
65 /// <summary>
66 /// Similar to the IRegionModule function. This is the function to be called before attempting to interface with the database.
67 /// Initialise should be called one for each region to be contained in the database. The directory should be the full path
68 /// to the repository and will only be defined once, regardless of how many times the method is called.
69 /// </summary>
70 void Initialise(Scene scene, String dir);
71
72 /// <summary>
73 /// Returns a list of the revision numbers and corresponding log messages for a given region.
74 /// </summary>
75 System.Collections.Generic.SortedDictionary<string, string> ListOfRegionRevisions(UUID id);
76
77 /// <summary>
78 /// Returns the total number of revisions saved for a specific region.
79 /// </summary>
80 int NumOfRegionRev(UUID regionid);
81
82 /// <summary>
83 /// Should be called once after Initialise has been called.
84 /// </summary>
85 void PostInitialise();
86
87 /// <summary>
88 /// Saves the Region terrain map and objects within the region as xml to the database.
89 /// </summary>
90 void SaveRegion(UUID regionid, string regionName, string logMessage);
91
92 #endregion Methods
93 }
94}
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
deleted file mode 100644
index c7b1ed7..0000000
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
+++ /dev/null
@@ -1,270 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Drawing;
31
32using OpenMetaverse;
33
34using Nini.Config;
35
36using OpenSim.Framework;
37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Region.Framework.Scenes.Serialization;
40using OpenSim.Region.Physics.Manager;
41
42using log4net;
43
44namespace OpenSim.Region.OptionalModules.ContentManagement
45{
46 public class MetaEntity
47 {
48 #region Constants
49
50 public const float INVISIBLE = .95f;
51
52 // Settings for transparency of metaentity
53 public const float NONE = 0f;
54 public const float TRANSLUCENT = .5f;
55
56 #endregion Constants
57
58 #region Static Fields
59
60 //private static readonly ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
61
62 #endregion Static Fields
63
64 #region Fields
65
66 protected SceneObjectGroup m_Entity = null; // The scene object group that represents this meta entity.
67 protected uint m_metaLocalid;
68
69 #endregion Fields
70
71 #region Constructors
72
73 public MetaEntity()
74 {
75 }
76
77 /// <summary>
78 /// Makes a new meta entity by copying the given scene object group.
79 /// The physics boolean is just a stub right now.
80 /// </summary>
81 public MetaEntity(SceneObjectGroup orig, bool physics)
82 {
83 m_Entity = orig.Copy(false);
84 Initialize(physics);
85 }
86
87 /// <summary>
88 /// Takes an XML description of a scene object group and converts it to a meta entity.
89 /// </summary>
90 public MetaEntity(string objectXML, Scene scene, bool physics)
91 {
92 m_Entity = SceneObjectSerializer.FromXml2Format(objectXML);
93 m_Entity.SetScene(scene);
94 Initialize(physics);
95 }
96
97 #endregion Constructors
98
99 #region Public Properties
100
101 public SceneObjectPart[] Parts
102 {
103 get { return m_Entity.Parts; }
104 }
105
106 public uint LocalId
107 {
108 get { return m_Entity.LocalId; }
109 set { m_Entity.LocalId = value; }
110 }
111
112 public SceneObjectGroup ObjectGroup
113 {
114 get { return m_Entity; }
115 }
116
117 public int PrimCount
118 {
119 get { return m_Entity.PrimCount; }
120 }
121
122 public SceneObjectPart RootPart
123 {
124 get { return m_Entity.RootPart; }
125 }
126
127 public Scene Scene
128 {
129 get { return m_Entity.Scene; }
130 }
131
132 public UUID UUID
133 {
134 get { return m_Entity.UUID; }
135 set { m_Entity.UUID = value; }
136 }
137
138 #endregion Public Properties
139
140 #region Protected Methods
141
142 // The metaentity objectgroup must have unique localids as well as unique uuids.
143 // localids are used by the client to refer to parts.
144 // uuids are sent to the client and back to the server to identify parts on the server side.
145 /// <summary>
146 /// Changes localids and uuids of m_Entity.
147 /// </summary>
148 protected void Initialize(bool physics)
149 {
150 //make new uuids
151 Dictionary<UUID, SceneObjectPart> parts = new Dictionary<UUID, SceneObjectPart>();
152
153 foreach (SceneObjectPart part in m_Entity.Parts)
154 {
155 part.ResetIDs(part.LinkNum);
156 parts.Add(part.UUID, part);
157 }
158
159 //finalize
160 m_Entity.RootPart.PhysActor = null;
161 foreach (SceneObjectPart part in parts.Values)
162 m_Entity.AddPart(part);
163 }
164
165 #endregion Protected Methods
166
167 #region Public Methods
168
169 /// <summary>
170 /// Hides the metaentity from a single client.
171 /// </summary>
172 public virtual void Hide(IClientAPI client)
173 {
174 //This deletes the group without removing from any databases.
175 //This is important because we are not IN any database.
176 //m_Entity.FakeDeleteGroup();
177 foreach (SceneObjectPart part in m_Entity.Parts)
178 client.SendKillObject(m_Entity.RegionHandle, part.LocalId);
179 }
180
181 /// <summary>
182 /// Sends a kill object message to all clients, effectively "hiding" the metaentity even though it's still on the server.
183 /// </summary>
184 public virtual void HideFromAll()
185 {
186 foreach (SceneObjectPart part in m_Entity.Parts)
187 {
188 m_Entity.Scene.ForEachClient(
189 delegate(IClientAPI controller)
190 { controller.SendKillObject(m_Entity.RegionHandle, part.LocalId); }
191 );
192 }
193 }
194
195 public void SendFullUpdate(IClientAPI client)
196 {
197 // Not sure what clientFlags should be but 0 seems to work
198 SendFullUpdate(client, 0);
199 }
200
201 public void SendFullUpdate(IClientAPI client, uint clientFlags)
202 {
203 m_Entity.SendFullUpdateToClient(client);
204 }
205
206 public void SendFullUpdateToAll()
207 {
208 m_Entity.Scene.ForEachClient(
209 delegate(IClientAPI controller)
210 { m_Entity.SendFullUpdateToClient(controller); }
211 );
212 }
213
214 /// <summary>
215 /// Makes a single SceneObjectPart see through.
216 /// </summary>
217 /// <param name="part">
218 /// A <see cref="SceneObjectPart"/>
219 /// The part to make see through
220 /// </param>
221 /// <param name="transparencyAmount">
222 /// A <see cref="System.Single"/>
223 /// The degree of transparency to imbue the part with, 0f being solid and .95f being invisible.
224 /// </param>
225 public static void SetPartTransparency(SceneObjectPart part, float transparencyAmount)
226 {
227 Primitive.TextureEntry tex = null;
228 Color4 texcolor;
229 try
230 {
231 tex = part.Shape.Textures;
232 texcolor = new Color4();
233 }
234 catch(Exception)
235 {
236 //m_log.ErrorFormat("[Content Management]: Exception thrown while accessing textures of scene object: " + e);
237 return;
238 }
239
240 for (uint i = 0; i < tex.FaceTextures.Length; i++)
241 {
242 try {
243 if (tex.FaceTextures[i] != null)
244 {
245 texcolor = tex.FaceTextures[i].RGBA;
246 texcolor.A = transparencyAmount;
247 tex.FaceTextures[i].RGBA = texcolor;
248 }
249 }
250 catch (Exception)
251 {
252 //m_log.ErrorFormat("[Content Management]: Exception thrown while accessing different face textures of object: " + e);
253 continue;
254 }
255 }
256 try {
257 texcolor = tex.DefaultTexture.RGBA;
258 texcolor.A = transparencyAmount;
259 tex.DefaultTexture.RGBA = texcolor;
260 part.Shape.TextureEntry = tex.GetBytes();
261 }
262 catch (Exception)
263 {
264 //m_log.Info("[Content Management]: Exception thrown while accessing default face texture of object: " + e);
265 }
266 }
267
268 #endregion Public Methods
269 }
270}
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs
deleted file mode 100644
index 2c5093f..0000000
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/PointMetaEntity.cs
+++ /dev/null
@@ -1,104 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Drawing;
31
32using OpenMetaverse;
33
34using Nini.Config;
35
36using OpenSim.Framework;
37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Region.Physics.Manager;
40
41using log4net;
42
43namespace OpenSim.Region.OptionalModules.ContentManagement
44{
45 public class PointMetaEntity : MetaEntity
46 {
47 #region Constructors
48
49 public PointMetaEntity(Scene scene, Vector3 groupPos, float transparency)
50 : base()
51 {
52 CreatePointEntity(scene, UUID.Random(), groupPos);
53 SetPartTransparency(m_Entity.RootPart, transparency);
54 }
55
56 public PointMetaEntity(Scene scene, UUID uuid, Vector3 groupPos, float transparency)
57 : base()
58 {
59 CreatePointEntity(scene, uuid, groupPos);
60 SetPartTransparency(m_Entity.RootPart, transparency);
61 }
62
63 #endregion Constructors
64
65 #region Private Methods
66
67 private void CreatePointEntity(Scene scene, UUID uuid, Vector3 groupPos)
68 {
69 SceneObjectPart y = new SceneObjectPart();
70
71 //Initialize part
72 y.Name = "Very Small Point";
73 y.RegionHandle = scene.RegionInfo.RegionHandle;
74 y.CreationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
75 y.OwnerID = UUID.Zero;
76 y.CreatorID = UUID.Zero;
77 y.LastOwnerID = UUID.Zero;
78 y.UUID = uuid;
79
80 y.Shape = PrimitiveBaseShape.CreateBox();
81 y.Scale = new Vector3(0.01f,0.01f,0.01f);
82 y.LastOwnerID = UUID.Zero;
83 y.GroupPosition = groupPos;
84 y.OffsetPosition = Vector3.Zero;
85 y.RotationOffset = Quaternion.Identity;
86 y.Velocity = Vector3.Zero;
87 y.AngularVelocity = Vector3.Zero;
88 y.Acceleration = Vector3.Zero;
89
90 y.Flags = 0;
91 y.TrimPermissions();
92
93 //Initialize group and add part as root part
94 SceneObjectGroup x = new SceneObjectGroup(y);
95 x.SetScene(scene);
96 x.RegionHandle = scene.RegionInfo.RegionHandle;
97 x.SetScene(scene);
98
99 m_Entity = x;
100 }
101
102 #endregion Private Methods
103 }
104}
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/README b/OpenSim/Region/OptionalModules/ContentManagementSystem/README
deleted file mode 100644
index 1a69fef..0000000
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/README
+++ /dev/null
@@ -1,52 +0,0 @@
1This module is meant to be built alone and not added to the Opensim code base. References are made to required dlls through a
2reference file, ContentManagement.mdp. Originally, for development, this project was contained in the Opensim/Region/Modules/
3directory.
4
5To compile: nant
6To use: Copy ContentManagement.dll into the bin directory of your Opensim build. You should find many other dlls in the same directory.
7
8
9--------------------------------------------------------------------------------------------------------------------
10To build the libgit.so file:
11
12#Download GIT git repository
13$ git clone git://git2.kernel.org/pub/OpenSim/Region/Environment/Modules/ContentManagementSystem/scm/git/git.git
14$ cd git
15
16#Compile GIT
17#Note that we are adding two extra flags to pass to gcc while compiling (-c and -fPIC)
18$ autoconf
19$ ./configure
20$ CFLAGS="-g -O2 -Wall -c -fPIC" make
21
22#Copy necessary object files (and some not so necessary) to their own directory for shared object file creation
23$ mkdir ../libgit-objects
24$ cp builtin*.o ../libgit-objects
25$ cp xdiff/*.o ../libgit-objects
26$ cp libgit.a ../libgit-objects
27
28#Remove the main symbol from any object files (like git.o)
29$ cd ../libgit-objects
30$ strip -N main *.o
31
32#Uncompress the plumbing objects from archive created by git
33$ ar x libgit.a
34
35#Create shared object file from all objects (including the zlib library)
36$ ld -shared -soname libgit.so.1 -o libgit.so.1.5.6.3 -lc -lz *.o
37
38
39#You can also just copy the following commands into a file and run as a script inside the git directory
40
41make clean
42autoconf
43./configure
44CFLAGS="-g -O2 -Wall -c -fPIC" make
45mkdir libgit-objects
46cp builtin*.o libgit-objects
47cp xdiff/*.o libgit-objects
48cp libgit.a libgit-objects
49cd libgit-objects
50strip -N main *.o
51ar x libgit.a
52ld -shared -soname libgit.so.1 -o libgit.so.1.5.6.3 -lc -lz *.o \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/SceneObjectGroupDiff.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/SceneObjectGroupDiff.cs
deleted file mode 100644
index a6afa5a..0000000
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/SceneObjectGroupDiff.cs
+++ /dev/null
@@ -1,216 +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#region Header
29
30// SceneObjectGroupDiff.cs
31// User: bongiojp
32
33#endregion Header
34
35using System;
36using System.Collections.Generic;
37using System.Diagnostics;
38using System.Drawing;
39
40using OpenMetaverse;
41
42using Nini.Config;
43
44using OpenSim.Framework;
45using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Region.Framework.Scenes;
47using OpenSim.Region.Physics.Manager;
48
49using log4net;
50
51namespace OpenSim.Region.OptionalModules.ContentManagement
52{
53 #region Enumerations
54
55 [Flags]
56 public enum Diff
57 {
58 NONE = 0,
59 FACECOLOR = 1,
60 SHAPE = 1<<1,
61 MATERIAL = 1<<2,
62 TEXTURE = 1<<3,
63 SCALE = 1<<4,
64 POSITION = 1<<5,
65 OFFSETPOSITION = 1<<6,
66 ROTATIONOFFSET = 1<<7,
67 ROTATIONALVELOCITY = 1<<8,
68 ACCELERATION = 1<<9,
69 ANGULARVELOCITY = 1<<10,
70 VELOCITY = 1<<11,
71 OBJECTOWNER = 1<<12,
72 PERMISSIONS = 1<<13,
73 DESCRIPTION = 1<<14,
74 NAME = 1<<15,
75 SCRIPT = 1<<16,
76 CLICKACTION = 1<<17,
77 PARTICLESYSTEM = 1<<18,
78 GLOW = 1<<19,
79 SALEPRICE = 1<<20,
80 SITNAME = 1<<21,
81 SITTARGETORIENTATION = 1<<22,
82 SITTARGETPOSITION = 1<<23,
83 TEXT = 1<<24,
84 TOUCHNAME = 1<<25
85 }
86
87 #endregion Enumerations
88
89 public static class Difference
90 {
91 #region Static Fields
92
93 static float TimeToDiff = 0;
94// private static readonly ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
95
96 #endregion Static Fields
97
98 #region Private Methods
99
100 private static bool AreQuaternionsEquivalent(Quaternion first, Quaternion second)
101 {
102 Vector3 firstVector = llRot2Euler(first);
103 Vector3 secondVector = llRot2Euler(second);
104 return AreVectorsEquivalent(firstVector, secondVector);
105 }
106
107 private static bool AreVectorsEquivalent(Vector3 first, Vector3 second)
108 {
109 if (TruncateSignificant(first.X, 2) == TruncateSignificant(second.X, 2)
110 && TruncateSignificant(first.Y, 2) == TruncateSignificant(second.Y, 2)
111 && TruncateSignificant(first.Z, 2) == TruncateSignificant(second.Z, 2)
112 )
113 return true;
114 else
115 return false;
116 }
117
118 // Taken from Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
119 private static double NormalizeAngle(double angle)
120 {
121 angle = angle % (Math.PI * 2);
122 if (angle < 0) angle = angle + Math.PI * 2;
123 return angle;
124 }
125
126 private static int TruncateSignificant(float num, int digits)
127 {
128 return (int) Math.Ceiling((Math.Truncate(num * 10 * digits)/10*digits));
129 // return (int) ((num * (10*digits))/10*digits);
130 }
131
132 // Taken from Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
133 // Also changed the original function from LSL_Types to LL types
134 private static Vector3 llRot2Euler(Quaternion r)
135 {
136 Quaternion t = new Quaternion(r.X * r.X, r.Y * r.Y, r.Z * r.Z, r.W * r.W);
137 double m = (t.X + t.Y + t.Z + t.W);
138 if (m == 0) return new Vector3();
139 double n = 2 * (r.Y * r.W + r.X * r.Z);
140 double p = m * m - n * n;
141 if (p > 0)
142 return new Vector3((float)NormalizeAngle(Math.Atan2(2.0 * (r.X * r.W - r.Y * r.Z), (-t.X - t.Y + t.Z + t.W))),
143 (float)NormalizeAngle(Math.Atan2(n, Math.Sqrt(p))),
144 (float)NormalizeAngle(Math.Atan2(2.0 * (r.Z * r.W - r.X * r.Y), (t.X - t.Y - t.Z + t.W))));
145 else if (n > 0)
146 return new Vector3(0.0f, (float)(Math.PI / 2), (float)NormalizeAngle(Math.Atan2((r.Z * r.W + r.X * r.Y), 0.5 - t.X - t.Z)));
147 else
148 return new Vector3(0.0f, (float)(-Math.PI / 2), (float)NormalizeAngle(Math.Atan2((r.Z * r.W + r.X * r.Y), 0.5 - t.X - t.Z)));
149 }
150
151 #endregion Private Methods
152
153 #region Public Methods
154
155 /// <summary>
156 /// Compares the attributes (Vectors, Quaternions, Strings, etc.) between two scene object parts
157 /// and returns a Diff bitmask which details what the differences are.
158 /// </summary>
159 public static Diff FindDifferences(SceneObjectPart first, SceneObjectPart second)
160 {
161 Stopwatch x = new Stopwatch();
162 x.Start();
163
164 Diff result = 0;
165
166 // VECTOR COMPARISONS
167 if (!AreVectorsEquivalent(first.Acceleration, second.Acceleration))
168 result |= Diff.ACCELERATION;
169 if (!AreVectorsEquivalent(first.AbsolutePosition, second.AbsolutePosition))
170 result |= Diff.POSITION;
171 if (!AreVectorsEquivalent(first.AngularVelocity, second.AngularVelocity))
172 result |= Diff.ANGULARVELOCITY;
173 if (!AreVectorsEquivalent(first.OffsetPosition, second.OffsetPosition))
174 result |= Diff.OFFSETPOSITION;
175 if (!AreVectorsEquivalent(first.Scale, second.Scale))
176 result |= Diff.SCALE;
177 if (!AreVectorsEquivalent(first.Velocity, second.Velocity))
178 result |= Diff.VELOCITY;
179
180
181 // QUATERNION COMPARISONS
182 if (!AreQuaternionsEquivalent(first.RotationOffset, second.RotationOffset))
183 result |= Diff.ROTATIONOFFSET;
184
185
186 // MISC COMPARISONS (UUID, Byte)
187 if (first.ClickAction != second.ClickAction)
188 result |= Diff.CLICKACTION;
189 if (first.OwnerID != second.OwnerID)
190 result |= Diff.OBJECTOWNER;
191
192
193 // STRING COMPARISONS
194 if (first.Description != second.Description)
195 result |= Diff.DESCRIPTION;
196 if (first.Material != second.Material)
197 result |= Diff.MATERIAL;
198 if (first.Name != second.Name)
199 result |= Diff.NAME;
200 if (first.SitName != second.SitName)
201 result |= Diff.SITNAME;
202 if (first.Text != second.Text)
203 result |= Diff.TEXT;
204 if (first.TouchName != second.TouchName)
205 result |= Diff.TOUCHNAME;
206
207 x.Stop();
208 TimeToDiff += x.ElapsedMilliseconds;
209 //m_log.Info("[DIFFERENCES] Time spent diffing objects so far" + TimeToDiff);
210
211 return result;
212 }
213
214 #endregion Public Methods
215 }
216}