1
0

NullEstateData.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. using System;
  28. using System.Collections.Generic;
  29. using System.Reflection;
  30. using log4net;
  31. using OpenMetaverse;
  32. using OpenSim.Framework;
  33. using OpenSim.Region.Framework;
  34. using OpenSim.Region.Framework.Interfaces;
  35. namespace OpenSim.Data.Null
  36. {
  37. public class NullEstateStore : IEstateDataStore
  38. {
  39. // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  40. // private string m_connectionString;
  41. // private Dictionary<uint, EstateSettings> m_knownEstates = new Dictionary<uint, EstateSettings>();
  42. private EstateSettings m_estate = null;
  43. private EstateSettings GetEstate()
  44. {
  45. if (m_estate == null)
  46. {
  47. // This fools the initialization caller into thinking an estate was fetched (a check in OpenSimBase).
  48. // The estate info is pretty empty so don't try banning anyone.
  49. m_estate = new EstateSettings();
  50. m_estate.EstateID = 1;
  51. m_estate.OnSave += StoreEstateSettings;
  52. }
  53. return m_estate;
  54. }
  55. protected virtual Assembly Assembly
  56. {
  57. get { return GetType().Assembly; }
  58. }
  59. public NullEstateStore()
  60. {
  61. }
  62. public NullEstateStore(string connectionString)
  63. {
  64. Initialise(connectionString);
  65. }
  66. public void Initialise(string connectionString)
  67. {
  68. // m_connectionString = connectionString;
  69. }
  70. private string[] FieldList
  71. {
  72. get { return new string[0]; }
  73. }
  74. public EstateSettings LoadEstateSettings(UUID regionID, bool create)
  75. {
  76. return GetEstate();
  77. }
  78. public void StoreEstateSettings(EstateSettings es)
  79. {
  80. m_estate = es;
  81. return;
  82. }
  83. public EstateSettings LoadEstateSettings(int estateID)
  84. {
  85. return GetEstate();
  86. }
  87. public EstateSettings CreateNewEstate(int estateID)
  88. {
  89. return new EstateSettings();
  90. }
  91. public List<EstateSettings> LoadEstateSettingsAll()
  92. {
  93. List<EstateSettings> allEstateSettings = new List<EstateSettings>();
  94. allEstateSettings.Add(GetEstate());
  95. return allEstateSettings;
  96. }
  97. public List<int> GetEstatesAll()
  98. {
  99. List<int> result = new List<int>();
  100. result.Add((int)GetEstate().EstateID);
  101. return result;
  102. }
  103. public List<int> GetEstates(string search)
  104. {
  105. List<int> result = new List<int>();
  106. return result;
  107. }
  108. public bool LinkRegion(UUID regionID, int estateID)
  109. {
  110. return false;
  111. }
  112. public List<UUID> GetRegions(int estateID)
  113. {
  114. List<UUID> result = new List<UUID>();
  115. return result;
  116. }
  117. public bool DeleteEstate(int estateID)
  118. {
  119. return false;
  120. }
  121. #region IEstateDataStore Members
  122. public List<int> GetEstatesByOwner(UUID ownerID)
  123. {
  124. return new List<int>();
  125. }
  126. #endregion
  127. }
  128. }