29 using System.Collections;
30 using System.Collections.Generic;
32 using OpenSim.Framework;
34 using System.Reflection;
38 namespace OpenSim.Data.Null
47 private bool m_useStaticInstance =
true;
51 Dictionary<UUID, RegionData> m_regionData =
new Dictionary<UUID, RegionData>();
63 if (connectionString ==
"!static")
64 m_useStaticInstance =
false;
65 else if (Instance == null)
69 private delegate
bool Matcher(
string value);
71 public List<RegionData>
Get(
string regionName, UUID scopeID)
73 if (m_useStaticInstance && Instance !=
this)
74 return Instance.Get(regionName, scopeID);
78 string cleanName = regionName.ToLower();
81 const string wildcard =
"%";
82 bool wildcardPrefix =
false;
83 bool wildcardSuffix =
false;
84 if (cleanName.Equals(wildcard))
86 wildcardPrefix = wildcardSuffix =
true;
87 cleanName = string.Empty;
91 if (cleanName.StartsWith(wildcard))
93 wildcardPrefix =
true;
94 cleanName = cleanName.Substring(1);
96 if (regionName.EndsWith(wildcard))
98 wildcardSuffix =
true;
99 cleanName = cleanName.Remove(cleanName.Length - 1);
104 if (wildcardPrefix && wildcardSuffix)
105 queryMatch = delegate(
string s) {
return s.Contains(cleanName); };
106 else if (wildcardSuffix)
107 queryMatch = delegate(
string s) {
return s.StartsWith(cleanName); };
108 else if (wildcardPrefix)
109 queryMatch = delegate(
string s) {
return s.EndsWith(cleanName); };
111 queryMatch = delegate(
string s) {
return s.Equals(cleanName); };
114 List<RegionData> ret =
new List<RegionData>();
134 if (m_useStaticInstance && Instance !=
this)
135 return Instance.Get(posX, posY, scopeID);
157 if (m_useStaticInstance && Instance !=
this)
158 return Instance.Get(regionID, scopeID);
162 if (m_regionData.ContainsKey(regionID))
163 return m_regionData[regionID];
169 public List<RegionData>
Get(
int startX,
int startY,
int endX,
int endY, UUID scopeID)
171 if (m_useStaticInstance && Instance !=
this)
172 return Instance.Get(startX, startY, endX, endY, scopeID);
174 List<RegionData> ret =
new List<RegionData>();
191 if (m_useStaticInstance && Instance !=
this)
192 return Instance.Store(data);
199 m_regionData[data.RegionID] = data;
207 if (m_useStaticInstance && Instance !=
this)
208 return Instance.SetDataItem(regionID, item, value);
212 if (!m_regionData.ContainsKey(regionID))
215 m_regionData[regionID].Data[item] = value;
223 if (m_useStaticInstance && Instance !=
this)
224 return Instance.Delete(regionID);
230 if (!m_regionData.ContainsKey(regionID))
233 m_regionData.Remove(regionID);
241 return Get((
int)
RegionFlags.DefaultRegion, scopeID);
246 return Get((
int)
RegionFlags.DefaultHGRegion, scopeID);
251 List<RegionData> regions = Get((
int)
RegionFlags.FallbackRegion, scopeID);
253 regions.Sort(distanceComparer);
262 private List<RegionData> Get(
int regionFlags, UUID scopeID)
264 if (Instance !=
this)
265 return Instance.Get(regionFlags, scopeID);
267 List<RegionData> ret =
new List<RegionData>();
273 if ((Convert.ToInt32(r.
Data[
"flags"]) & regionFlags) != 0)
List< RegionData > GetDefaultHypergridRegions(UUID scopeID)
int posX
The position in meters of this region.
An interface for connecting to the authentication datastore
OpenSim.Framework.RegionFlags RegionFlags
bool SetDataItem(UUID regionID, string item, string value)
int posY
The position in meters of this region.
Dictionary< string, object > Data
List< RegionData > Get(int startX, int startY, int endX, int endY, UUID scopeID)
RegionFlags
Region flags used internally by OpenSimulator to store installation specific information about region...
NullRegionData(string connectionString, string realm)
List< RegionData > GetFallbackRegions(UUID scopeID, int x, int y)
bool Delete(UUID regionID)
RegionData Get(UUID regionID, UUID scopeID)
List< RegionData > GetHyperlinks(UUID scopeID)
bool Store(RegionData data)
RegionData Get(int posX, int posY, UUID scopeID)
List< RegionData > Get(string regionName, UUID scopeID)
List< RegionData > GetDefaultRegions(UUID scopeID)