diff options
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/SQLAssetServer.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/SQLAssetServer.cs | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs index a64d195..2a38307 100644 --- a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs +++ b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs | |||
@@ -44,16 +44,16 @@ namespace OpenSim.Framework.Communications.Caches | |||
44 | private IAssetReceiver _receiver; | 44 | private IAssetReceiver _receiver; |
45 | private BlockingQueue<ARequest> _assetRequests; | 45 | private BlockingQueue<ARequest> _assetRequests; |
46 | private Thread _localAssetServerThread; | 46 | private Thread _localAssetServerThread; |
47 | protected IAssetProvider m_plugin; | 47 | protected IAssetProvider m_assetProviderPlugin; |
48 | private object syncLock = new object(); | 48 | private object syncLock = new object(); |
49 | 49 | ||
50 | 50 | ||
51 | public SQLAssetServer() | 51 | public SQLAssetServer(string pluginName) |
52 | { | 52 | { |
53 | System.Console.WriteLine("Starting sqlite asset storage system"); | 53 | _assetRequests = new BlockingQueue<ARequest>(); |
54 | _assetRequests = new BlockingQueue<ARequest>(); | 54 | AddPlugin(pluginName); |
55 | AddPlugin("OpenSim.Framework.Data.SQLite.dll"); | 55 | |
56 | this.SetUpAssetDatabase(); | 56 | SetUpAssetDatabase(); |
57 | 57 | ||
58 | this._localAssetServerThread = new Thread(new ThreadStart(RunRequests)); | 58 | this._localAssetServerThread = new Thread(new ThreadStart(RunRequests)); |
59 | this._localAssetServerThread.IsBackground = true; | 59 | this._localAssetServerThread.IsBackground = true; |
@@ -63,7 +63,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
63 | 63 | ||
64 | public void AddPlugin(string FileName) | 64 | public void AddPlugin(string FileName) |
65 | { | 65 | { |
66 | //MainLog.Instance.Verbose("SQLAssetServer", "AssetStorage: Attempting to load " + FileName); | 66 | MainLog.Instance.Verbose("SQLAssetServer", "AssetStorage: Attempting to load " + FileName); |
67 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | 67 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); |
68 | 68 | ||
69 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 69 | foreach (Type pluginType in pluginAssembly.GetTypes()) |
@@ -75,10 +75,10 @@ namespace OpenSim.Framework.Communications.Caches | |||
75 | if (typeInterface != null) | 75 | if (typeInterface != null) |
76 | { | 76 | { |
77 | IAssetProvider plug = (IAssetProvider)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 77 | IAssetProvider plug = (IAssetProvider)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
78 | m_plugin = plug; | 78 | m_assetProviderPlugin = plug; |
79 | m_plugin.Initialise("AssetStorage.db", ""); | 79 | m_assetProviderPlugin.Initialise(); |
80 | 80 | ||
81 | //MainLog.Instance.Verbose("AssetStorage: Added IAssetProvider Interface"); | 81 | MainLog.Instance.Verbose("AssetStorage: Added " + m_assetProviderPlugin.Name + " " + m_assetProviderPlugin.Version); |
82 | } | 82 | } |
83 | 83 | ||
84 | typeInterface = null; | 84 | typeInterface = null; |
@@ -105,8 +105,8 @@ namespace OpenSim.Framework.Communications.Caches | |||
105 | { | 105 | { |
106 | lock (syncLock) | 106 | lock (syncLock) |
107 | { | 107 | { |
108 | m_plugin.UpdateAsset(asset); | 108 | m_assetProviderPlugin.UpdateAsset(asset); |
109 | m_plugin.CommitAssets(); | 109 | m_assetProviderPlugin.CommitAssets(); |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
@@ -114,8 +114,8 @@ namespace OpenSim.Framework.Communications.Caches | |||
114 | { | 114 | { |
115 | lock (syncLock) | 115 | lock (syncLock) |
116 | { | 116 | { |
117 | m_plugin.CreateAsset(asset); | 117 | m_assetProviderPlugin.CreateAsset(asset); |
118 | m_plugin.CommitAssets(); | 118 | m_assetProviderPlugin.CommitAssets(); |
119 | } | 119 | } |
120 | } | 120 | } |
121 | 121 | ||
@@ -125,7 +125,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
125 | } | 125 | } |
126 | public void Close() | 126 | public void Close() |
127 | { | 127 | { |
128 | m_plugin.CommitAssets(); | 128 | m_assetProviderPlugin.CommitAssets(); |
129 | } | 129 | } |
130 | 130 | ||
131 | private void RunRequests() | 131 | private void RunRequests() |
@@ -140,7 +140,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
140 | AssetBase asset = null; | 140 | AssetBase asset = null; |
141 | lock (syncLock) | 141 | lock (syncLock) |
142 | { | 142 | { |
143 | asset = m_plugin.FetchAsset(req.AssetID); | 143 | asset = m_assetProviderPlugin.FetchAsset(req.AssetID); |
144 | } | 144 | } |
145 | if (asset != null) | 145 | if (asset != null) |
146 | { | 146 | { |
@@ -163,67 +163,67 @@ namespace OpenSim.Framework.Communications.Caches | |||
163 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); | 163 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); |
164 | Image.Name = "Bricks"; | 164 | Image.Name = "Bricks"; |
165 | this.LoadAsset(Image, true, "bricks.jp2"); | 165 | this.LoadAsset(Image, true, "bricks.jp2"); |
166 | m_plugin.CreateAsset(Image); | 166 | m_assetProviderPlugin.CreateAsset(Image); |
167 | 167 | ||
168 | Image = new AssetBase(); | 168 | Image = new AssetBase(); |
169 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); | 169 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); |
170 | Image.Name = "Plywood"; | 170 | Image.Name = "Plywood"; |
171 | this.LoadAsset(Image, true, "plywood.jp2"); | 171 | this.LoadAsset(Image, true, "plywood.jp2"); |
172 | m_plugin.CreateAsset(Image); | 172 | m_assetProviderPlugin.CreateAsset(Image); |
173 | 173 | ||
174 | Image = new AssetBase(); | 174 | Image = new AssetBase(); |
175 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); | 175 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); |
176 | Image.Name = "Rocks"; | 176 | Image.Name = "Rocks"; |
177 | this.LoadAsset(Image, true, "rocks.jp2"); | 177 | this.LoadAsset(Image, true, "rocks.jp2"); |
178 | m_plugin.CreateAsset(Image); | 178 | m_assetProviderPlugin.CreateAsset(Image); |
179 | 179 | ||
180 | Image = new AssetBase(); | 180 | Image = new AssetBase(); |
181 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); | 181 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); |
182 | Image.Name = "Granite"; | 182 | Image.Name = "Granite"; |
183 | this.LoadAsset(Image, true, "granite.jp2"); | 183 | this.LoadAsset(Image, true, "granite.jp2"); |
184 | m_plugin.CreateAsset(Image); | 184 | m_assetProviderPlugin.CreateAsset(Image); |
185 | 185 | ||
186 | Image = new AssetBase(); | 186 | Image = new AssetBase(); |
187 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); | 187 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); |
188 | Image.Name = "Hardwood"; | 188 | Image.Name = "Hardwood"; |
189 | this.LoadAsset(Image, true, "hardwood.jp2"); | 189 | this.LoadAsset(Image, true, "hardwood.jp2"); |
190 | m_plugin.CreateAsset(Image); | 190 | m_assetProviderPlugin.CreateAsset(Image); |
191 | 191 | ||
192 | Image = new AssetBase(); | 192 | Image = new AssetBase(); |
193 | Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); | 193 | Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); |
194 | Image.Name = "Prim Base Texture"; | 194 | Image.Name = "Prim Base Texture"; |
195 | this.LoadAsset(Image, true, "plywood.jp2"); | 195 | this.LoadAsset(Image, true, "plywood.jp2"); |
196 | m_plugin.CreateAsset(Image); | 196 | m_assetProviderPlugin.CreateAsset(Image); |
197 | 197 | ||
198 | Image = new AssetBase(); | 198 | Image = new AssetBase(); |
199 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006"); | 199 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006"); |
200 | Image.Name = "Map Base Texture"; | 200 | Image.Name = "Map Base Texture"; |
201 | this.LoadAsset(Image, true, "map_base.jp2"); | 201 | this.LoadAsset(Image, true, "map_base.jp2"); |
202 | m_plugin.CreateAsset(Image); | 202 | m_assetProviderPlugin.CreateAsset(Image); |
203 | 203 | ||
204 | Image = new AssetBase(); | 204 | Image = new AssetBase(); |
205 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007"); | 205 | Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007"); |
206 | Image.Name = "Map Texture"; | 206 | Image.Name = "Map Texture"; |
207 | this.LoadAsset(Image, true, "map1.jp2"); | 207 | this.LoadAsset(Image, true, "map1.jp2"); |
208 | m_plugin.CreateAsset(Image); | 208 | m_assetProviderPlugin.CreateAsset(Image); |
209 | 209 | ||
210 | Image = new AssetBase(); | 210 | Image = new AssetBase(); |
211 | Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000010"); | 211 | Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000010"); |
212 | Image.Name = "Female Body Texture"; | 212 | Image.Name = "Female Body Texture"; |
213 | this.LoadAsset(Image, true, "femalebody.jp2"); | 213 | this.LoadAsset(Image, true, "femalebody.jp2"); |
214 | m_plugin.CreateAsset(Image); | 214 | m_assetProviderPlugin.CreateAsset(Image); |
215 | 215 | ||
216 | Image = new AssetBase(); | 216 | Image = new AssetBase(); |
217 | Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000011"); | 217 | Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000011"); |
218 | Image.Name = "Female Bottom Texture"; | 218 | Image.Name = "Female Bottom Texture"; |
219 | this.LoadAsset(Image, true, "femalebottom.jp2"); | 219 | this.LoadAsset(Image, true, "femalebottom.jp2"); |
220 | m_plugin.CreateAsset(Image); | 220 | m_assetProviderPlugin.CreateAsset(Image); |
221 | 221 | ||
222 | Image = new AssetBase(); | 222 | Image = new AssetBase(); |
223 | Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000012"); | 223 | Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000012"); |
224 | Image.Name = "Female Face Texture"; | 224 | Image.Name = "Female Face Texture"; |
225 | this.LoadAsset(Image, true, "femaleface.jp2"); | 225 | this.LoadAsset(Image, true, "femaleface.jp2"); |
226 | m_plugin.CreateAsset(Image); | 226 | m_assetProviderPlugin.CreateAsset(Image); |
227 | 227 | ||
228 | Image = new AssetBase(); | 228 | Image = new AssetBase(); |
229 | Image.FullID = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"); | 229 | Image.FullID = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"); |
@@ -231,7 +231,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
231 | Image.Type = 13; | 231 | Image.Type = 13; |
232 | Image.InvType = 13; | 232 | Image.InvType = 13; |
233 | this.LoadAsset(Image, false, "base_skin.dat"); | 233 | this.LoadAsset(Image, false, "base_skin.dat"); |
234 | m_plugin.CreateAsset(Image); | 234 | m_assetProviderPlugin.CreateAsset(Image); |
235 | 235 | ||
236 | Image = new AssetBase(); | 236 | Image = new AssetBase(); |
237 | Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | 237 | Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); |
@@ -239,7 +239,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
239 | Image.Type = 13; | 239 | Image.Type = 13; |
240 | Image.InvType = 13; | 240 | Image.InvType = 13; |
241 | this.LoadAsset(Image, false, "base_shape.dat"); | 241 | this.LoadAsset(Image, false, "base_shape.dat"); |
242 | m_plugin.CreateAsset(Image); | 242 | m_assetProviderPlugin.CreateAsset(Image); |
243 | 243 | ||
244 | Image = new AssetBase(); | 244 | Image = new AssetBase(); |
245 | Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111110"); | 245 | Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111110"); |
@@ -247,7 +247,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
247 | Image.Type = 5; | 247 | Image.Type = 5; |
248 | Image.InvType = 18; | 248 | Image.InvType = 18; |
249 | this.LoadAsset(Image, false, "newshirt.dat"); | 249 | this.LoadAsset(Image, false, "newshirt.dat"); |
250 | m_plugin.CreateAsset(Image); | 250 | m_assetProviderPlugin.CreateAsset(Image); |
251 | 251 | ||
252 | Image = new AssetBase(); | 252 | Image = new AssetBase(); |
253 | Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111120"); | 253 | Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111120"); |
@@ -255,7 +255,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
255 | Image.Type = 5; | 255 | Image.Type = 5; |
256 | Image.InvType = 18; | 256 | Image.InvType = 18; |
257 | this.LoadAsset(Image, false, "newpants.dat"); | 257 | this.LoadAsset(Image, false, "newpants.dat"); |
258 | m_plugin.CreateAsset(Image); | 258 | m_assetProviderPlugin.CreateAsset(Image); |
259 | 259 | ||
260 | string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml"); | 260 | string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml"); |
261 | if (File.Exists(filePath)) | 261 | if (File.Exists(filePath)) |
@@ -264,7 +264,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
264 | ReadAssetDetails(source); | 264 | ReadAssetDetails(source); |
265 | } | 265 | } |
266 | 266 | ||
267 | m_plugin.CommitAssets(); | 267 | m_assetProviderPlugin.CommitAssets(); |
268 | } | 268 | } |
269 | 269 | ||
270 | protected void ReadAssetDetails(IConfigSource source) | 270 | protected void ReadAssetDetails(IConfigSource source) |
@@ -282,7 +282,7 @@ namespace OpenSim.Framework.Communications.Caches | |||
282 | { | 282 | { |
283 | MainLog.Instance.Verbose("Creating new asset: " + newAsset.Name); | 283 | MainLog.Instance.Verbose("Creating new asset: " + newAsset.Name); |
284 | this.LoadAsset(newAsset, false, fileName); | 284 | this.LoadAsset(newAsset, false, fileName); |
285 | m_plugin.CreateAsset(newAsset); | 285 | m_assetProviderPlugin.CreateAsset(newAsset); |
286 | } | 286 | } |
287 | } | 287 | } |
288 | } | 288 | } |