diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Services/EstateService/EstateDataService.cs | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Services/EstateService/EstateDataService.cs')
-rw-r--r-- | OpenSim/Services/EstateService/EstateDataService.cs | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/OpenSim/Services/EstateService/EstateDataService.cs b/OpenSim/Services/EstateService/EstateDataService.cs new file mode 100644 index 0000000..f6a8654 --- /dev/null +++ b/OpenSim/Services/EstateService/EstateDataService.cs | |||
@@ -0,0 +1,136 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using log4net; | ||
32 | using Nini.Config; | ||
33 | using System.Reflection; | ||
34 | using OpenSim.Services.Base; | ||
35 | using OpenSim.Services.Interfaces; | ||
36 | using OpenSim.Data; | ||
37 | using OpenSim.Framework; | ||
38 | |||
39 | namespace OpenSim.Services.EstateService | ||
40 | { | ||
41 | public class EstateDataService : ServiceBase, IEstateDataService | ||
42 | { | ||
43 | // private static readonly ILog m_log = | ||
44 | // LogManager.GetLogger( | ||
45 | // MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
47 | protected IEstateDataStore m_database; | ||
48 | |||
49 | public EstateDataService(IConfigSource config) | ||
50 | : base(config) | ||
51 | { | ||
52 | string dllName = String.Empty; | ||
53 | string connString = String.Empty; | ||
54 | |||
55 | // Try reading the [DatabaseService] section, if it exists | ||
56 | IConfig dbConfig = config.Configs["DatabaseService"]; | ||
57 | if (dbConfig != null) | ||
58 | { | ||
59 | dllName = dbConfig.GetString("StorageProvider", String.Empty); | ||
60 | connString = dbConfig.GetString("ConnectionString", String.Empty); | ||
61 | connString = dbConfig.GetString("EstateConnectionString", connString); | ||
62 | } | ||
63 | |||
64 | // Try reading the [EstateDataStore] section, if it exists | ||
65 | IConfig estConfig = config.Configs["EstateDataStore"]; | ||
66 | if (estConfig != null) | ||
67 | { | ||
68 | dllName = estConfig.GetString("StorageProvider", dllName); | ||
69 | connString = estConfig.GetString("ConnectionString", connString); | ||
70 | } | ||
71 | |||
72 | // We tried, but this doesn't exist. We can't proceed | ||
73 | if (dllName == String.Empty) | ||
74 | throw new Exception("No StorageProvider configured"); | ||
75 | |||
76 | m_database = LoadPlugin<IEstateDataStore>(dllName, new Object[] { connString }); | ||
77 | if (m_database == null) | ||
78 | throw new Exception("Could not find a storage interface in the given module"); | ||
79 | } | ||
80 | |||
81 | public EstateSettings LoadEstateSettings(UUID regionID, bool create) | ||
82 | { | ||
83 | return m_database.LoadEstateSettings(regionID, create); | ||
84 | } | ||
85 | |||
86 | public EstateSettings LoadEstateSettings(int estateID) | ||
87 | { | ||
88 | return m_database.LoadEstateSettings(estateID); | ||
89 | } | ||
90 | |||
91 | public EstateSettings CreateNewEstate() | ||
92 | { | ||
93 | return m_database.CreateNewEstate(); | ||
94 | } | ||
95 | |||
96 | public List<EstateSettings> LoadEstateSettingsAll() | ||
97 | { | ||
98 | return m_database.LoadEstateSettingsAll(); | ||
99 | } | ||
100 | |||
101 | public void StoreEstateSettings(EstateSettings es) | ||
102 | { | ||
103 | m_database.StoreEstateSettings(es); | ||
104 | } | ||
105 | |||
106 | public List<int> GetEstates(string search) | ||
107 | { | ||
108 | return m_database.GetEstates(search); | ||
109 | } | ||
110 | |||
111 | public List<int> GetEstatesAll() | ||
112 | { | ||
113 | return m_database.GetEstatesAll(); | ||
114 | } | ||
115 | |||
116 | public List<int> GetEstatesByOwner(UUID ownerID) | ||
117 | { | ||
118 | return m_database.GetEstatesByOwner(ownerID); | ||
119 | } | ||
120 | |||
121 | public bool LinkRegion(UUID regionID, int estateID) | ||
122 | { | ||
123 | return m_database.LinkRegion(regionID, estateID); | ||
124 | } | ||
125 | |||
126 | public List<UUID> GetRegions(int estateID) | ||
127 | { | ||
128 | return m_database.GetRegions(estateID); | ||
129 | } | ||
130 | |||
131 | public bool DeleteEstate(int estateID) | ||
132 | { | ||
133 | return m_database.DeleteEstate(estateID); | ||
134 | } | ||
135 | } | ||
136 | } | ||