aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/SimulatorServices
diff options
context:
space:
mode:
authordiva2009-05-15 05:00:25 +0000
committerdiva2009-05-15 05:00:25 +0000
commit5e4fc6e91e5edffd1dc23af4f583d6294f394a3d (patch)
tree497076db68193be2d14fc3788c1d80c74d8c977d /OpenSim/SimulatorServices
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 'OpenSim/SimulatorServices')
-rw-r--r--OpenSim/SimulatorServices/RegionAssetService.cs123
1 files changed, 123 insertions, 0 deletions
diff --git a/OpenSim/SimulatorServices/RegionAssetService.cs b/OpenSim/SimulatorServices/RegionAssetService.cs
new file mode 100644
index 0000000..9a2cbb9
--- /dev/null
+++ b/OpenSim/SimulatorServices/RegionAssetService.cs
@@ -0,0 +1,123 @@
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
28using System.Reflection;
29using log4net;
30using Nini.Config;
31using OpenSim.Framework;
32using OpenSim.Framework.Servers.HttpServer;
33using OpenSim.Region.Framework.Scenes;
34using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Servers.AssetServer.Handlers;
36
37namespace OpenSim.Region.SimulatorServices
38{
39 public class RegionAssetService : IRegionModule
40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 private static bool initialized = false;
43 private static bool enabled = false;
44
45 private bool m_gridMode = false;
46 Scene m_scene;
47
48 #region IRegionModule interface
49
50 public void Initialise(Scene scene, IConfigSource config)
51 {
52 if (!initialized)
53 {
54 initialized = true;
55 m_scene = scene;
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 }
64
65 public void PostInitialise()
66 {
67 if (enabled)
68 {
69 m_log.Info("[RegionAssetService]: Starting...");
70
71 new AssetService(m_scene,m_gridMode);
72 }
73 }
74
75 public void Close()
76 {
77 }
78
79 public string Name
80 {
81 get { return "RegionAssetService"; }
82 }
83
84 public bool IsSharedModule
85 {
86 get { return true; }
87 }
88
89 #endregion
90
91 }
92
93 public class AssetService
94 {
95 private bool m_doLookup = false;
96 private bool m_gridMode = false;
97
98 public bool DoLookup
99 {
100 get { return m_doLookup; }
101 set { m_doLookup = value; }
102 }
103// private static readonly ILog m_log
104// = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
105
106 public AssetService(Scene m_scene, bool gridMode)
107 {
108 m_gridMode = gridMode;
109 AddHttpHandlers(m_scene);
110 }
111
112 protected void AddHttpHandlers(Scene m_scene)
113 {
114 IHttpServer httpServer = m_scene.CommsManager.HttpServer;
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
120
121 }
122 }
123}