diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 186 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneBase.cs | 177 |
2 files changed, 182 insertions, 181 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 8d3792c..f798a0e 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -113,25 +113,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
113 | get { return m_sceneGridService; } | 113 | get { return m_sceneGridService; } |
114 | } | 114 | } |
115 | 115 | ||
116 | /// <value> | ||
117 | /// All the region modules attached to this scene. | ||
118 | /// </value> | ||
119 | public Dictionary<string, IRegionModule> Modules | ||
120 | { | ||
121 | get { return m_modules; } | ||
122 | } | ||
123 | protected Dictionary<string, IRegionModule> m_modules = new Dictionary<string, IRegionModule>(); | ||
124 | |||
125 | /// <value> | ||
126 | /// The module interfaces available from this scene. | ||
127 | /// </value> | ||
128 | protected Dictionary<Type, List<object> > ModuleInterfaces = new Dictionary<Type, List<object> >(); | ||
129 | |||
130 | protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>(); | ||
131 | protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>(); | ||
132 | |||
133 | //API module interfaces | ||
134 | |||
135 | public IXfer XferManager; | 116 | public IXfer XferManager; |
136 | 117 | ||
137 | protected IXMLRPC m_xmlrpcModule; | 118 | protected IXMLRPC m_xmlrpcModule; |
@@ -281,11 +262,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
281 | 262 | ||
282 | public int objectCapacity = 45000; | 263 | public int objectCapacity = 45000; |
283 | 264 | ||
284 | /// <value> | ||
285 | /// Registered classes that are capable of creating entities. | ||
286 | /// </value> | ||
287 | protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>(); | ||
288 | |||
289 | #endregion | 265 | #endregion |
290 | 266 | ||
291 | #region Constructors | 267 | #region Constructors |
@@ -737,16 +713,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
737 | // De-register with region communications (events cleanup) | 713 | // De-register with region communications (events cleanup) |
738 | UnRegisterRegionWithComms(); | 714 | UnRegisterRegionWithComms(); |
739 | 715 | ||
740 | // Shut down all non shared modules. | ||
741 | foreach (IRegionModule module in Modules.Values) | ||
742 | { | ||
743 | if (!module.IsSharedModule) | ||
744 | { | ||
745 | module.Close(); | ||
746 | } | ||
747 | } | ||
748 | Modules.Clear(); | ||
749 | |||
750 | // call the base class Close method. | 716 | // call the base class Close method. |
751 | base.Close(); | 717 | base.Close(); |
752 | } | 718 | } |
@@ -1838,6 +1804,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1838 | /// <summary> | 1804 | /// <summary> |
1839 | /// Add an object into the scene that has come from storage | 1805 | /// Add an object into the scene that has come from storage |
1840 | /// </summary> | 1806 | /// </summary> |
1807 | /// | ||
1841 | /// <param name="sceneObject"></param> | 1808 | /// <param name="sceneObject"></param> |
1842 | /// <param name="attachToBackup"> | 1809 | /// <param name="attachToBackup"> |
1843 | /// If true, changes to the object will be reflected in its persisted data | 1810 | /// If true, changes to the object will be reflected in its persisted data |
@@ -3158,128 +3125,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
3158 | 3125 | ||
3159 | #endregion | 3126 | #endregion |
3160 | 3127 | ||
3161 | #region Module Methods | 3128 | #region Other Methods |
3162 | 3129 | ||
3163 | /// <summary> | ||
3164 | /// Add a module to this scene. | ||
3165 | /// </summary> | ||
3166 | /// <param name="name"></param> | ||
3167 | /// <param name="module"></param> | ||
3168 | public void AddModule(string name, IRegionModule module) | ||
3169 | { | ||
3170 | if (!Modules.ContainsKey(name)) | ||
3171 | { | ||
3172 | Modules.Add(name, module); | ||
3173 | } | ||
3174 | } | ||
3175 | |||
3176 | public void RegisterModuleCommander(string name, ICommander commander) | ||
3177 | { | ||
3178 | lock (m_moduleCommanders) | ||
3179 | { | ||
3180 | m_moduleCommanders.Add(name, commander); | ||
3181 | } | ||
3182 | } | ||
3183 | |||
3184 | public ICommander GetCommander(string name) | ||
3185 | { | ||
3186 | lock (m_moduleCommanders) | ||
3187 | { | ||
3188 | return m_moduleCommanders[name]; | ||
3189 | } | ||
3190 | } | ||
3191 | |||
3192 | public Dictionary<string, ICommander> GetCommanders() | ||
3193 | { | ||
3194 | return m_moduleCommanders; | ||
3195 | } | ||
3196 | |||
3197 | /// <summary> | ||
3198 | /// Register an interface to a region module. This allows module methods to be called directly as | ||
3199 | /// well as via events. If there is already a module registered for this interface, it is not replaced | ||
3200 | /// (is this the best behaviour?) | ||
3201 | /// </summary> | ||
3202 | /// <param name="mod"></param> | ||
3203 | public void RegisterModuleInterface<M>(M mod) | ||
3204 | { | ||
3205 | if (!ModuleInterfaces.ContainsKey(typeof(M))) | ||
3206 | { | ||
3207 | List<Object> l = new List<Object>(); | ||
3208 | l.Add(mod); | ||
3209 | ModuleInterfaces.Add(typeof(M), l); | ||
3210 | |||
3211 | if (mod is IEntityCreator) | ||
3212 | { | ||
3213 | IEntityCreator entityCreator = (IEntityCreator)mod; | ||
3214 | foreach (PCode pcode in entityCreator.CreationCapabilities) | ||
3215 | { | ||
3216 | m_entityCreators[pcode] = entityCreator; | ||
3217 | } | ||
3218 | } | ||
3219 | } | ||
3220 | } | ||
3221 | |||
3222 | public void StackModuleInterface<M>(M mod) | ||
3223 | { | ||
3224 | List<Object> l; | ||
3225 | if (ModuleInterfaces.ContainsKey(typeof(M))) | ||
3226 | l = ModuleInterfaces[typeof(M)]; | ||
3227 | else | ||
3228 | l = new List<Object>(); | ||
3229 | |||
3230 | if (l.Contains(mod)) | ||
3231 | return; | ||
3232 | |||
3233 | l.Add(mod); | ||
3234 | |||
3235 | if (mod is IEntityCreator) | ||
3236 | { | ||
3237 | IEntityCreator entityCreator = (IEntityCreator)mod; | ||
3238 | foreach (PCode pcode in entityCreator.CreationCapabilities) | ||
3239 | { | ||
3240 | m_entityCreators[pcode] = entityCreator; | ||
3241 | } | ||
3242 | } | ||
3243 | |||
3244 | ModuleInterfaces[typeof(M)] = l; | ||
3245 | } | ||
3246 | |||
3247 | /// <summary> | ||
3248 | /// For the given interface, retrieve the region module which implements it. | ||
3249 | /// </summary> | ||
3250 | /// <returns>null if there is no registered module implementing that interface</returns> | ||
3251 | public override T RequestModuleInterface<T>() | ||
3252 | { | ||
3253 | if (ModuleInterfaces.ContainsKey(typeof(T))) | ||
3254 | { | ||
3255 | return (T)ModuleInterfaces[typeof(T)][0]; | ||
3256 | } | ||
3257 | else | ||
3258 | { | ||
3259 | return default(T); | ||
3260 | } | ||
3261 | } | ||
3262 | |||
3263 | /// <summary> | ||
3264 | /// For the given interface, retrieve an array of region modules that implement it. | ||
3265 | /// </summary> | ||
3266 | /// <returns>an empty array if there are no registered modules implementing that interface</returns> | ||
3267 | public override T[] RequestModuleInterfaces<T>() | ||
3268 | { | ||
3269 | if (ModuleInterfaces.ContainsKey(typeof(T))) | ||
3270 | { | ||
3271 | List<T> ret = new List<T>(); | ||
3272 | |||
3273 | foreach (Object o in ModuleInterfaces[typeof(T)]) | ||
3274 | ret.Add((T)o); | ||
3275 | return ret.ToArray(); | ||
3276 | } | ||
3277 | else | ||
3278 | { | ||
3279 | return new T[] { default(T) }; | ||
3280 | } | ||
3281 | } | ||
3282 | |||
3283 | public void SetObjectCapacity(int objects) | 3130 | public void SetObjectCapacity(int objects) |
3284 | { | 3131 | { |
3285 | // Region specific config overrides global | 3132 | // Region specific config overrides global |
@@ -3293,7 +3140,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
3293 | } | 3140 | } |
3294 | objectCapacity = objects; | 3141 | objectCapacity = objects; |
3295 | } | 3142 | } |
3296 | 3143 | ||
3297 | public List<FriendListItem> GetFriendList(UUID avatarID) | 3144 | public List<FriendListItem> GetFriendList(UUID avatarID) |
3298 | { | 3145 | { |
3299 | return CommsManager.GetUserFriendList(avatarID); | 3146 | return CommsManager.GetUserFriendList(avatarID); |
@@ -3314,10 +3161,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
3314 | return CommsManager.TriggerTerminateFriend(regionHandle, agentID, exFriendID); | 3161 | return CommsManager.TriggerTerminateFriend(regionHandle, agentID, exFriendID); |
3315 | } | 3162 | } |
3316 | 3163 | ||
3317 | #endregion | ||
3318 | |||
3319 | #region Other Methods | ||
3320 | |||
3321 | public virtual void StoreAddFriendship(UUID ownerID, UUID friendID, uint perms) | 3164 | public virtual void StoreAddFriendship(UUID ownerID, UUID friendID, uint perms) |
3322 | { | 3165 | { |
3323 | m_sceneGridService.AddNewUserFriend(ownerID, friendID, perms); | 3166 | m_sceneGridService.AddNewUserFriend(ownerID, friendID, perms); |
@@ -3563,12 +3406,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
3563 | } | 3406 | } |
3564 | } | 3407 | } |
3565 | 3408 | ||
3566 | /// <summary> | 3409 | public override void Show(string[] showParams) |
3567 | /// Shows various details about the sim based on the parameters supplied by the console command in openSimMain. | ||
3568 | /// </summary> | ||
3569 | /// <param name="showParams">What to show</param> | ||
3570 | public void Show(string[] showParams) | ||
3571 | { | 3410 | { |
3411 | base.Show(showParams); | ||
3412 | |||
3572 | switch (showParams[0]) | 3413 | switch (showParams[0]) |
3573 | { | 3414 | { |
3574 | case "users": | 3415 | case "users": |
@@ -3587,18 +3428,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
3587 | "Unknown", | 3428 | "Unknown", |
3588 | RegionInfo.RegionName); | 3429 | RegionInfo.RegionName); |
3589 | } | 3430 | } |
3431 | |||
3590 | break; | 3432 | break; |
3591 | case "modules": | 3433 | } |
3592 | m_log.Error("The currently loaded modules in " + RegionInfo.RegionName + " are:"); | ||
3593 | foreach (IRegionModule module in Modules.Values) | ||
3594 | { | ||
3595 | if (!module.IsSharedModule) | ||
3596 | { | ||
3597 | m_log.Error("Region Module: " + module.Name); | ||
3598 | } | ||
3599 | } | ||
3600 | break; | ||
3601 | } | ||
3602 | } | 3434 | } |
3603 | 3435 | ||
3604 | #region Script Handling Methods | 3436 | #region Script Handling Methods |
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index e6e2c93..4d6a39a 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs | |||
@@ -48,6 +48,30 @@ namespace OpenSim.Region.Environment.Scenes | |||
48 | #endregion | 48 | #endregion |
49 | 49 | ||
50 | #region Fields | 50 | #region Fields |
51 | |||
52 | /// <value> | ||
53 | /// All the region modules attached to this scene. | ||
54 | /// </value> | ||
55 | public Dictionary<string, IRegionModule> Modules | ||
56 | { | ||
57 | get { return m_modules; } | ||
58 | } | ||
59 | protected Dictionary<string, IRegionModule> m_modules = new Dictionary<string, IRegionModule>(); | ||
60 | |||
61 | /// <value> | ||
62 | /// The module interfaces available from this scene. | ||
63 | /// </value> | ||
64 | protected Dictionary<Type, List<object> > ModuleInterfaces = new Dictionary<Type, List<object> >(); | ||
65 | |||
66 | protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>(); | ||
67 | protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>(); | ||
68 | |||
69 | /// <value> | ||
70 | /// Registered classes that are capable of creating entities. | ||
71 | /// </value> | ||
72 | protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>(); | ||
73 | |||
74 | //API module interfaces | ||
51 | 75 | ||
52 | /// <summary> | 76 | /// <summary> |
53 | /// The last allocated local prim id. When a new local id is requested, the next number in the sequence is | 77 | /// The last allocated local prim id. When a new local id is requested, the next number in the sequence is |
@@ -202,6 +226,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
202 | /// </summary> | 226 | /// </summary> |
203 | public virtual void Close() | 227 | public virtual void Close() |
204 | { | 228 | { |
229 | // Shut down all non shared modules. | ||
230 | foreach (IRegionModule module in Modules.Values) | ||
231 | { | ||
232 | if (!module.IsSharedModule) | ||
233 | { | ||
234 | module.Close(); | ||
235 | } | ||
236 | } | ||
237 | Modules.Clear(); | ||
238 | |||
205 | try | 239 | try |
206 | { | 240 | { |
207 | EventManager.TriggerShutdown(); | 241 | EventManager.TriggerShutdown(); |
@@ -228,15 +262,150 @@ namespace OpenSim.Region.Environment.Scenes | |||
228 | 262 | ||
229 | return myID; | 263 | return myID; |
230 | } | 264 | } |
265 | |||
266 | #region Module Methods | ||
267 | |||
268 | /// <summary> | ||
269 | /// Add a module to this scene. | ||
270 | /// </summary> | ||
271 | /// <param name="name"></param> | ||
272 | /// <param name="module"></param> | ||
273 | public void AddModule(string name, IRegionModule module) | ||
274 | { | ||
275 | if (!Modules.ContainsKey(name)) | ||
276 | { | ||
277 | Modules.Add(name, module); | ||
278 | } | ||
279 | } | ||
280 | |||
281 | public void RegisterModuleCommander(string name, ICommander commander) | ||
282 | { | ||
283 | lock (m_moduleCommanders) | ||
284 | { | ||
285 | m_moduleCommanders.Add(name, commander); | ||
286 | } | ||
287 | } | ||
288 | |||
289 | public ICommander GetCommander(string name) | ||
290 | { | ||
291 | lock (m_moduleCommanders) | ||
292 | { | ||
293 | return m_moduleCommanders[name]; | ||
294 | } | ||
295 | } | ||
296 | |||
297 | public Dictionary<string, ICommander> GetCommanders() | ||
298 | { | ||
299 | return m_moduleCommanders; | ||
300 | } | ||
301 | |||
302 | /// <summary> | ||
303 | /// Register an interface to a region module. This allows module methods to be called directly as | ||
304 | /// well as via events. If there is already a module registered for this interface, it is not replaced | ||
305 | /// (is this the best behaviour?) | ||
306 | /// </summary> | ||
307 | /// <param name="mod"></param> | ||
308 | public void RegisterModuleInterface<M>(M mod) | ||
309 | { | ||
310 | if (!ModuleInterfaces.ContainsKey(typeof(M))) | ||
311 | { | ||
312 | List<Object> l = new List<Object>(); | ||
313 | l.Add(mod); | ||
314 | ModuleInterfaces.Add(typeof(M), l); | ||
315 | |||
316 | if (mod is IEntityCreator) | ||
317 | { | ||
318 | IEntityCreator entityCreator = (IEntityCreator)mod; | ||
319 | foreach (PCode pcode in entityCreator.CreationCapabilities) | ||
320 | { | ||
321 | m_entityCreators[pcode] = entityCreator; | ||
322 | } | ||
323 | } | ||
324 | } | ||
325 | } | ||
231 | 326 | ||
232 | public virtual T RequestModuleInterface<T>() | 327 | public void StackModuleInterface<M>(M mod) |
233 | { | 328 | { |
234 | return default(T); | 329 | List<Object> l; |
330 | if (ModuleInterfaces.ContainsKey(typeof(M))) | ||
331 | l = ModuleInterfaces[typeof(M)]; | ||
332 | else | ||
333 | l = new List<Object>(); | ||
334 | |||
335 | if (l.Contains(mod)) | ||
336 | return; | ||
337 | |||
338 | l.Add(mod); | ||
339 | |||
340 | if (mod is IEntityCreator) | ||
341 | { | ||
342 | IEntityCreator entityCreator = (IEntityCreator)mod; | ||
343 | foreach (PCode pcode in entityCreator.CreationCapabilities) | ||
344 | { | ||
345 | m_entityCreators[pcode] = entityCreator; | ||
346 | } | ||
347 | } | ||
348 | |||
349 | ModuleInterfaces[typeof(M)] = l; | ||
235 | } | 350 | } |
236 | 351 | ||
237 | public virtual T[] RequestModuleInterfaces<T>() | 352 | /// <summary> |
353 | /// For the given interface, retrieve the region module which implements it. | ||
354 | /// </summary> | ||
355 | /// <returns>null if there is no registered module implementing that interface</returns> | ||
356 | public T RequestModuleInterface<T>() | ||
238 | { | 357 | { |
239 | return new T[] { default(T) }; | 358 | if (ModuleInterfaces.ContainsKey(typeof(T))) |
359 | { | ||
360 | return (T)ModuleInterfaces[typeof(T)][0]; | ||
361 | } | ||
362 | else | ||
363 | { | ||
364 | return default(T); | ||
365 | } | ||
240 | } | 366 | } |
367 | |||
368 | /// <summary> | ||
369 | /// For the given interface, retrieve an array of region modules that implement it. | ||
370 | /// </summary> | ||
371 | /// <returns>an empty array if there are no registered modules implementing that interface</returns> | ||
372 | public T[] RequestModuleInterfaces<T>() | ||
373 | { | ||
374 | if (ModuleInterfaces.ContainsKey(typeof(T))) | ||
375 | { | ||
376 | List<T> ret = new List<T>(); | ||
377 | |||
378 | foreach (Object o in ModuleInterfaces[typeof(T)]) | ||
379 | ret.Add((T)o); | ||
380 | return ret.ToArray(); | ||
381 | } | ||
382 | else | ||
383 | { | ||
384 | return new T[] { default(T) }; | ||
385 | } | ||
386 | } | ||
387 | |||
388 | #endregion | ||
389 | |||
390 | /// <summary> | ||
391 | /// Shows various details about the sim based on the parameters supplied by the console command in openSimMain. | ||
392 | /// </summary> | ||
393 | /// <param name="showParams">What to show</param> | ||
394 | public virtual void Show(string[] showParams) | ||
395 | { | ||
396 | switch (showParams[0]) | ||
397 | { | ||
398 | case "modules": | ||
399 | m_log.Error("The currently loaded modules in " + RegionInfo.RegionName + " are:"); | ||
400 | foreach (IRegionModule module in Modules.Values) | ||
401 | { | ||
402 | if (!module.IsSharedModule) | ||
403 | { | ||
404 | m_log.Error("Region Module: " + module.Name); | ||
405 | } | ||
406 | } | ||
407 | break; | ||
408 | } | ||
409 | } | ||
241 | } | 410 | } |
242 | } | 411 | } |