aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Null
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/Null')
-rwxr-xr-xOpenSim/Data/Null/NullEstateData.cs133
-rw-r--r--OpenSim/Data/Null/NullSimulationData.cs17
-rw-r--r--OpenSim/Data/Null/NullUserAccountData.cs65
3 files changed, 201 insertions, 14 deletions
diff --git a/OpenSim/Data/Null/NullEstateData.cs b/OpenSim/Data/Null/NullEstateData.cs
new file mode 100755
index 0000000..0cebff5
--- /dev/null
+++ b/OpenSim/Data/Null/NullEstateData.cs
@@ -0,0 +1,133 @@
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.Reflection;
31using log4net;
32using OpenMetaverse;
33using OpenSim.Framework;
34using OpenSim.Region.Framework;
35using OpenSim.Region.Framework.Interfaces;
36
37namespace OpenSim.Data.Null
38{
39 public class NullEstateStore : IEstateDataStore
40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42
43 private string m_connectionString;
44
45 protected virtual Assembly Assembly
46 {
47 get { return GetType().Assembly; }
48 }
49
50 public NullEstateStore()
51 {
52 }
53
54 public NullEstateStore(string connectionString)
55 {
56 Initialise(connectionString);
57 }
58
59 public void Initialise(string connectionString)
60 {
61 m_connectionString = connectionString;
62 }
63
64 private string[] FieldList
65 {
66 get { return new string[0]; }
67 }
68
69 public EstateSettings LoadEstateSettings(UUID regionID, bool create)
70 {
71 // This fools the initialization caller into thinking an estate was fetched (a check in OpenSimBase).
72 // The estate info is pretty empty so don't try banning anyone.
73 EstateSettings oneEstate = new EstateSettings();
74 oneEstate.EstateID = 1;
75 return oneEstate;
76 }
77
78 public void StoreEstateSettings(EstateSettings es)
79 {
80 return;
81 }
82
83 public EstateSettings LoadEstateSettings(int estateID)
84 {
85 return new EstateSettings();
86 }
87
88 public List<EstateSettings> LoadEstateSettingsAll()
89 {
90 List<EstateSettings> allEstateSettings = new List<EstateSettings>();
91 allEstateSettings.Add(new EstateSettings());
92 return allEstateSettings;
93 }
94
95 public List<int> GetEstatesAll()
96 {
97 List<int> result = new List<int>();
98 return result;
99 }
100
101 public List<int> GetEstates(string search)
102 {
103 List<int> result = new List<int>();
104 return result;
105 }
106
107 public bool LinkRegion(UUID regionID, int estateID)
108 {
109 return false;
110 }
111
112 public List<UUID> GetRegions(int estateID)
113 {
114 List<UUID> result = new List<UUID>();
115 return result;
116 }
117
118 public bool DeleteEstate(int estateID)
119 {
120 return false;
121 }
122
123 #region IEstateDataStore Members
124
125
126 public List<int> GetEstatesByOwner(UUID ownerID)
127 {
128 return new List<int>();
129 }
130
131 #endregion
132 }
133}
diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs
index eb4e313..e8d733b 100644
--- a/OpenSim/Data/Null/NullSimulationData.cs
+++ b/OpenSim/Data/Null/NullSimulationData.cs
@@ -38,6 +38,15 @@ namespace OpenSim.Data.Null
38 /// </summary> 38 /// </summary>
39 public class NullSimulationData : ISimulationDataStore 39 public class NullSimulationData : ISimulationDataStore
40 { 40 {
41 public NullSimulationData()
42 {
43 }
44
45 public NullSimulationData(string connectionString)
46 {
47 Initialise(connectionString);
48 }
49
41 public void Initialise(string dbfile) 50 public void Initialise(string dbfile)
42 { 51 {
43 return; 52 return;
@@ -85,12 +94,20 @@ namespace OpenSim.Data.Null
85 return new List<SceneObjectGroup>(); 94 return new List<SceneObjectGroup>();
86 } 95 }
87 96
97 Dictionary<UUID, double[,]> m_terrains = new Dictionary<UUID, double[,]>();
88 public void StoreTerrain(double[,] ter, UUID regionID) 98 public void StoreTerrain(double[,] ter, UUID regionID)
89 { 99 {
100 if (m_terrains.ContainsKey(regionID))
101 m_terrains.Remove(regionID);
102 m_terrains.Add(regionID, ter);
90 } 103 }
91 104
92 public double[,] LoadTerrain(UUID regionID) 105 public double[,] LoadTerrain(UUID regionID)
93 { 106 {
107 if (m_terrains.ContainsKey(regionID))
108 {
109 return m_terrains[regionID];
110 }
94 return null; 111 return null;
95 } 112 }
96 113
diff --git a/OpenSim/Data/Null/NullUserAccountData.cs b/OpenSim/Data/Null/NullUserAccountData.cs
index ede23fb..ec54dba 100644
--- a/OpenSim/Data/Null/NullUserAccountData.cs
+++ b/OpenSim/Data/Null/NullUserAccountData.cs
@@ -28,6 +28,9 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection;
32using System.Text;
33using log4net;
31using OpenMetaverse; 34using OpenMetaverse;
32using OpenSim.Framework; 35using OpenSim.Framework;
33using OpenSim.Data; 36using OpenSim.Data;
@@ -36,12 +39,17 @@ namespace OpenSim.Data.Null
36{ 39{
37 public class NullUserAccountData : IUserAccountData 40 public class NullUserAccountData : IUserAccountData
38 { 41 {
39 private static Dictionary<UUID, UserAccountData> m_DataByUUID = new Dictionary<UUID, UserAccountData>(); 42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 private static Dictionary<string, UserAccountData> m_DataByName = new Dictionary<string, UserAccountData>(); 43
41 private static Dictionary<string, UserAccountData> m_DataByEmail = new Dictionary<string, UserAccountData>(); 44 private Dictionary<UUID, UserAccountData> m_DataByUUID = new Dictionary<UUID, UserAccountData>();
45 private Dictionary<string, UserAccountData> m_DataByName = new Dictionary<string, UserAccountData>();
46 private Dictionary<string, UserAccountData> m_DataByEmail = new Dictionary<string, UserAccountData>();
42 47
43 public NullUserAccountData(string connectionString, string realm) 48 public NullUserAccountData(string connectionString, string realm)
44 { 49 {
50// m_log.DebugFormat(
51// "[NULL USER ACCOUNT DATA]: Initializing new NullUserAccountData with connectionString [{0}], realm [{1}]",
52// connectionString, realm);
45 } 53 }
46 54
47 /// <summary> 55 /// <summary>
@@ -54,6 +62,15 @@ namespace OpenSim.Data.Null
54 /// <returns></returns> 62 /// <returns></returns>
55 public UserAccountData[] Get(string[] fields, string[] values) 63 public UserAccountData[] Get(string[] fields, string[] values)
56 { 64 {
65// if (m_log.IsDebugEnabled)
66// {
67// m_log.DebugFormat(
68// "[NULL USER ACCOUNT DATA]: Called Get with fields [{0}], values [{1}]",
69// string.Join(", ", fields), string.Join(", ", values));
70// }
71
72 UserAccountData[] userAccounts = new UserAccountData[0];
73
57 List<string> fieldsLst = new List<string>(fields); 74 List<string> fieldsLst = new List<string>(fields);
58 if (fieldsLst.Contains("PrincipalID")) 75 if (fieldsLst.Contains("PrincipalID"))
59 { 76 {
@@ -61,41 +78,61 @@ namespace OpenSim.Data.Null
61 UUID id = UUID.Zero; 78 UUID id = UUID.Zero;
62 if (UUID.TryParse(values[i], out id)) 79 if (UUID.TryParse(values[i], out id))
63 if (m_DataByUUID.ContainsKey(id)) 80 if (m_DataByUUID.ContainsKey(id))
64 return new UserAccountData[] { m_DataByUUID[id] }; 81 userAccounts = new UserAccountData[] { m_DataByUUID[id] };
65 } 82 }
66 if (fieldsLst.Contains("FirstName") && fieldsLst.Contains("LastName")) 83 else if (fieldsLst.Contains("FirstName") && fieldsLst.Contains("LastName"))
67 { 84 {
68 int findex = fieldsLst.IndexOf("FirstName"); 85 int findex = fieldsLst.IndexOf("FirstName");
69 int lindex = fieldsLst.IndexOf("LastName"); 86 int lindex = fieldsLst.IndexOf("LastName");
70 if (m_DataByName.ContainsKey(values[findex] + " " + values[lindex])) 87 if (m_DataByName.ContainsKey(values[findex] + " " + values[lindex]))
71 return new UserAccountData[] { m_DataByName[values[findex] + " " + values[lindex]] }; 88 {
72 } 89 userAccounts = new UserAccountData[] { m_DataByName[values[findex] + " " + values[lindex]] };
73 if (fieldsLst.Contains("Email")) 90 }
91 }
92 else if (fieldsLst.Contains("Email"))
74 { 93 {
75 int i = fieldsLst.IndexOf("Email"); 94 int i = fieldsLst.IndexOf("Email");
76 if (m_DataByEmail.ContainsKey(values[i])) 95 if (m_DataByEmail.ContainsKey(values[i]))
77 return new UserAccountData[] { m_DataByEmail[values[i]] }; 96 userAccounts = new UserAccountData[] { m_DataByEmail[values[i]] };
78 } 97 }
79 98
80 // Fail 99// if (m_log.IsDebugEnabled)
81 return new UserAccountData[0]; 100// {
101// StringBuilder sb = new StringBuilder();
102// foreach (UserAccountData uad in userAccounts)
103// sb.AppendFormat("({0} {1} {2}) ", uad.FirstName, uad.LastName, uad.PrincipalID);
104//
105// m_log.DebugFormat(
106// "[NULL USER ACCOUNT DATA]: Returning {0} user accounts out of {1}: [{2}]", userAccounts.Length, m_DataByName.Count, sb);
107// }
108
109 return userAccounts;
82 } 110 }
83 111
84 public bool Store(UserAccountData data) 112 public bool Store(UserAccountData data)
85 { 113 {
86 if (data == null) 114 if (data == null)
87 return false; 115 return false;
88 116
117 m_log.DebugFormat(
118 "[NULL USER ACCOUNT DATA]: Storing user account {0} {1} {2} {3}",
119 data.FirstName, data.LastName, data.PrincipalID, this.GetHashCode());
120
89 m_DataByUUID[data.PrincipalID] = data; 121 m_DataByUUID[data.PrincipalID] = data;
90 m_DataByName[data.FirstName + " " + data.LastName] = data; 122 m_DataByName[data.FirstName + " " + data.LastName] = data;
91 if (data.Data.ContainsKey("Email") && data.Data["Email"] != null && data.Data["Email"] != string.Empty) 123 if (data.Data.ContainsKey("Email") && data.Data["Email"] != null && data.Data["Email"] != string.Empty)
92 m_DataByEmail[data.Data["Email"]] = data; 124 m_DataByEmail[data.Data["Email"]] = data;
125
126// m_log.DebugFormat("m_DataByUUID count is {0}, m_DataByName count is {1}", m_DataByUUID.Count, m_DataByName.Count);
93 127
94 return true; 128 return true;
95 } 129 }
96 130
97 public UserAccountData[] GetUsers(UUID scopeID, string query) 131 public UserAccountData[] GetUsers(UUID scopeID, string query)
98 { 132 {
133// m_log.DebugFormat(
134// "[NULL USER ACCOUNT DATA]: Called GetUsers with scope [{0}], query [{1}]", scopeID, query);
135
99 string[] words = query.Split(new char[] { ' ' }); 136 string[] words = query.Split(new char[] { ' ' });
100 137
101 for (int i = 0; i < words.Length; i++) 138 for (int i = 0; i < words.Length; i++)