diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/AssetService/HGAssetService.cs (renamed from OpenSim/Region/CoreModules/ServiceConnectors/Asset/HGAssetServiceConnector.cs) | 74 |
1 files changed, 8 insertions, 66 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/HGAssetServiceConnector.cs b/OpenSim/Services/AssetService/HGAssetService.cs index 58cc134..7415427 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/HGAssetServiceConnector.cs +++ b/OpenSim/Services/AssetService/HGAssetService.cs | |||
@@ -28,91 +28,33 @@ | |||
28 | using log4net; | 28 | using log4net; |
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using System; | 30 | using System; |
31 | using System.Collections.Generic; | ||
32 | using System.Reflection; | 31 | using System.Reflection; |
33 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
34 | using OpenSim.Servers.Base; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | using OpenSim.Region.Framework.Scenes; | ||
37 | using OpenSim.Services.Interfaces; | 33 | using OpenSim.Services.Interfaces; |
38 | 34 | ||
39 | namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset | 35 | namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset |
40 | { | 36 | { |
41 | public class HGAssetServicesConnector : | 37 | public class HGAssetService : IAssetService |
42 | ISharedRegionModule, IAssetService | ||
43 | { | 38 | { |
44 | private static readonly ILog m_log = | 39 | private static readonly ILog m_log = |
45 | LogManager.GetLogger( | 40 | LogManager.GetLogger( |
46 | MethodBase.GetCurrentMethod().DeclaringType); | 41 | MethodBase.GetCurrentMethod().DeclaringType); |
47 | 42 | ||
48 | private IImprovedAssetCache m_Cache = null; | 43 | public HGAssetService(IConfigSource source) |
49 | |||
50 | private bool m_Enabled = false; | ||
51 | |||
52 | public string Name | ||
53 | { | ||
54 | get { return "HGAssetServicesConnector"; } | ||
55 | } | ||
56 | |||
57 | public void Initialise(IConfigSource source) | ||
58 | { | 44 | { |
59 | IConfig moduleConfig = source.Configs["Modules"]; | 45 | IConfig moduleConfig = source.Configs["Modules"]; |
60 | if (moduleConfig != null) | 46 | if (moduleConfig != null) |
61 | { | 47 | { |
62 | string name = moduleConfig.GetString("AssetServices", ""); | 48 | string name = moduleConfig.GetString("AssetServices", ""); |
63 | if (name == Name) | ||
64 | { | ||
65 | IConfig assetConfig = source.Configs["AssetService"]; | ||
66 | if (assetConfig == null) | ||
67 | { | ||
68 | m_log.Error("[ASSET CONNECTOR]: AssetService missing from OpanSim.ini"); | ||
69 | return; | ||
70 | } | ||
71 | 49 | ||
72 | m_Enabled = true; | 50 | IConfig assetConfig = source.Configs["AssetService"]; |
73 | m_log.Info("[ASSET CONNECTOR]: HG asset connector enabled"); | 51 | if (assetConfig == null) |
52 | { | ||
53 | m_log.Error("[ASSET CONNECTOR]: AssetService missing from OpanSim.ini"); | ||
54 | return; | ||
74 | } | 55 | } |
75 | } | ||
76 | } | ||
77 | |||
78 | public void PostInitialise() | ||
79 | { | ||
80 | } | ||
81 | |||
82 | public void Close() | ||
83 | { | ||
84 | } | ||
85 | 56 | ||
86 | public void AddRegion(Scene scene) | 57 | m_log.Info("[ASSET CONNECTOR]: HG asset service enabled"); |
87 | { | ||
88 | if (!m_Enabled) | ||
89 | return; | ||
90 | |||
91 | scene.RegisterModuleInterface<IAssetService>(this); | ||
92 | } | ||
93 | |||
94 | public void RemoveRegion(Scene scene) | ||
95 | { | ||
96 | } | ||
97 | |||
98 | public void RegionLoaded(Scene scene) | ||
99 | { | ||
100 | if (!m_Enabled) | ||
101 | return; | ||
102 | |||
103 | if (m_Cache == null) | ||
104 | { | ||
105 | m_Cache = scene.RequestModuleInterface<IImprovedAssetCache>(); | ||
106 | |||
107 | if (!(m_Cache is ISharedRegionModule)) | ||
108 | m_Cache = null; | ||
109 | } | ||
110 | |||
111 | m_log.InfoFormat("[ASSET CONNECTOR]: Enabled local assets for region {0}", scene.RegionInfo.RegionName); | ||
112 | |||
113 | if (m_Cache != null) | ||
114 | { | ||
115 | m_log.InfoFormat("[ASSET CONNECTOR]: Enabled asset caching for region {0}", scene.RegionInfo.RegionName); | ||
116 | } | 58 | } |
117 | } | 59 | } |
118 | 60 | ||