diff options
Heart surgery on asset service code bits. Affects OpenSim.ini configuration -- please see the example. Affects region servers only.
This may break a lot of things, but it needs to go in. It was tested in standalone and the UCI grid, but it needs a lot more testing.
Known problems:
* HG asset transfers are borked for now
* missing texture is missing
* 3 unit tests commented out for now
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs | 138 |
1 files changed, 0 insertions, 138 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs b/OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs deleted file mode 100644 index e738560..0000000 --- a/OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs +++ /dev/null | |||
@@ -1,138 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
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 | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Reflection; | ||
29 | using log4net; | ||
30 | using Nini.Config; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Data; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Communications; | ||
35 | using OpenSim.Framework.Communications.Cache; | ||
36 | using OpenSim.Framework.Servers; | ||
37 | using OpenSim.Framework.Servers.HttpServer; | ||
38 | using OpenSim.Region.Framework.Interfaces; | ||
39 | using OpenSim.Region.Framework.Scenes; | ||
40 | |||
41 | namespace OpenSim.Region.CoreModules.Framework.Services | ||
42 | { | ||
43 | public class RegionAssetService : IRegionModule | ||
44 | { | ||
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | private static bool initialized = false; | ||
47 | private static bool enabled = false; | ||
48 | |||
49 | private bool m_gridMode = false; | ||
50 | Scene m_scene; | ||
51 | |||
52 | #region IRegionModule interface | ||
53 | |||
54 | public void Initialise(Scene scene, IConfigSource config) | ||
55 | { | ||
56 | if (!initialized) | ||
57 | { | ||
58 | initialized = true; | ||
59 | m_scene = scene; | ||
60 | |||
61 | // This module is only on for standalones in hypergrid mode | ||
62 | enabled = ((!config.Configs["Startup"].GetBoolean("gridmode", true)) && | ||
63 | config.Configs["Startup"].GetBoolean("hypergrid", true)) || | ||
64 | ((config.Configs["MXP"] != null) && config.Configs["MXP"].GetBoolean("Enabled", true)); | ||
65 | m_gridMode = config.Configs["Startup"].GetBoolean("gridmode", true); | ||
66 | } | ||
67 | } | ||
68 | |||
69 | public void PostInitialise() | ||
70 | { | ||
71 | if (enabled) | ||
72 | { | ||
73 | m_log.Info("[RegionAssetService]: Starting..."); | ||
74 | |||
75 | new AssetService(m_scene,m_gridMode); | ||
76 | } | ||
77 | } | ||
78 | |||
79 | public void Close() | ||
80 | { | ||
81 | } | ||
82 | |||
83 | public string Name | ||
84 | { | ||
85 | get { return "RegionAssetService"; } | ||
86 | } | ||
87 | |||
88 | public bool IsSharedModule | ||
89 | { | ||
90 | get { return true; } | ||
91 | } | ||
92 | |||
93 | #endregion | ||
94 | |||
95 | } | ||
96 | |||
97 | public class AssetService | ||
98 | { | ||
99 | // private IUserService m_userService; | ||
100 | private bool m_doLookup = false; | ||
101 | private bool m_gridMode = false; | ||
102 | |||
103 | public bool DoLookup | ||
104 | { | ||
105 | get { return m_doLookup; } | ||
106 | set { m_doLookup = value; } | ||
107 | } | ||
108 | // private static readonly ILog m_log | ||
109 | // = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
110 | |||
111 | public AssetService(Scene m_scene, bool gridMode) | ||
112 | { | ||
113 | m_gridMode = gridMode; | ||
114 | AddHttpHandlers(m_scene); | ||
115 | // m_userService = m_scene.CommsManager.UserService; | ||
116 | } | ||
117 | |||
118 | protected void AddHttpHandlers(Scene m_scene) | ||
119 | { | ||
120 | IAssetDataPlugin m_assetProvider | ||
121 | = ((AssetServerBase)m_scene.CommsManager.AssetCache.AssetServer).AssetProviderPlugin; | ||
122 | |||
123 | IHttpServer httpServer = m_scene.CommsManager.HttpServer; | ||
124 | |||
125 | if (m_gridMode) | ||
126 | { | ||
127 | httpServer.AddStreamHandler(new CachedGetAssetStreamHandler(m_scene.CommsManager.AssetCache)); | ||
128 | } | ||
129 | else | ||
130 | { | ||
131 | httpServer.AddStreamHandler(new GetAssetStreamHandler(m_assetProvider)); | ||
132 | } | ||
133 | |||
134 | httpServer.AddStreamHandler(new PostAssetStreamHandler(m_assetProvider)); | ||
135 | |||
136 | } | ||
137 | } | ||
138 | } | ||