diff options
author | Diva Canto | 2011-05-02 08:48:55 -0700 |
---|---|---|
committer | Diva Canto | 2011-05-02 08:48:55 -0700 |
commit | 10180760b741edf22cec23db0ec490669407425f (patch) | |
tree | 66f52dc38657213e03470aab161a0d2ffa3fffe6 /OpenSim | |
parent | Start to drill down on GetTexture. Read the config and do different things. (diff) | |
download | opensim-SC_OLD-10180760b741edf22cec23db0ec490669407425f.zip opensim-SC_OLD-10180760b741edf22cec23db0ec490669407425f.tar.gz opensim-SC_OLD-10180760b741edf22cec23db0ec490669407425f.tar.bz2 opensim-SC_OLD-10180760b741edf22cec23db0ec490669407425f.tar.xz |
Works!
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Capabilities/Handlers/GetTextureHandler.cs | 3 | ||||
-rw-r--r-- | OpenSim/Capabilities/Handlers/GetTextureServerConnector.cs (renamed from OpenSim/Capabilities/Handlers/CapsServerConnector.cs) | 12 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 27 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | 2 |
7 files changed, 41 insertions, 20 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTextureHandler.cs index 00186ee..00ff3d0 100644 --- a/OpenSim/Capabilities/Handlers/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTextureHandler.cs | |||
@@ -67,13 +67,14 @@ namespace OpenSim.Capabilities.Handlers | |||
67 | 67 | ||
68 | public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 68 | public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
69 | { | 69 | { |
70 | //m_log.DebugFormat("[GETTEXTURE]: called in {0}", m_scene.RegionInfo.RegionName); | ||
71 | 70 | ||
72 | // Try to parse the texture ID from the request URL | 71 | // Try to parse the texture ID from the request URL |
73 | NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); | 72 | NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); |
74 | string textureStr = query.GetOne("texture_id"); | 73 | string textureStr = query.GetOne("texture_id"); |
75 | string format = query.GetOne("format"); | 74 | string format = query.GetOne("format"); |
76 | 75 | ||
76 | m_log.DebugFormat("[GETTEXTURE]: called {0}", textureStr); | ||
77 | |||
77 | if (m_assetService == null) | 78 | if (m_assetService == null) |
78 | { | 79 | { |
79 | m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service"); | 80 | m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service"); |
diff --git a/OpenSim/Capabilities/Handlers/CapsServerConnector.cs b/OpenSim/Capabilities/Handlers/GetTextureServerConnector.cs index 561d767..0335eac 100644 --- a/OpenSim/Capabilities/Handlers/CapsServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/GetTextureServerConnector.cs | |||
@@ -32,16 +32,15 @@ using OpenSim.Services.Interfaces; | |||
32 | using OpenSim.Framework.Servers.HttpServer; | 32 | using OpenSim.Framework.Servers.HttpServer; |
33 | using OpenSim.Server.Handlers.Base; | 33 | using OpenSim.Server.Handlers.Base; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
36 | 35 | ||
37 | namespace OpenSim.Capabilities.Handlers | 36 | namespace OpenSim.Capabilities.Handlers |
38 | { | 37 | { |
39 | public class CapsServerConnector : ServiceConnector | 38 | public class GetTextureServerConnector : ServiceConnector |
40 | { | 39 | { |
41 | private IAssetService m_AssetService; | 40 | private IAssetService m_AssetService; |
42 | private string m_ConfigName = "CapsService"; | 41 | private string m_ConfigName = "CapsService"; |
43 | 42 | ||
44 | public CapsServerConnector(IConfigSource config, IHttpServer server, string configName) : | 43 | public GetTextureServerConnector(IConfigSource config, IHttpServer server, string configName) : |
45 | base(config, server, configName) | 44 | base(config, server, configName) |
46 | { | 45 | { |
47 | if (configName != String.Empty) | 46 | if (configName != String.Empty) |
@@ -51,11 +50,10 @@ namespace OpenSim.Capabilities.Handlers | |||
51 | if (serverConfig == null) | 50 | if (serverConfig == null) |
52 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); | 51 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); |
53 | 52 | ||
54 | string assetService = serverConfig.GetString("LocalServiceModule", | 53 | string assetService = serverConfig.GetString("AssetService", String.Empty); |
55 | String.Empty); | ||
56 | 54 | ||
57 | if (assetService == String.Empty) | 55 | if (assetService == String.Empty) |
58 | throw new Exception("No LocalServiceModule in config file"); | 56 | throw new Exception("No AssetService in config file"); |
59 | 57 | ||
60 | Object[] args = new Object[] { config }; | 58 | Object[] args = new Object[] { config }; |
61 | m_AssetService = | 59 | m_AssetService = |
@@ -64,8 +62,6 @@ namespace OpenSim.Capabilities.Handlers | |||
64 | if (m_AssetService == null) | 62 | if (m_AssetService == null) |
65 | throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); | 63 | throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); |
66 | 64 | ||
67 | bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false); | ||
68 | |||
69 | server.AddStreamHandler(new GetTextureHandler("/CAPS/" + UUID.Random() + "/", m_AssetService)); | 65 | server.AddStreamHandler(new GetTextureHandler("/CAPS/" + UUID.Random() + "/", m_AssetService)); |
70 | } | 66 | } |
71 | 67 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 7a7964e..7945d5e 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -78,7 +78,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
78 | public GetClientDelegate GetClient = null; | 78 | public GetClientDelegate GetClient = null; |
79 | 79 | ||
80 | private bool m_persistBakedTextures = false; | 80 | private bool m_persistBakedTextures = false; |
81 | private IAssetService m_assetCache; | 81 | private IAssetService m_assetService; |
82 | private bool m_dumpAssetsToFile; | 82 | private bool m_dumpAssetsToFile; |
83 | private string m_regionName; | 83 | private string m_regionName; |
84 | private object m_fetchLock = new Object(); | 84 | private object m_fetchLock = new Object(); |
@@ -95,6 +95,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
95 | m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); | 95 | m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); |
96 | } | 96 | } |
97 | 97 | ||
98 | m_assetService = m_Scene.AssetService; | ||
99 | m_regionName = m_Scene.RegionInfo.RegionName; | ||
100 | |||
98 | RegisterHandlers(); | 101 | RegisterHandlers(); |
99 | 102 | ||
100 | AddNewInventoryItem = m_Scene.AddUploadedInventoryItem; | 103 | AddNewInventoryItem = m_Scene.AddUploadedInventoryItem; |
@@ -347,7 +350,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
347 | asset.Data = data; | 350 | asset.Data = data; |
348 | asset.Temporary = true; | 351 | asset.Temporary = true; |
349 | asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are | 352 | asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are |
350 | m_assetCache.Store(asset); | 353 | m_assetService.Store(asset); |
351 | } | 354 | } |
352 | 355 | ||
353 | /// <summary> | 356 | /// <summary> |
@@ -476,8 +479,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
476 | asset.Data = data; | 479 | asset.Data = data; |
477 | if (AddNewAsset != null) | 480 | if (AddNewAsset != null) |
478 | AddNewAsset(asset); | 481 | AddNewAsset(asset); |
479 | else if (m_assetCache != null) | 482 | else if (m_assetService != null) |
480 | m_assetCache.Store(asset); | 483 | m_assetService.Store(asset); |
481 | 484 | ||
482 | InventoryItemBase item = new InventoryItemBase(); | 485 | InventoryItemBase item = new InventoryItemBase(); |
483 | item.Owner = m_HostCapsObj.AgentID; | 486 | item.Owner = m_HostCapsObj.AgentID; |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs index 4436d4c..14160ae 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCapsModule.cs | |||
@@ -32,6 +32,7 @@ using System.Reflection; | |||
32 | using log4net; | 32 | using log4net; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using Mono.Addins; | ||
35 | 36 | ||
36 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
37 | using OpenSim.Region.Framework; | 38 | using OpenSim.Region.Framework; |
@@ -39,9 +40,12 @@ using OpenSim.Region.Framework.Interfaces; | |||
39 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
40 | using Caps = OpenSim.Framework.Capabilities.Caps; | 41 | using Caps = OpenSim.Framework.Capabilities.Caps; |
41 | 42 | ||
43 | [assembly: Addin("LindenCaps", "0.1")] | ||
44 | [assembly: AddinDependency("OpenSim", "0.5")] | ||
42 | namespace OpenSim.Region.ClientStack.Linden | 45 | namespace OpenSim.Region.ClientStack.Linden |
43 | { | 46 | { |
44 | 47 | ||
48 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | ||
45 | public class BunchOfCapsModule : INonSharedRegionModule | 49 | public class BunchOfCapsModule : INonSharedRegionModule |
46 | { | 50 | { |
47 | private static readonly ILog m_log = | 51 | private static readonly ILog m_log = |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 4920347..4a8bb53 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | |||
@@ -54,7 +54,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
54 | public OSDMap body; | 54 | public OSDMap body; |
55 | } | 55 | } |
56 | 56 | ||
57 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 57 | //[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
58 | public class EventQueueGetModule : IEventQueue, IRegionModule | 58 | public class EventQueueGetModule : IEventQueue, IRegionModule |
59 | { | 59 | { |
60 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 60 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 21041ec..d697f5e 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -52,13 +52,15 @@ namespace OpenSim.Region.ClientStack.Linden | |||
52 | { | 52 | { |
53 | 53 | ||
54 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 54 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
55 | public class GetTextureModule : ISharedRegionModule | 55 | public class GetTextureModule : INonSharedRegionModule |
56 | { | 56 | { |
57 | private static readonly ILog m_log = | 57 | private static readonly ILog m_log = |
58 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 58 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
59 | private Scene m_scene; | 59 | private Scene m_scene; |
60 | private IAssetService m_assetService; | 60 | private IAssetService m_assetService; |
61 | 61 | ||
62 | private bool m_Enabled = false; | ||
63 | |||
62 | // TODO: Change this to a config option | 64 | // TODO: Change this to a config option |
63 | const string REDIRECT_URL = null; | 65 | const string REDIRECT_URL = null; |
64 | 66 | ||
@@ -72,11 +74,18 @@ namespace OpenSim.Region.ClientStack.Linden | |||
72 | if (config == null) | 74 | if (config == null) |
73 | return; | 75 | return; |
74 | 76 | ||
75 | m_URL = config.GetString("Cap_GetTexture", "localhost"); | 77 | m_URL = config.GetString("Cap_GetTexture", string.Empty); |
78 | // Cap doesn't exist | ||
79 | if (m_URL != string.Empty) | ||
80 | m_Enabled = true; | ||
76 | } | 81 | } |
77 | 82 | ||
78 | public void AddRegion(Scene s) | 83 | public void AddRegion(Scene s) |
79 | { | 84 | { |
85 | if (!m_Enabled) | ||
86 | return; | ||
87 | |||
88 | m_scene = s; | ||
80 | } | 89 | } |
81 | 90 | ||
82 | public void RemoveRegion(Scene s) | 91 | public void RemoveRegion(Scene s) |
@@ -85,12 +94,15 @@ namespace OpenSim.Region.ClientStack.Linden | |||
85 | 94 | ||
86 | public void RegionLoaded(Scene s) | 95 | public void RegionLoaded(Scene s) |
87 | { | 96 | { |
97 | if (!m_Enabled) | ||
98 | return; | ||
99 | |||
100 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); | ||
101 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | ||
88 | } | 102 | } |
89 | 103 | ||
90 | public void PostInitialise() | 104 | public void PostInitialise() |
91 | { | 105 | { |
92 | m_assetService = m_scene.RequestModuleInterface<IAssetService>(); | ||
93 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | ||
94 | } | 106 | } |
95 | 107 | ||
96 | public void Close() { } | 108 | public void Close() { } |
@@ -108,12 +120,17 @@ namespace OpenSim.Region.ClientStack.Linden | |||
108 | { | 120 | { |
109 | UUID capID = UUID.Random(); | 121 | UUID capID = UUID.Random(); |
110 | 122 | ||
111 | // m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); | ||
112 | //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); | 123 | //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); |
113 | if (m_URL == "localhost") | 124 | if (m_URL == "localhost") |
125 | { | ||
126 | m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); | ||
114 | caps.RegisterHandler("GetTexture", new GetTextureHandler("/CAPS/" + capID + "/", m_assetService)); | 127 | caps.RegisterHandler("GetTexture", new GetTextureHandler("/CAPS/" + capID + "/", m_assetService)); |
128 | } | ||
115 | else | 129 | else |
130 | { | ||
131 | m_log.InfoFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); | ||
116 | caps.RegisterHandler("GetTexture", m_URL); | 132 | caps.RegisterHandler("GetTexture", m_URL); |
133 | } | ||
117 | } | 134 | } |
118 | 135 | ||
119 | } | 136 | } |
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index a9d247a..a0009a8 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | |||
@@ -17,7 +17,7 @@ | |||
17 | <RegionModule id="PrimCountModule" type="OpenSim.Region.CoreModules.World.Land.PrimCountModule" /> | 17 | <RegionModule id="PrimCountModule" type="OpenSim.Region.CoreModules.World.Land.PrimCountModule" /> |
18 | <RegionModule id="ExportSerialisationModule" type="OpenSim.Region.CoreModules.World.Serialiser.SerialiserModule" /> | 18 | <RegionModule id="ExportSerialisationModule" type="OpenSim.Region.CoreModules.World.Serialiser.SerialiserModule" /> |
19 | <RegionModule id="ArchiverModule" type="OpenSim.Region.CoreModules.World.Archiver.ArchiverModule" /> | 19 | <RegionModule id="ArchiverModule" type="OpenSim.Region.CoreModules.World.Archiver.ArchiverModule" /> |
20 | <RegionModule id="CapabilitiesModule" type="OpenSim.Region.CoreModules.Agent.Capabilities.CapabilitiesModule" /> | 20 | <RegionModule id="CapabilitiesModule" type="OpenSim.Region.CoreModules.Framework.CapabilitiesModule" /> |
21 | <RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" /> | 21 | <RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" /> |
22 | <RegionModule id="WorldMapModule" type="OpenSim.Region.CoreModules.World.WorldMap.WorldMapModule" /> | 22 | <RegionModule id="WorldMapModule" type="OpenSim.Region.CoreModules.World.WorldMap.WorldMapModule" /> |
23 | <RegionModule id="Warp3DImageModule" type="OpenSim.Region.CoreModules.World.Warp3DMap.Warp3DImageModule" /> | 23 | <RegionModule id="Warp3DImageModule" type="OpenSim.Region.CoreModules.World.Warp3DMap.Warp3DImageModule" /> |