aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/SimulatorServices/RegionAssetService.cs74
1 files changed, 26 insertions, 48 deletions
diff --git a/OpenSim/SimulatorServices/RegionAssetService.cs b/OpenSim/SimulatorServices/RegionAssetService.cs
index 3a7ccc8..06f42d3 100644
--- a/OpenSim/SimulatorServices/RegionAssetService.cs
+++ b/OpenSim/SimulatorServices/RegionAssetService.cs
@@ -25,51 +25,40 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.Reflection; 29using System.Reflection;
30using System.Collections.Generic;
29using log4net; 31using log4net;
30using Nini.Config; 32using Nini.Config;
31using OpenSim.Framework; 33using OpenSim.Framework;
32using OpenSim.Framework.Servers.HttpServer; 34using OpenSim.Framework.Servers.HttpServer;
33using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
34using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Server.Handlers.Asset; 37using OpenSim.Server.Base;
38using OpenSim.Server.Handlers.Base;
36 39
37namespace OpenSim.Region.SimulatorServices 40namespace OpenSim.Region.SimulatorServices
38{ 41{
39 public class RegionAssetService : IRegionModule 42 public class RegionAssetService : ISharedRegionModule
40 { 43 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 private static bool initialized = false;
43 private static bool enabled = false; 45 private static bool enabled = false;
44 46
45 private bool m_gridMode = false; 47 private IConfigSource m_Config;
46 Scene m_scene; 48 bool m_Registered = false;
47 49
48 #region IRegionModule interface 50 #region IRegionModule interface
49 51
50 public void Initialise(Scene scene, IConfigSource config) 52 public void Initialise(IConfigSource config)
51 { 53 {
52 if (!initialized) 54 // This module is only on for standalones in hypergrid mode
53 { 55 enabled = ((!config.Configs["Startup"].GetBoolean("gridmode", true)) &&
54 initialized = true; 56 config.Configs["Startup"].GetBoolean("hypergrid", true)) ||
55 m_scene = scene; 57 ((config.Configs["MXP"] != null) && config.Configs["MXP"].GetBoolean("Enabled", true));
56
57 // This module is only on for standalones in hypergrid mode
58 enabled = ((!config.Configs["Startup"].GetBoolean("gridmode", true)) &&
59 config.Configs["Startup"].GetBoolean("hypergrid", true)) ||
60 ((config.Configs["MXP"] != null) && config.Configs["MXP"].GetBoolean("Enabled", true));
61 m_gridMode = config.Configs["Startup"].GetBoolean("gridmode", true);
62 }
63 } 58 }
64 59
65 public void PostInitialise() 60 public void PostInitialise()
66 { 61 {
67 if (enabled)
68 {
69 m_log.Info("[RegionAssetService]: Starting...");
70
71 new AssetService(m_scene,m_gridMode);
72 }
73 } 62 }
74 63
75 public void Close() 64 public void Close()
@@ -81,43 +70,32 @@ namespace OpenSim.Region.SimulatorServices
81 get { return "RegionAssetService"; } 70 get { return "RegionAssetService"; }
82 } 71 }
83 72
84 public bool IsSharedModule 73 public void AddRegion(Scene scene)
85 { 74 {
86 get { return true; } 75 if (!enabled)
87 } 76 return;
88 77
89 #endregion 78 if (!m_Registered)
79 {
80 m_Registered = true;
90 81
91 } 82 m_log.Info("[RegionAssetService]: Starting...");
92 83
93 public class AssetService 84 Object[] args = new Object[] { m_Config, scene.CommsManager.HttpServer };
94 {
95 private bool m_doLookup = false;
96 private bool m_gridMode = false;
97 85
98 public bool DoLookup 86 ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:AssetServiceConnector", args);
99 { 87 }
100 get { return m_doLookup; }
101 set { m_doLookup = value; }
102 } 88 }
103// private static readonly ILog m_log
104// = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
105 89
106 public AssetService(Scene m_scene, bool gridMode) 90 public void RemoveRegion(Scene scene)
107 { 91 {
108 m_gridMode = gridMode;
109 AddHttpHandlers(m_scene);
110 } 92 }
111 93
112 protected void AddHttpHandlers(Scene m_scene) 94 public void RegionLoaded(Scene scene)
113 { 95 {
114 IHttpServer httpServer = m_scene.CommsManager.HttpServer; 96 }
115
116 httpServer.AddStreamHandler(new AssetServerGetHandler(m_scene.AssetService));
117 httpServer.AddStreamHandler(new AssetServerPostHandler(m_scene.AssetService));
118 httpServer.AddStreamHandler(new AssetServerDeleteHandler(m_scene.AssetService));
119 97
98 #endregion
120 99
121 }
122 } 100 }
123} 101}