diff options
author | Charles Krinke | 2008-05-17 15:47:08 +0000 |
---|---|---|
committer | Charles Krinke | 2008-05-17 15:47:08 +0000 |
commit | f6a4f8844f01fb756bbc26d65c252fc07ab8c2bf (patch) | |
tree | da27e199a03ec4afd829a3ab9b06deab47cd02a3 /OpenSim/Region/DataSnapshot/DataRequestHandler.cs | |
parent | while this doesn't fix the initial no pants issue in grid (which still baffle... (diff) | |
download | opensim-SC_OLD-f6a4f8844f01fb756bbc26d65c252fc07ab8c2bf.zip opensim-SC_OLD-f6a4f8844f01fb756bbc26d65c252fc07ab8c2bf.tar.gz opensim-SC_OLD-f6a4f8844f01fb756bbc26d65c252fc07ab8c2bf.tar.bz2 opensim-SC_OLD-f6a4f8844f01fb756bbc26d65c252fc07ab8c2bf.tar.xz |
Thank you very much KMeisthax for DataSnapshot 1.1
to enhance search capability on OpenSim sims using
external search engines such as Metaversink.com and
others.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/DataSnapshot/DataRequestHandler.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs index e08934b..abf2c1a 100644 --- a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs +++ b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs | |||
@@ -26,11 +26,16 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | ||
29 | using System.Collections; | 30 | using System.Collections; |
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Xml; | 32 | using System.Xml; |
32 | using log4net; | 33 | using log4net; |
33 | using OpenSim.Region.Environment.Scenes; | 34 | using OpenSim.Region.Environment.Scenes; |
35 | using OpenSim.Framework.Communications.Capabilities; | ||
36 | using Caps = OpenSim.Framework.Communications.Capabilities.Caps; | ||
37 | using libsecondlife; | ||
38 | using OpenSim.Framework.Servers; | ||
34 | 39 | ||
35 | namespace OpenSim.Region.DataSnapshot | 40 | namespace OpenSim.Region.DataSnapshot |
36 | { | 41 | { |
@@ -40,18 +45,50 @@ namespace OpenSim.Region.DataSnapshot | |||
40 | private DataSnapshotManager m_externalData = null; | 45 | private DataSnapshotManager m_externalData = null; |
41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
42 | 47 | ||
48 | private readonly string m_discoveryPath = "DS0001/"; | ||
49 | |||
43 | public DataRequestHandler(Scene scene, DataSnapshotManager externalData) | 50 | public DataRequestHandler(Scene scene, DataSnapshotManager externalData) |
44 | { | 51 | { |
45 | m_scene = scene; | 52 | m_scene = scene; |
46 | m_externalData = externalData; | 53 | m_externalData = externalData; |
47 | 54 | ||
55 | //Register HTTP handler | ||
48 | if (m_scene.AddHTTPHandler("collector", OnGetSnapshot)) | 56 | if (m_scene.AddHTTPHandler("collector", OnGetSnapshot)) |
49 | { | 57 | { |
50 | m_log.Info("[DATASNAPSHOT]: Set up snapshot service"); | 58 | m_log.Info("[DATASNAPSHOT]: Set up snapshot service"); |
51 | } | 59 | } |
60 | |||
61 | //Register CAPS handler event | ||
62 | m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; | ||
63 | |||
52 | //harbl | 64 | //harbl |
53 | } | 65 | } |
54 | 66 | ||
67 | public void OnRegisterCaps(LLUUID agentID, Caps caps) | ||
68 | { | ||
69 | m_log.Info("[DATASNAPSHOT]: Registering service discovery capability for " + agentID); | ||
70 | string capsBase = "/CAPS/" + caps.CapsObjectPath; | ||
71 | caps.RegisterHandler("PublicSnapshotDataInfo", | ||
72 | new RestStreamHandler("POST", capsBase + m_discoveryPath, OnDiscoveryAttempt)); | ||
73 | } | ||
74 | |||
75 | public string OnDiscoveryAttempt(string request, string path, string param) | ||
76 | { | ||
77 | //Very static for now, flexible enough to add new formats | ||
78 | LLSDDiscoveryResponse llsd_response = new LLSDDiscoveryResponse(); | ||
79 | llsd_response.snapshot_resources = new LLSDArray(); | ||
80 | |||
81 | LLSDDiscoveryDataURL llsd_dataurl = new LLSDDiscoveryDataURL(); | ||
82 | llsd_dataurl.snapshot_format = "os-datasnapshot-v1"; | ||
83 | llsd_dataurl.snapshot_url = "http://" + m_externalData.m_hostname + ":" + m_externalData.m_listener_port + "/?method=collector"; | ||
84 | |||
85 | llsd_response.snapshot_resources.Array.Add(llsd_dataurl); | ||
86 | |||
87 | string response = LLSDHelpers.SerialiseLLSDReply(llsd_response); | ||
88 | |||
89 | return response; | ||
90 | } | ||
91 | |||
55 | public Hashtable OnGetSnapshot(Hashtable keysvals) | 92 | public Hashtable OnGetSnapshot(Hashtable keysvals) |
56 | { | 93 | { |
57 | m_log.Info("[DATASNAPSHOT] Received collection request"); | 94 | m_log.Info("[DATASNAPSHOT] Received collection request"); |