aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectors/Asset/HGAssetBroker.cs
diff options
context:
space:
mode:
authordiva2009-05-17 01:38:43 +0000
committerdiva2009-05-17 01:38:43 +0000
commitaac8ca041170f6d1d648c6c5244dc3dfad428587 (patch)
tree190873d49a54f7462190331344aa308d8b6eb15f /OpenSim/Region/CoreModules/ServiceConnectors/Asset/HGAssetBroker.cs
parentSend the owner name, not the client name on SendDialog. (diff)
downloadopensim-SC_OLD-aac8ca041170f6d1d648c6c5244dc3dfad428587.zip
opensim-SC_OLD-aac8ca041170f6d1d648c6c5244dc3dfad428587.tar.gz
opensim-SC_OLD-aac8ca041170f6d1d648c6c5244dc3dfad428587.tar.bz2
opensim-SC_OLD-aac8ca041170f6d1d648c6c5244dc3dfad428587.tar.xz
HG asset transfers starting to work -- GETs only for now.
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectors/Asset/HGAssetBroker.cs')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectors/Asset/HGAssetBroker.cs62
1 files changed, 41 insertions, 21 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Asset/HGAssetBroker.cs
index d537d7b..c3a878e 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/HGAssetBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectors/Asset/HGAssetBroker.cs
@@ -35,6 +35,7 @@ using OpenSim.Servers.Base;
35using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
38using OpenMetaverse;
38 39
39namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset 40namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
40{ 41{
@@ -46,7 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
46 MethodBase.GetCurrentMethod().DeclaringType); 47 MethodBase.GetCurrentMethod().DeclaringType);
47 48
48 private IImprovedAssetCache m_Cache = null; 49 private IImprovedAssetCache m_Cache = null;
49 private IAssetService m_LocalService; 50 private IAssetService m_GridService;
50 private IAssetService m_HGService; 51 private IAssetService m_HGService;
51 52
52 private bool m_Enabled = false; 53 private bool m_Enabled = false;
@@ -67,29 +68,29 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
67 IConfig assetConfig = source.Configs["AssetService"]; 68 IConfig assetConfig = source.Configs["AssetService"];
68 if (assetConfig == null) 69 if (assetConfig == null)
69 { 70 {
70 m_log.Error("[ASSET CONNECTOR]: AssetService missing from OpanSim.ini"); 71 m_log.Error("[HG ASSET CONNECTOR]: AssetService missing from OpenSim.ini");
71 return; 72 return;
72 } 73 }
73 74
74 string localDll = assetConfig.GetString("LocalModule", 75 string localDll = assetConfig.GetString("LocalGridAssetService",
75 String.Empty); 76 String.Empty);
76 string HGDll = assetConfig.GetString("HypergridModule", 77 string HGDll = assetConfig.GetString("HypergridAssetService",
77 String.Empty); 78 String.Empty);
78 79
79 if (localDll == String.Empty) 80 if (localDll == String.Empty)
80 { 81 {
81 m_log.Error("[ASSET CONNECTOR]: No LocalModule named in section AssetService"); 82 m_log.Error("[HG ASSET CONNECTOR]: No LocalGridAssetService named in section AssetService");
82 return; 83 return;
83 } 84 }
84 85
85 if (HGDll == String.Empty) 86 if (HGDll == String.Empty)
86 { 87 {
87 m_log.Error("[ASSET CONNECTOR]: No HypergridModule named in section AssetService"); 88 m_log.Error("[HG ASSET CONNECTOR]: No HypergridAssetService named in section AssetService");
88 return; 89 return;
89 } 90 }
90 91
91 Object[] args = new Object[] { source }; 92 Object[] args = new Object[] { source };
92 m_LocalService = 93 m_GridService =
93 ServerUtils.LoadPlugin<IAssetService>(localDll, 94 ServerUtils.LoadPlugin<IAssetService>(localDll,
94 args); 95 args);
95 96
@@ -97,19 +98,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
97 ServerUtils.LoadPlugin<IAssetService>(HGDll, 98 ServerUtils.LoadPlugin<IAssetService>(HGDll,
98 args); 99 args);
99 100
100 if (m_LocalService == null) 101 if (m_GridService == null)
101 { 102 {
102 m_log.Error("[ASSET CONNECTOR]: Can't load local asset service"); 103 m_log.Error("[HG ASSET CONNECTOR]: Can't load local asset service");
103 return; 104 return;
104 } 105 }
105 if (m_HGService == null) 106 if (m_HGService == null)
106 { 107 {
107 m_log.Error("[ASSET CONNECTOR]: Can't load hypergrid asset service"); 108 m_log.Error("[HG ASSET CONNECTOR]: Can't load hypergrid asset service");
108 return; 109 return;
109 } 110 }
110 111
111 m_Enabled = true; 112 m_Enabled = true;
112 m_log.Info("[ASSET CONNECTOR]: HG asset broker enabled"); 113 m_log.Info("[HG ASSET CONNECTOR]: HG asset broker enabled");
113 } 114 }
114 } 115 }
115 } 116 }
@@ -147,11 +148,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
147 m_Cache = null; 148 m_Cache = null;
148 } 149 }
149 150
150 m_log.InfoFormat("[ASSET CONNECTOR]: Enabled hypergrid asset broker for region {0}", scene.RegionInfo.RegionName); 151 m_log.InfoFormat("[HG ASSET CONNECTOR]: Enabled hypergrid asset broker for region {0}", scene.RegionInfo.RegionName);
151 152
152 if (m_Cache != null) 153 if (m_Cache != null)
153 { 154 {
154 m_log.InfoFormat("[ASSET CONNECTOR]: Enabled asset caching for region {0}", scene.RegionInfo.RegionName); 155 m_log.InfoFormat("[HG ASSET CONNECTOR]: Enabled asset caching for region {0}", scene.RegionInfo.RegionName);
155 } 156 }
156 } 157 }
157 158
@@ -168,20 +169,36 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
168 169
169 public AssetBase Get(string id) 170 public AssetBase Get(string id)
170 { 171 {
172 m_log.DebugFormat("[HG ASSET CONNECTOR]: Get {0}", id);
171 AssetBase asset = null; 173 AssetBase asset = null;
172 174
173 if (m_Cache != null) 175 if (m_Cache != null)
174 { 176 {
175 m_Cache.Get(id); 177 asset = m_Cache.Get(id);
176 178
177 if (asset != null) 179 if (asset != null)
178 return asset; 180 return asset;
181 else
182 m_log.DebugFormat("[HG ASSSET CONNECTOR]: Requested asset is not in cache. This shouldn't happen.");
179 } 183 }
180 184
181 if (IsHG(id)) 185 if (IsHG(id))
186 {
182 asset = m_HGService.Get(id); 187 asset = m_HGService.Get(id);
188 if (asset != null)
189 {
190 // Now store it locally
191 // For now, let me just do it for textures and scripts
192 if (((AssetType)asset.Type == AssetType.Texture) ||
193 ((AssetType)asset.Type == AssetType.LSLBytecode) ||
194 ((AssetType)asset.Type == AssetType.LSLText))
195 {
196 m_GridService.Store(asset);
197 }
198 }
199 }
183 else 200 else
184 asset = m_LocalService.Get(id); 201 asset = m_GridService.Get(id);
185 202
186 if (asset != null) 203 if (asset != null)
187 { 204 {
@@ -210,7 +227,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
210 if (IsHG(id)) 227 if (IsHG(id))
211 metadata = m_HGService.GetMetadata(id); 228 metadata = m_HGService.GetMetadata(id);
212 else 229 else
213 metadata = m_LocalService.GetMetadata(id); 230 metadata = m_GridService.GetMetadata(id);
214 231
215 return metadata; 232 return metadata;
216 } 233 }
@@ -231,7 +248,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
231 if (IsHG(id)) 248 if (IsHG(id))
232 asset = m_HGService.Get(id); 249 asset = m_HGService.Get(id);
233 else 250 else
234 asset = m_LocalService.Get(id); 251 asset = m_GridService.Get(id);
235 252
236 if (asset != null) 253 if (asset != null)
237 { 254 {
@@ -267,7 +284,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
267 } 284 }
268 else 285 else
269 { 286 {
270 return m_LocalService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) 287 return m_GridService.Get(id, sender, delegate (string assetID, Object s, AssetBase a)
271 { 288 {
272 if (a != null && m_Cache != null) 289 if (a != null && m_Cache != null)
273 m_Cache.Cache(a); 290 m_Cache.Cache(a);
@@ -281,10 +298,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
281 if (m_Cache != null) 298 if (m_Cache != null)
282 m_Cache.Cache(asset); 299 m_Cache.Cache(asset);
283 300
301 if (asset.Temporary || asset.Local)
302 return asset.ID;
303
284 if (IsHG(asset.ID)) 304 if (IsHG(asset.ID))
285 return m_HGService.Store(asset); 305 return m_HGService.Store(asset);
286 else 306 else
287 return m_LocalService.Store(asset); 307 return m_GridService.Store(asset);
288 } 308 }
289 309
290 public bool UpdateContent(string id, byte[] data) 310 public bool UpdateContent(string id, byte[] data)
@@ -303,7 +323,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
303 if (IsHG(id)) 323 if (IsHG(id))
304 return m_HGService.UpdateContent(id, data); 324 return m_HGService.UpdateContent(id, data);
305 else 325 else
306 return m_LocalService.UpdateContent(id, data); 326 return m_GridService.UpdateContent(id, data);
307 } 327 }
308 328
309 public bool Delete(string id) 329 public bool Delete(string id)
@@ -314,7 +334,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
314 if (IsHG(id)) 334 if (IsHG(id))
315 return m_HGService.Delete(id); 335 return m_HGService.Delete(id);
316 else 336 else
317 return m_LocalService.Delete(id); 337 return m_GridService.Delete(id);
318 } 338 }
319 } 339 }
320} 340}