aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs44
1 files changed, 43 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
index 7b4e374..0aa753d 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
@@ -31,6 +31,7 @@ using System;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Reflection; 32using System.Reflection;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache;
34using OpenSim.Server.Base; 35using OpenSim.Server.Base;
35using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
@@ -40,7 +41,7 @@ using OpenMetaverse;
40namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset 41namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
41{ 42{
42 public class HGAssetBroker : 43 public class HGAssetBroker :
43 ISharedRegionModule, IAssetService 44 ISharedRegionModule, IAssetService, IHyperAssetService
44 { 45 {
45 private static readonly ILog m_log = 46 private static readonly ILog m_log =
46 LogManager.GetLogger( 47 LogManager.GetLogger(
@@ -50,6 +51,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
50 private IAssetService m_GridService; 51 private IAssetService m_GridService;
51 private IAssetService m_HGService; 52 private IAssetService m_HGService;
52 53
54 private Scene m_aScene;
55 private string m_LocalAssetServiceURI;
56
53 private bool m_Enabled = false; 57 private bool m_Enabled = false;
54 58
55 public Type ReplaceableInterface 59 public Type ReplaceableInterface
@@ -114,6 +118,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
114 return; 118 return;
115 } 119 }
116 120
121 m_LocalAssetServiceURI = assetConfig.GetString("AssetServerURI", string.Empty);
122 if (m_LocalAssetServiceURI == string.Empty)
123 {
124 IConfig netConfig = source.Configs["Network"];
125 m_LocalAssetServiceURI = netConfig.GetString("asset_server_url", string.Empty);
126 }
127
128 if (m_LocalAssetServiceURI != string.Empty)
129 m_LocalAssetServiceURI = m_LocalAssetServiceURI.Trim('/');
130
117 m_Enabled = true; 131 m_Enabled = true;
118 m_log.Info("[HG ASSET CONNECTOR]: HG asset broker enabled"); 132 m_log.Info("[HG ASSET CONNECTOR]: HG asset broker enabled");
119 } 133 }
@@ -132,8 +146,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
132 { 146 {
133 if (!m_Enabled) 147 if (!m_Enabled)
134 return; 148 return;
149
150 m_aScene = scene;
135 151
136 scene.RegisterModuleInterface<IAssetService>(this); 152 scene.RegisterModuleInterface<IAssetService>(this);
153 scene.RegisterModuleInterface<IHyperAssetService>(this);
137 } 154 }
138 155
139 public void RemoveRegion(Scene scene) 156 public void RemoveRegion(Scene scene)
@@ -344,5 +361,30 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
344 else 361 else
345 return m_GridService.Delete(id); 362 return m_GridService.Delete(id);
346 } 363 }
364
365 #region IHyperAssetService
366
367 public string GetUserAssetServer(UUID userID)
368 {
369 CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
370 if ((uinfo != null) && (uinfo.UserProfile != null))
371 {
372 if ((uinfo.UserProfile.UserAssetURI == string.Empty) || (uinfo.UserProfile.UserAssetURI == ""))
373 return m_LocalAssetServiceURI;
374 return uinfo.UserProfile.UserAssetURI.Trim('/');
375 }
376 else
377 {
378 // we don't know anyting about this user
379 return string.Empty;
380 }
381 }
382
383 public string GetSimAssetServer()
384 {
385 return m_LocalAssetServiceURI;
386 }
387
388 #endregion
347 } 389 }
348} 390}