diff options
author | Melanie | 2010-02-08 21:24:04 +0000 |
---|---|---|
committer | Melanie | 2010-02-08 21:24:04 +0000 |
commit | d8bab61af424d22c35519557f343145f3c685edc (patch) | |
tree | a0ca74b303d46c6d6b4c1f02b57176ae48947654 /OpenSim/Data | |
parent | Add InventoryService to default standalone config (diff) | |
download | opensim-SC_OLD-d8bab61af424d22c35519557f343145f3c685edc.zip opensim-SC_OLD-d8bab61af424d22c35519557f343145f3c685edc.tar.gz opensim-SC_OLD-d8bab61af424d22c35519557f343145f3c685edc.tar.bz2 opensim-SC_OLD-d8bab61af424d22c35519557f343145f3c685edc.tar.xz |
Convert NullRegionData to a singleton pattern, since that is required
for a standalone
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/Null/NullRegionData.cs | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs index dc68edb..5b9898c 100644 --- a/OpenSim/Data/Null/NullRegionData.cs +++ b/OpenSim/Data/Null/NullRegionData.cs | |||
@@ -31,20 +31,31 @@ using System.Collections.Generic; | |||
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Data; | 33 | using OpenSim.Data; |
34 | using System.Reflection; | ||
35 | using log4net; | ||
34 | 36 | ||
35 | namespace OpenSim.Data.Null | 37 | namespace OpenSim.Data.Null |
36 | { | 38 | { |
37 | public class NullRegionData : IRegionData | 39 | public class NullRegionData : IRegionData |
38 | { | 40 | { |
41 | private static NullRegionData Instance = null; | ||
42 | |||
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | |||
39 | Dictionary<UUID, RegionData> m_regionData = new Dictionary<UUID, RegionData>(); | 45 | Dictionary<UUID, RegionData> m_regionData = new Dictionary<UUID, RegionData>(); |
40 | 46 | ||
41 | public NullRegionData(string connectionString, string realm) | 47 | public NullRegionData(string connectionString, string realm) |
42 | { | 48 | { |
49 | if (Instance == null) | ||
50 | Instance = this; | ||
43 | //Console.WriteLine("[XXX] NullRegionData constructor"); | 51 | //Console.WriteLine("[XXX] NullRegionData constructor"); |
44 | } | 52 | } |
45 | 53 | ||
46 | public List<RegionData> Get(string regionName, UUID scopeID) | 54 | public List<RegionData> Get(string regionName, UUID scopeID) |
47 | { | 55 | { |
56 | if (Instance != this) | ||
57 | return Instance.Get(regionName, scopeID); | ||
58 | |||
48 | List<RegionData> ret = new List<RegionData>(); | 59 | List<RegionData> ret = new List<RegionData>(); |
49 | 60 | ||
50 | foreach (RegionData r in m_regionData.Values) | 61 | foreach (RegionData r in m_regionData.Values) |
@@ -69,6 +80,9 @@ namespace OpenSim.Data.Null | |||
69 | 80 | ||
70 | public RegionData Get(int posX, int posY, UUID scopeID) | 81 | public RegionData Get(int posX, int posY, UUID scopeID) |
71 | { | 82 | { |
83 | if (Instance != this) | ||
84 | return Instance.Get(posX, posY, scopeID); | ||
85 | |||
72 | List<RegionData> ret = new List<RegionData>(); | 86 | List<RegionData> ret = new List<RegionData>(); |
73 | 87 | ||
74 | foreach (RegionData r in m_regionData.Values) | 88 | foreach (RegionData r in m_regionData.Values) |
@@ -85,6 +99,9 @@ namespace OpenSim.Data.Null | |||
85 | 99 | ||
86 | public RegionData Get(UUID regionID, UUID scopeID) | 100 | public RegionData Get(UUID regionID, UUID scopeID) |
87 | { | 101 | { |
102 | if (Instance != this) | ||
103 | return Instance.Get(regionID, scopeID); | ||
104 | |||
88 | if (m_regionData.ContainsKey(regionID)) | 105 | if (m_regionData.ContainsKey(regionID)) |
89 | return m_regionData[regionID]; | 106 | return m_regionData[regionID]; |
90 | 107 | ||
@@ -93,6 +110,9 @@ namespace OpenSim.Data.Null | |||
93 | 110 | ||
94 | public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID) | 111 | public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID) |
95 | { | 112 | { |
113 | if (Instance != this) | ||
114 | return Instance.Get(startX, startY, endX, endY, scopeID); | ||
115 | |||
96 | List<RegionData> ret = new List<RegionData>(); | 116 | List<RegionData> ret = new List<RegionData>(); |
97 | 117 | ||
98 | foreach (RegionData r in m_regionData.Values) | 118 | foreach (RegionData r in m_regionData.Values) |
@@ -106,6 +126,9 @@ namespace OpenSim.Data.Null | |||
106 | 126 | ||
107 | public bool Store(RegionData data) | 127 | public bool Store(RegionData data) |
108 | { | 128 | { |
129 | if (Instance != this) | ||
130 | return Instance.Store(data); | ||
131 | |||
109 | m_regionData[data.RegionID] = data; | 132 | m_regionData[data.RegionID] = data; |
110 | 133 | ||
111 | return true; | 134 | return true; |
@@ -113,6 +136,9 @@ namespace OpenSim.Data.Null | |||
113 | 136 | ||
114 | public bool SetDataItem(UUID regionID, string item, string value) | 137 | public bool SetDataItem(UUID regionID, string item, string value) |
115 | { | 138 | { |
139 | if (Instance != this) | ||
140 | return Instance.SetDataItem(regionID, item, value); | ||
141 | |||
116 | if (!m_regionData.ContainsKey(regionID)) | 142 | if (!m_regionData.ContainsKey(regionID)) |
117 | return false; | 143 | return false; |
118 | 144 | ||
@@ -123,6 +149,9 @@ namespace OpenSim.Data.Null | |||
123 | 149 | ||
124 | public bool Delete(UUID regionID) | 150 | public bool Delete(UUID regionID) |
125 | { | 151 | { |
152 | if (Instance != this) | ||
153 | return Instance.Delete(regionID); | ||
154 | |||
126 | if (!m_regionData.ContainsKey(regionID)) | 155 | if (!m_regionData.ContainsKey(regionID)) |
127 | return false; | 156 | return false; |
128 | 157 | ||
@@ -133,12 +162,34 @@ namespace OpenSim.Data.Null | |||
133 | 162 | ||
134 | public List<RegionData> GetDefaultRegions(UUID scopeID) | 163 | public List<RegionData> GetDefaultRegions(UUID scopeID) |
135 | { | 164 | { |
136 | return new List<RegionData>(); | 165 | if (Instance != this) |
166 | return Instance.GetDefaultRegions(scopeID); | ||
167 | |||
168 | List<RegionData> ret = new List<RegionData>(); | ||
169 | |||
170 | foreach (RegionData r in m_regionData.Values) | ||
171 | { | ||
172 | if ((Convert.ToInt32(r.Data["flags"]) & 1) != 0) | ||
173 | ret.Add(r); | ||
174 | } | ||
175 | |||
176 | return ret; | ||
137 | } | 177 | } |
138 | 178 | ||
139 | public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) | 179 | public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y) |
140 | { | 180 | { |
141 | return new List<RegionData>(); | 181 | if (Instance != this) |
182 | return Instance.GetFallbackRegions(scopeID, x, y); | ||
183 | |||
184 | List<RegionData> ret = new List<RegionData>(); | ||
185 | |||
186 | foreach (RegionData r in m_regionData.Values) | ||
187 | { | ||
188 | if ((Convert.ToInt32(r.Data["flags"]) & 2) != 0) | ||
189 | ret.Add(r); | ||
190 | } | ||
191 | |||
192 | return ret; | ||
142 | } | 193 | } |
143 | } | 194 | } |
144 | } | 195 | } |