OpenSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
SimulationDataService.cs
Go to the documentation of this file.
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 using OpenSim.Region.Framework.Interfaces;
39 using OpenSim.Region.Framework.Scenes;
40 
41 namespace OpenSim.Services.SimulationService
42 {
44  {
45 // private static readonly ILog m_log =
46 // LogManager.GetLogger(
47 // MethodBase.GetCurrentMethod().DeclaringType);
48 
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 
138  {
139  m_database.StoreRegionSettings(rs);
140  }
141 
142  public RegionSettings LoadRegionSettings(UUID regionUUID)
143  {
144  return m_database.LoadRegionSettings(regionUUID);
145  }
146 
148  {
149  return m_database.LoadRegionWindlightSettings(regionUUID);
150  }
151 
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 }
void RemoveLandObject(UUID globalID)
delete from land where UUID=globalID delete from landaccesslist where LandUUID=globalID ...
void StoreObject(SceneObjectGroup obj, UUID regionUUID)
Stores all object's details apart from inventory
void RemoveRegionEnvironmentSettings(UUID regionUUID)
Delete Environment settings from region storage
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
void StoreRegionEnvironmentSettings(UUID regionUUID, string settings)
Store Environment settings into region storage
void StoreTerrain(TerrainData terrain, UUID regionID)
Store a terrain revision in region storage
void RemoveObject(UUID uuid, UUID regionUUID)
Entirely removes the object, including inventory
void StorePrimInventory(UUID primID, ICollection< TaskInventoryItem > items)
Store a prim's inventory
TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
Load the latest terrain revision from region storage
Dictionary< string, string > GetExtra(UUID regionID)
void SaveExtra(UUID regionID, string name, string val)
Interactive OpenSim region server
Definition: OpenSim.cs:55
string LoadRegionEnvironmentSettings(UUID regionUUID)
Load Environment settings from region storage
List< SceneObjectGroup > LoadObjects(UUID regionUUID)
Load persisted objects from region storage.