diff options
author | diva | 2009-03-27 15:11:21 +0000 |
---|---|---|
committer | diva | 2009-03-27 15:11:21 +0000 |
commit | 6ddf932c7ebd383e50888c375a80ca4f10e05420 (patch) | |
tree | e22f7e06c9139f98da3e9befca7ecee00de161c0 /OpenSim | |
parent | From: Alan Webb <alan_webb@us.ibm.com> (diff) | |
download | opensim-SC_OLD-6ddf932c7ebd383e50888c375a80ca4f10e05420.zip opensim-SC_OLD-6ddf932c7ebd383e50888c375a80ca4f10e05420.tar.gz opensim-SC_OLD-6ddf932c7ebd383e50888c375a80ca4f10e05420.tar.bz2 opensim-SC_OLD-6ddf932c7ebd383e50888c375a80ca4f10e05420.tar.xz |
svn:eol-style property set.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs | 247 |
1 files changed, 124 insertions, 123 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs b/OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs index 848d05c..90bc462 100644 --- a/OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs +++ b/OpenSim/Region/CoreModules/Framework/Services/RegionAssetService.cs | |||
@@ -1,123 +1,124 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (c) 2008, Contributors. All rights reserved. | 2 | * Copyright (c) 2008, Contributors. All rights reserved. |
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 modification, | 5 | * Redistribution and use in source and binary forms, with or without modification, |
6 | * are permitted provided that the following conditions are met: | 6 | * are permitted provided that the following conditions are met: |
7 | * | 7 | * |
8 | * * Redistributions of source code must retain the above copyright notice, | 8 | * * Redistributions of source code must retain the above copyright notice, |
9 | * this list of conditions and the following disclaimer. | 9 | * this list of conditions and the following disclaimer. |
10 | * * Redistributions in binary form must reproduce the above copyright notice, | 10 | * * Redistributions in binary form must reproduce the above copyright notice, |
11 | * this list of conditions and the following disclaimer in the documentation | 11 | * this list of conditions and the following disclaimer in the documentation |
12 | * and/or other materials provided with the distribution. | 12 | * and/or other materials provided with the distribution. |
13 | * * Neither the name of the Organizations nor the names of Individual | 13 | * * Neither the name of the Organizations nor the names of Individual |
14 | * Contributors may be used to endorse or promote products derived from | 14 | * Contributors may be used to endorse or promote products derived from |
15 | * this software without specific prior written permission. | 15 | * this software without specific prior written permission. |
16 | * | 16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
25 | * OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using log4net; | 30 | using log4net; |
31 | using Nini.Config; | 31 | using Nini.Config; |
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Data; | 33 | using OpenSim.Data; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
36 | using OpenSim.Framework.Communications.Cache; | 36 | using OpenSim.Framework.Communications.Cache; |
37 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
38 | using OpenSim.Framework.Servers.Interfaces; | 38 | using OpenSim.Framework.Servers.Interfaces; |
39 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | 41 | ||
42 | namespace OpenSim.Region.CoreModules.Framework.Services | 42 | namespace OpenSim.Region.CoreModules.Framework.Services |
43 | { | 43 | { |
44 | public class RegionAssetService : IRegionModule | 44 | public class RegionAssetService : IRegionModule |
45 | { | 45 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | private static bool initialized = false; | 47 | private static bool initialized = false; |
48 | private static bool enabled = false; | 48 | private static bool enabled = false; |
49 | 49 | ||
50 | Scene m_scene; | 50 | Scene m_scene; |
51 | 51 | ||
52 | #region IRegionModule interface | 52 | #region IRegionModule interface |
53 | 53 | ||
54 | public void Initialise(Scene scene, IConfigSource config) | 54 | public void Initialise(Scene scene, IConfigSource config) |
55 | { | 55 | { |
56 | if (!initialized) | 56 | if (!initialized) |
57 | { | 57 | { |
58 | initialized = true; | 58 | initialized = true; |
59 | m_scene = scene; | 59 | m_scene = scene; |
60 | 60 | ||
61 | // This module is only on for standalones in hypergrid mode | 61 | // This module is only on for standalones in hypergrid mode |
62 | enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false); | 62 | enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false); |
63 | } | 63 | } |
64 | } | 64 | } |
65 | 65 | ||
66 | public void PostInitialise() | 66 | public void PostInitialise() |
67 | { | 67 | { |
68 | if (enabled) | 68 | if (enabled) |
69 | { | 69 | { |
70 | m_log.Info("[RegionAssetService]: Starting..."); | 70 | m_log.Info("[RegionAssetService]: Starting..."); |
71 | 71 | ||
72 | new AssetService(m_scene); | 72 | new AssetService(m_scene); |
73 | } | 73 | } |
74 | } | 74 | } |
75 | 75 | ||
76 | public void Close() | 76 | public void Close() |
77 | { | 77 | { |
78 | } | 78 | } |
79 | 79 | ||
80 | public string Name | 80 | public string Name |
81 | { | 81 | { |
82 | get { return "RegionAssetService"; } | 82 | get { return "RegionAssetService"; } |
83 | } | 83 | } |
84 | 84 | ||
85 | public bool IsSharedModule | 85 | public bool IsSharedModule |
86 | { | 86 | { |
87 | get { return true; } | 87 | get { return true; } |
88 | } | 88 | } |
89 | 89 | ||
90 | #endregion | 90 | #endregion |
91 | 91 | ||
92 | } | 92 | } |
93 | 93 | ||
94 | public class AssetService | 94 | public class AssetService |
95 | { | 95 | { |
96 | // private IUserService m_userService; | 96 | // private IUserService m_userService; |
97 | private bool m_doLookup = false; | 97 | private bool m_doLookup = false; |
98 | 98 | ||
99 | public bool DoLookup | 99 | public bool DoLookup |
100 | { | 100 | { |
101 | get { return m_doLookup; } | 101 | get { return m_doLookup; } |
102 | set { m_doLookup = value; } | 102 | set { m_doLookup = value; } |
103 | } | 103 | } |
104 | // private static readonly ILog m_log | 104 | // private static readonly ILog m_log |
105 | // = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 105 | // = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
106 | 106 | ||
107 | public AssetService(Scene m_scene) | 107 | public AssetService(Scene m_scene) |
108 | { | 108 | { |
109 | AddHttpHandlers(m_scene); | 109 | AddHttpHandlers(m_scene); |
110 | // m_userService = m_scene.CommsManager.UserService; | 110 | // m_userService = m_scene.CommsManager.UserService; |
111 | } | 111 | } |
112 | 112 | ||
113 | protected void AddHttpHandlers(Scene m_scene) | 113 | protected void AddHttpHandlers(Scene m_scene) |
114 | { | 114 | { |
115 | IAssetDataPlugin m_assetProvider | 115 | IAssetDataPlugin m_assetProvider |
116 | = ((AssetServerBase)m_scene.CommsManager.AssetCache.AssetServer).AssetProviderPlugin; | 116 | = ((AssetServerBase)m_scene.CommsManager.AssetCache.AssetServer).AssetProviderPlugin; |
117 | 117 | ||
118 | IHttpServer httpServer = m_scene.CommsManager.HttpServer; | 118 | IHttpServer httpServer = m_scene.CommsManager.HttpServer; |
119 | httpServer.AddStreamHandler(new GetAssetStreamHandler(m_assetProvider)); | 119 | httpServer.AddStreamHandler(new GetAssetStreamHandler(m_assetProvider)); |
120 | httpServer.AddStreamHandler(new PostAssetStreamHandler(m_assetProvider)); | 120 | httpServer.AddStreamHandler(new PostAssetStreamHandler(m_assetProvider)); |
121 | } | 121 | |
122 | } | 122 | } |
123 | } | 123 | } |
124 | } | ||