diff options
Diffstat (limited to 'OpenSim/SimulatorServices/RegionAssetService.cs')
-rw-r--r-- | OpenSim/SimulatorServices/RegionAssetService.cs | 246 |
1 files changed, 123 insertions, 123 deletions
diff --git a/OpenSim/SimulatorServices/RegionAssetService.cs b/OpenSim/SimulatorServices/RegionAssetService.cs index 9a2cbb9..651e6d4 100644 --- a/OpenSim/SimulatorServices/RegionAssetService.cs +++ b/OpenSim/SimulatorServices/RegionAssetService.cs | |||
@@ -1,123 +1,123 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
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 | ||
28 | using System.Reflection; | 28 | using System.Reflection; |
29 | using log4net; | 29 | using log4net; |
30 | using Nini.Config; | 30 | using Nini.Config; |
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Framework.Servers.HttpServer; | 32 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
34 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
35 | using OpenSim.Servers.AssetServer.Handlers; | 35 | using OpenSim.Servers.AssetServer.Handlers; |
36 | 36 | ||
37 | namespace OpenSim.Region.SimulatorServices | 37 | namespace OpenSim.Region.SimulatorServices |
38 | { | 38 | { |
39 | public class RegionAssetService : IRegionModule | 39 | public class RegionAssetService : IRegionModule |
40 | { | 40 | { |
41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
42 | private static bool initialized = false; | 42 | private static bool initialized = false; |
43 | private static bool enabled = false; | 43 | private static bool enabled = false; |
44 | 44 | ||
45 | private bool m_gridMode = false; | 45 | private bool m_gridMode = false; |
46 | Scene m_scene; | 46 | Scene m_scene; |
47 | 47 | ||
48 | #region IRegionModule interface | 48 | #region IRegionModule interface |
49 | 49 | ||
50 | public void Initialise(Scene scene, IConfigSource config) | 50 | public void Initialise(Scene scene, IConfigSource config) |
51 | { | 51 | { |
52 | if (!initialized) | 52 | if (!initialized) |
53 | { | 53 | { |
54 | initialized = true; | 54 | initialized = true; |
55 | m_scene = scene; | 55 | m_scene = scene; |
56 | 56 | ||
57 | // This module is only on for standalones in hypergrid mode | 57 | // This module is only on for standalones in hypergrid mode |
58 | enabled = ((!config.Configs["Startup"].GetBoolean("gridmode", true)) && | 58 | enabled = ((!config.Configs["Startup"].GetBoolean("gridmode", true)) && |
59 | config.Configs["Startup"].GetBoolean("hypergrid", true)) || | 59 | config.Configs["Startup"].GetBoolean("hypergrid", true)) || |
60 | ((config.Configs["MXP"] != null) && config.Configs["MXP"].GetBoolean("Enabled", true)); | 60 | ((config.Configs["MXP"] != null) && config.Configs["MXP"].GetBoolean("Enabled", true)); |
61 | m_gridMode = config.Configs["Startup"].GetBoolean("gridmode", true); | 61 | m_gridMode = config.Configs["Startup"].GetBoolean("gridmode", true); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | public void PostInitialise() | 65 | public void PostInitialise() |
66 | { | 66 | { |
67 | if (enabled) | 67 | if (enabled) |
68 | { | 68 | { |
69 | m_log.Info("[RegionAssetService]: Starting..."); | 69 | m_log.Info("[RegionAssetService]: Starting..."); |
70 | 70 | ||
71 | new AssetService(m_scene,m_gridMode); | 71 | new AssetService(m_scene,m_gridMode); |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | public void Close() | 75 | public void Close() |
76 | { | 76 | { |
77 | } | 77 | } |
78 | 78 | ||
79 | public string Name | 79 | public string Name |
80 | { | 80 | { |
81 | get { return "RegionAssetService"; } | 81 | get { return "RegionAssetService"; } |
82 | } | 82 | } |
83 | 83 | ||
84 | public bool IsSharedModule | 84 | public bool IsSharedModule |
85 | { | 85 | { |
86 | get { return true; } | 86 | get { return true; } |
87 | } | 87 | } |
88 | 88 | ||
89 | #endregion | 89 | #endregion |
90 | 90 | ||
91 | } | 91 | } |
92 | 92 | ||
93 | public class AssetService | 93 | public class AssetService |
94 | { | 94 | { |
95 | private bool m_doLookup = false; | 95 | private bool m_doLookup = false; |
96 | private bool m_gridMode = false; | 96 | private bool m_gridMode = false; |
97 | 97 | ||
98 | public bool DoLookup | 98 | public bool DoLookup |
99 | { | 99 | { |
100 | get { return m_doLookup; } | 100 | get { return m_doLookup; } |
101 | set { m_doLookup = value; } | 101 | set { m_doLookup = value; } |
102 | } | 102 | } |
103 | // private static readonly ILog m_log | 103 | // private static readonly ILog m_log |
104 | // = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 104 | // = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
105 | 105 | ||
106 | public AssetService(Scene m_scene, bool gridMode) | 106 | public AssetService(Scene m_scene, bool gridMode) |
107 | { | 107 | { |
108 | m_gridMode = gridMode; | 108 | m_gridMode = gridMode; |
109 | AddHttpHandlers(m_scene); | 109 | AddHttpHandlers(m_scene); |
110 | } | 110 | } |
111 | 111 | ||
112 | protected void AddHttpHandlers(Scene m_scene) | 112 | protected void AddHttpHandlers(Scene m_scene) |
113 | { | 113 | { |
114 | IHttpServer httpServer = m_scene.CommsManager.HttpServer; | 114 | IHttpServer httpServer = m_scene.CommsManager.HttpServer; |
115 | 115 | ||
116 | httpServer.AddStreamHandler(new AssetServerGetHandler(m_scene.AssetService)); | 116 | httpServer.AddStreamHandler(new AssetServerGetHandler(m_scene.AssetService)); |
117 | httpServer.AddStreamHandler(new AssetServerPostHandler(m_scene.AssetService)); | 117 | httpServer.AddStreamHandler(new AssetServerPostHandler(m_scene.AssetService)); |
118 | httpServer.AddStreamHandler(new AssetServerDeleteHandler(m_scene.AssetService)); | 118 | httpServer.AddStreamHandler(new AssetServerDeleteHandler(m_scene.AssetService)); |
119 | 119 | ||
120 | 120 | ||
121 | } | 121 | } |
122 | } | 122 | } |
123 | } | 123 | } |