aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/DOMap.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/DOMap.cs (renamed from OpenSim/ApplicationPlugins/Rest/Regions/RestRegionPlugin.cs)90
1 files changed, 47 insertions, 43 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/RestRegionPlugin.cs b/OpenSim/Framework/DOMap.cs
index 02ef588..755e129 100644
--- a/OpenSim/ApplicationPlugins/Rest/Regions/RestRegionPlugin.cs
+++ b/OpenSim/Framework/DOMap.cs
@@ -26,69 +26,73 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.IO;
32using System.Text;
33using System.Xml;
34using System.Xml.Schema;
29using System.Xml.Serialization; 35using System.Xml.Serialization;
36using OpenMetaverse;
37using OpenMetaverse.StructuredData;
30 38
31namespace OpenSim.ApplicationPlugins.Rest.Regions 39namespace OpenSim.Framework
32{ 40{
33 public partial class RestRegionPlugin : RestPlugin 41 /// <summary>
42 /// This class stores and retrieves dynamic objects.
43 /// </summary>
44 /// <remarks>
45 /// Experimental - DO NOT USE.
46 /// </remarks>
47 public class DOMap
34 { 48 {
35 private static XmlSerializerNamespaces _xmlNs; 49 private IDictionary<string, object> m_map;
36 50
37 static RestRegionPlugin() 51 public void Add(string key, object dynObj)
38 { 52 {
39 _xmlNs = new XmlSerializerNamespaces(); 53 DAMap.ValidateKey(key);
40 _xmlNs.Add(String.Empty, String.Empty);
41 }
42 54
43 #region overriding properties 55 lock (this)
44 public override string Name 56 {
45 { 57 if (m_map == null)
46 get { return "REGION"; } 58 m_map = new Dictionary<string, object>();
59
60 m_map.Add(key, dynObj);
61 }
47 } 62 }
48 63
49 public override string ConfigName 64 public bool ContainsKey(string key)
50 { 65 {
51 get { return "RestRegionPlugin"; } 66 return Get(key) != null;
52 } 67 }
53 #endregion overriding properties
54 68
55 #region overriding methods
56 /// <summary> 69 /// <summary>
57 /// This method is called by OpenSimMain immediately after loading the 70 /// Get a dynamic object
58 /// plugin and after basic server setup, but before running any server commands.
59 /// </summary> 71 /// </summary>
60 /// <remarks> 72 /// <remarks>
61 /// Note that entries MUST be added to the active configuration files before 73 /// Not providing an index method so that users can't casually overwrite each other's objects.
62 /// the plugin can be enabled.
63 /// </remarks> 74 /// </remarks>
64 public override void Initialise(OpenSimBase openSim) 75 /// <param name='key'></param>
76 public object Get(string key)
65 { 77 {
66 try 78 lock (this)
67 { 79 {
68 base.Initialise(openSim); 80 if (m_map == null)
69 if (!IsEnabled) 81 return null;
70 { 82 else
71 //m_log.WarnFormat("{0} Rest Plugins are disabled", MsgID); 83 return m_map[key];
72 return;
73 }
74
75 m_log.InfoFormat("{0} REST region plugin enabled", MsgID);
76
77 // add REST method handlers
78 AddRestStreamHandler("GET", "/regions/", GetHandler);
79 AddRestStreamHandler("POST", "/regions/", PostHandler);
80 AddRestStreamHandler("GET", "/regioninfo/", GetRegionInfoHandler);
81 }
82 catch (Exception e)
83 {
84 m_log.WarnFormat("{0} Initialization failed: {1}", MsgID, e.Message);
85 m_log.DebugFormat("{0} Initialization failed: {1}", MsgID, e.ToString());
86 } 84 }
87 } 85 }
88 86
89 public override void Close() 87 public bool Remove(string key)
90 { 88 {
89 lock (this)
90 {
91 if (m_map == null)
92 return false;
93 else
94 return m_map.Remove(key);
95 }
91 } 96 }
92 #endregion overriding methods
93 } 97 }
94} 98} \ No newline at end of file