diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/Connectors/Simulation/SimulationDataService.cs (renamed from OpenSim/Services/Connectors/Simulation/SimulationDataServiceConnector.cs) | 69 |
1 files changed, 42 insertions, 27 deletions
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs index 93147d4..946f7e4 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationDataServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs | |||
@@ -27,99 +27,114 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using OpenMetaverse; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenMetaverse; | 34 | using System.Reflection; |
35 | using OpenSim.Services.Base; | ||
36 | using OpenSim.Services.Interfaces; | ||
37 | using OpenSim.Data; | ||
34 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
35 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Server.Base; | ||
38 | 41 | ||
39 | namespace OpenSim.Services.Connectors.Simulation | 42 | namespace OpenSim.Services.Connectors |
40 | { | 43 | { |
41 | public class SimulationDataServiceConnector : ISimulationDataService | 44 | public class SimulationDataService : ServiceBase, ISimulationDataService |
42 | { | 45 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = |
47 | LogManager.GetLogger( | ||
48 | MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | 49 | ||
45 | private ISimulationDataStore m_simDataStore; | 50 | protected ISimulationDataStore m_database; |
46 | 51 | ||
47 | public SimulationDataServiceConnector() | 52 | public SimulationDataService(IConfigSource config) |
53 | : base(config) | ||
48 | { | 54 | { |
49 | } | 55 | string dllName = String.Empty; |
56 | string connString = String.Empty; | ||
50 | 57 | ||
51 | public SimulationDataServiceConnector(IConfigSource config) | 58 | // Try reading the [DatabaseService] section, if it exists |
52 | { | 59 | IConfig dbConfig = config.Configs["DatabaseService"]; |
53 | Initialise(config); | 60 | if (dbConfig != null) |
54 | } | 61 | { |
55 | 62 | dllName = dbConfig.GetString("StorageProvider", String.Empty); | |
56 | public virtual void Initialise(IConfigSource config) | 63 | connString = dbConfig.GetString("ConnectionString", String.Empty); |
57 | { | 64 | } |
58 | IConfig serverConfig = config.Configs["SimulationDataStore"]; | ||
59 | if (serverConfig == null) | ||
60 | throw new Exception("No section 'SimulationDataStore' in config file"); | ||
61 | 65 | ||
62 | string simDataStore = serverConfig.GetString("StoreModule", String.Empty); | 66 | // We tried, but this doesn't exist. We can't proceed |
67 | if (dllName == String.Empty) | ||
68 | throw new Exception("No StorageProvider configured"); | ||
63 | 69 | ||
64 | Object[] args = new Object[] { config }; | 70 | m_database = LoadPlugin<ISimulationDataStore>(dllName, new Object[] { connString }); |
65 | m_simDataStore = ServerUtils.LoadPlugin<ISimulationDataStore>(simDataStore, args); | 71 | if (m_database == null) |
72 | throw new Exception("Could not find a storage interface in the given module"); | ||
66 | } | 73 | } |
67 | 74 | ||
68 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) | 75 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) |
69 | { | 76 | { |
77 | m_database.StoreObject(obj, regionUUID); | ||
70 | } | 78 | } |
71 | 79 | ||
72 | public void RemoveObject(UUID uuid, UUID regionUUID) | 80 | public void RemoveObject(UUID uuid, UUID regionUUID) |
73 | { | 81 | { |
82 | m_database.RemoveObject(uuid, regionUUID); | ||
74 | } | 83 | } |
75 | 84 | ||
76 | public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) | 85 | public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) |
77 | { | 86 | { |
87 | m_database.StorePrimInventory(primID, items); | ||
78 | } | 88 | } |
79 | 89 | ||
80 | public List<SceneObjectGroup> LoadObjects(UUID regionUUID) | 90 | public List<SceneObjectGroup> LoadObjects(UUID regionUUID) |
81 | { | 91 | { |
82 | return new List<SceneObjectGroup>(0); | 92 | return m_database.LoadObjects(regionUUID); |
83 | } | 93 | } |
84 | 94 | ||
85 | public void StoreTerrain(double[,] terrain, UUID regionID) | 95 | public void StoreTerrain(double[,] terrain, UUID regionID) |
86 | { | 96 | { |
97 | m_database.StoreTerrain(terrain, regionID); | ||
87 | } | 98 | } |
88 | 99 | ||
89 | public double[,] LoadTerrain(UUID regionID) | 100 | public double[,] LoadTerrain(UUID regionID) |
90 | { | 101 | { |
91 | return new double[Constants.RegionSize, Constants.RegionSize]; | 102 | return m_database.LoadTerrain(regionID); |
92 | } | 103 | } |
93 | 104 | ||
94 | public void StoreLandObject(ILandObject Parcel) | 105 | public void StoreLandObject(ILandObject Parcel) |
95 | { | 106 | { |
107 | m_database.StoreLandObject(Parcel); | ||
96 | } | 108 | } |
97 | 109 | ||
98 | public void RemoveLandObject(UUID globalID) | 110 | public void RemoveLandObject(UUID globalID) |
99 | { | 111 | { |
112 | m_database.RemoveLandObject(globalID); | ||
100 | } | 113 | } |
101 | 114 | ||
102 | public List<LandData> LoadLandObjects(UUID regionUUID) | 115 | public List<LandData> LoadLandObjects(UUID regionUUID) |
103 | { | 116 | { |
104 | return new List<LandData>(0); | 117 | return m_database.LoadLandObjects(regionUUID); |
105 | } | 118 | } |
106 | 119 | ||
107 | public void StoreRegionSettings(RegionSettings rs) | 120 | public void StoreRegionSettings(RegionSettings rs) |
108 | { | 121 | { |
122 | m_database.StoreRegionSettings(rs); | ||
109 | } | 123 | } |
110 | 124 | ||
111 | public RegionSettings LoadRegionSettings(UUID regionUUID) | 125 | public RegionSettings LoadRegionSettings(UUID regionUUID) |
112 | { | 126 | { |
113 | return null; | 127 | return m_database.LoadRegionSettings(regionUUID); |
114 | } | 128 | } |
115 | 129 | ||
116 | public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) | 130 | public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) |
117 | { | 131 | { |
118 | return null; | 132 | return m_database.LoadRegionWindlightSettings(regionUUID); |
119 | } | 133 | } |
120 | 134 | ||
121 | public void StoreRegionWindlightSettings(RegionLightShareData wl) | 135 | public void StoreRegionWindlightSettings(RegionLightShareData wl) |
122 | { | 136 | { |
137 | m_database.StoreRegionWindlightSettings(wl); | ||
123 | } | 138 | } |
124 | } | 139 | } |
125 | } | 140 | } |