aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/SimulationService/SimulationDataService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/SimulationService/SimulationDataService.cs')
-rw-r--r--OpenSim/Services/SimulationService/SimulationDataService.cs196
1 files changed, 196 insertions, 0 deletions
diff --git a/OpenSim/Services/SimulationService/SimulationDataService.cs b/OpenSim/Services/SimulationService/SimulationDataService.cs
new file mode 100644
index 0000000..7a544fa
--- /dev/null
+++ b/OpenSim/Services/SimulationService/SimulationDataService.cs
@@ -0,0 +1,196 @@
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 OpenMetaverse;
31using log4net;
32using Nini.Config;
33using System.Reflection;
34using OpenSim.Services.Base;
35using OpenSim.Services.Interfaces;
36using OpenSim.Data;
37using OpenSim.Framework;
38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes;
40
41namespace OpenSim.Services.SimulationService
42{
43 public class SimulationDataService : ServiceBase, ISimulationDataService
44 {
45// private static readonly ILog m_log =
46// LogManager.GetLogger(
47// MethodBase.GetCurrentMethod().DeclaringType);
48
49 protected ISimulationDataStore m_database;
50
51 public SimulationDataService(IConfigSource config)
52 : base(config)
53 {
54 string dllName = String.Empty;
55 string connString = String.Empty;
56
57 // Try reading the [DatabaseService] section, if it exists
58 IConfig dbConfig = config.Configs["DatabaseService"];
59 if (dbConfig != null)
60 {
61 dllName = dbConfig.GetString("StorageProvider", String.Empty);
62 connString = dbConfig.GetString("ConnectionString", String.Empty);
63 }
64
65 // Try reading the [SimulationDataStore] section
66 IConfig simConfig = config.Configs["SimulationDataStore"];
67 if (simConfig != null)
68 {
69 dllName = simConfig.GetString("StorageProvider", dllName);
70 connString = simConfig.GetString("ConnectionString", connString);
71 }
72
73 // We tried, but this doesn't exist. We can't proceed
74 if (dllName == String.Empty)
75 throw new Exception("No StorageProvider configured");
76
77 m_database = LoadPlugin<ISimulationDataStore>(dllName, new Object[] { connString });
78 if (m_database == null)
79 throw new Exception("Could not find a storage interface in the given module");
80 }
81
82 public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
83 {
84 m_database.StoreObject(obj, regionUUID);
85 }
86
87 public void RemoveObject(UUID uuid, UUID regionUUID)
88 {
89 m_database.RemoveObject(uuid, regionUUID);
90 }
91
92 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
93 {
94 m_database.StorePrimInventory(primID, items);
95 }
96
97 public List<SceneObjectGroup> LoadObjects(UUID regionUUID)
98 {
99 return m_database.LoadObjects(regionUUID);
100 }
101
102 public void StoreTerrain(TerrainData terrain, UUID regionID)
103 {
104 m_database.StoreTerrain(terrain, regionID);
105 }
106
107 public void StoreTerrain(double[,] terrain, UUID regionID)
108 {
109 m_database.StoreTerrain(terrain, regionID);
110 }
111
112 public double[,] LoadTerrain(UUID regionID)
113 {
114 return m_database.LoadTerrain(regionID);
115 }
116
117 public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
118 {
119 return m_database.LoadTerrain(regionID, pSizeX, pSizeY, pSizeZ);
120 }
121
122 public void StoreLandObject(ILandObject Parcel)
123 {
124 m_database.StoreLandObject(Parcel);
125 }
126
127 public void RemoveLandObject(UUID globalID)
128 {
129 m_database.RemoveLandObject(globalID);
130 }
131
132 public List<LandData> LoadLandObjects(UUID regionUUID)
133 {
134 return m_database.LoadLandObjects(regionUUID);
135 }
136
137 public void StoreRegionSettings(RegionSettings rs)
138 {
139 m_database.StoreRegionSettings(rs);
140 }
141
142 public RegionSettings LoadRegionSettings(UUID regionUUID)
143 {
144 return m_database.LoadRegionSettings(regionUUID);
145 }
146
147 public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
148 {
149 return m_database.LoadRegionWindlightSettings(regionUUID);
150 }
151
152 public void StoreRegionWindlightSettings(RegionLightShareData wl)
153 {
154 m_database.StoreRegionWindlightSettings(wl);
155 }
156 public void RemoveRegionWindlightSettings(UUID regionID)
157 {
158 m_database.RemoveRegionWindlightSettings(regionID);
159 }
160
161 public string LoadRegionEnvironmentSettings(UUID regionUUID)
162 {
163 return m_database.LoadRegionEnvironmentSettings(regionUUID);
164 }
165
166 public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
167 {
168 m_database.StoreRegionEnvironmentSettings(regionUUID, settings);
169 }
170
171 public void RemoveRegionEnvironmentSettings(UUID regionUUID)
172 {
173 m_database.RemoveRegionEnvironmentSettings(regionUUID);
174 }
175
176 public UUID[] GetObjectIDs(UUID regionID)
177 {
178 return m_database.GetObjectIDs(regionID);
179 }
180
181 public void SaveExtra(UUID regionID, string name, string val)
182 {
183 m_database.SaveExtra(regionID, name, val);
184 }
185
186 public void RemoveExtra(UUID regionID, string name)
187 {
188 m_database.RemoveExtra(regionID, name);
189 }
190
191 public Dictionary<string, string> GetExtra(UUID regionID)
192 {
193 return m_database.GetExtra(regionID);
194 }
195 }
196}