aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/SimulatorServices/RegionAssetService.cs
diff options
context:
space:
mode:
authordiva2009-05-15 05:00:25 +0000
committerdiva2009-05-15 05:00:25 +0000
commit5e4fc6e91e5edffd1dc23af4f583d6294f394a3d (patch)
tree497076db68193be2d14fc3788c1d80c74d8c977d /OpenSim/SimulatorServices/RegionAssetService.cs
parentsome sculpted prim geometry accuracy and meshing speed improvements (diff)
downloadopensim-SC_OLD-5e4fc6e91e5edffd1dc23af4f583d6294f394a3d.zip
opensim-SC_OLD-5e4fc6e91e5edffd1dc23af4f583d6294f394a3d.tar.gz
opensim-SC_OLD-5e4fc6e91e5edffd1dc23af4f583d6294f394a3d.tar.bz2
opensim-SC_OLD-5e4fc6e91e5edffd1dc23af4f583d6294f394a3d.tar.xz
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 '')
-rw-r--r--OpenSim/SimulatorServices/RegionAssetService.cs (renamed from OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs)261
1 files changed, 123 insertions, 138 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs b/OpenSim/SimulatorServices/RegionAssetService.cs
index e738560..9a2cbb9 100644
--- a/OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs
+++ b/OpenSim/SimulatorServices/RegionAssetService.cs
@@ -1,138 +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
28using System.Reflection; 28using System.Reflection;
29using log4net; 29using log4net;
30using Nini.Config; 30using Nini.Config;
31using OpenMetaverse; 31using OpenSim.Framework;
32using OpenSim.Data; 32using OpenSim.Framework.Servers.HttpServer;
33using OpenSim.Framework; 33using OpenSim.Region.Framework.Scenes;
34using OpenSim.Framework.Communications; 34using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Framework.Communications.Cache; 35using OpenSim.Servers.AssetServer.Handlers;
36using OpenSim.Framework.Servers; 36
37using OpenSim.Framework.Servers.HttpServer; 37namespace OpenSim.Region.SimulatorServices
38using OpenSim.Region.Framework.Interfaces; 38{
39using OpenSim.Region.Framework.Scenes; 39 public class RegionAssetService : IRegionModule
40 40 {
41namespace OpenSim.Region.CoreModules.Framework.Services 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42{ 42 private static bool initialized = false;
43 public class RegionAssetService : IRegionModule 43 private static bool enabled = false;
44 { 44
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private bool m_gridMode = false;
46 private static bool initialized = false; 46 Scene m_scene;
47 private static bool enabled = false; 47
48 48 #region IRegionModule interface
49 private bool m_gridMode = false; 49
50 Scene m_scene; 50 public void Initialise(Scene scene, IConfigSource config)
51 51 {
52 #region IRegionModule interface 52 if (!initialized)
53 53 {
54 public void Initialise(Scene scene, IConfigSource config) 54 initialized = true;
55 { 55 m_scene = scene;
56 if (!initialized) 56
57 { 57 // This module is only on for standalones in hypergrid mode
58 initialized = true; 58 enabled = ((!config.Configs["Startup"].GetBoolean("gridmode", true)) &&
59 m_scene = scene; 59 config.Configs["Startup"].GetBoolean("hypergrid", true)) ||
60 60 ((config.Configs["MXP"] != null) && config.Configs["MXP"].GetBoolean("Enabled", true));
61 // This module is only on for standalones in hypergrid mode 61 m_gridMode = config.Configs["Startup"].GetBoolean("gridmode", true);
62 enabled = ((!config.Configs["Startup"].GetBoolean("gridmode", true)) && 62 }
63 config.Configs["Startup"].GetBoolean("hypergrid", true)) || 63 }
64 ((config.Configs["MXP"] != null) && config.Configs["MXP"].GetBoolean("Enabled", true)); 64
65 m_gridMode = config.Configs["Startup"].GetBoolean("gridmode", true); 65 public void PostInitialise()
66 } 66 {
67 } 67 if (enabled)
68 68 {
69 public void PostInitialise() 69 m_log.Info("[RegionAssetService]: Starting...");
70 { 70
71 if (enabled) 71 new AssetService(m_scene,m_gridMode);
72 { 72 }
73 m_log.Info("[RegionAssetService]: Starting..."); 73 }
74 74
75 new AssetService(m_scene,m_gridMode); 75 public void Close()
76 } 76 {
77 } 77 }
78 78
79 public void Close() 79 public string Name
80 { 80 {
81 } 81 get { return "RegionAssetService"; }
82 82 }
83 public string Name 83
84 { 84 public bool IsSharedModule
85 get { return "RegionAssetService"; } 85 {
86 } 86 get { return true; }
87 87 }
88 public bool IsSharedModule 88
89 { 89 #endregion
90 get { return true; } 90
91 } 91 }
92 92
93 #endregion 93 public class AssetService
94 94 {
95 } 95 private bool m_doLookup = false;
96 96 private bool m_gridMode = false;
97 public class AssetService 97
98 { 98 public bool DoLookup
99// private IUserService m_userService; 99 {
100 private bool m_doLookup = false; 100 get { return m_doLookup; }
101 private bool m_gridMode = false; 101 set { m_doLookup = value; }
102 102 }
103 public bool DoLookup 103// private static readonly ILog m_log
104 { 104// = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
105 get { return m_doLookup; } 105
106 set { m_doLookup = value; } 106 public AssetService(Scene m_scene, bool gridMode)
107 } 107 {
108// private static readonly ILog m_log 108 m_gridMode = gridMode;
109// = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 109 AddHttpHandlers(m_scene);
110 110 }
111 public AssetService(Scene m_scene, bool gridMode) 111
112 { 112 protected void AddHttpHandlers(Scene m_scene)
113 m_gridMode = gridMode; 113 {
114 AddHttpHandlers(m_scene); 114 IHttpServer httpServer = m_scene.CommsManager.HttpServer;
115// m_userService = m_scene.CommsManager.UserService; 115
116 } 116 httpServer.AddStreamHandler(new AssetServerGetHandler(m_scene.AssetService));
117 117 httpServer.AddStreamHandler(new AssetServerPostHandler(m_scene.AssetService));
118 protected void AddHttpHandlers(Scene m_scene) 118 httpServer.AddStreamHandler(new AssetServerDeleteHandler(m_scene.AssetService));
119 { 119
120 IAssetDataPlugin m_assetProvider 120
121 = ((AssetServerBase)m_scene.CommsManager.AssetCache.AssetServer).AssetProviderPlugin; 121 }
122 122 }
123 IHttpServer httpServer = m_scene.CommsManager.HttpServer; 123}
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}