aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/DataSnapshot/DataRequestHandler.cs
diff options
context:
space:
mode:
authorCharles Krinke2008-05-17 15:47:08 +0000
committerCharles Krinke2008-05-17 15:47:08 +0000
commitf6a4f8844f01fb756bbc26d65c252fc07ab8c2bf (patch)
treeda27e199a03ec4afd829a3ab9b06deab47cd02a3 /OpenSim/Region/DataSnapshot/DataRequestHandler.cs
parentwhile this doesn't fix the initial no pants issue in grid (which still baffle... (diff)
downloadopensim-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.cs37
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
29using System;
29using System.Collections; 30using System.Collections;
30using System.Reflection; 31using System.Reflection;
31using System.Xml; 32using System.Xml;
32using log4net; 33using log4net;
33using OpenSim.Region.Environment.Scenes; 34using OpenSim.Region.Environment.Scenes;
35using OpenSim.Framework.Communications.Capabilities;
36using Caps = OpenSim.Framework.Communications.Capabilities.Caps;
37using libsecondlife;
38using OpenSim.Framework.Servers;
34 39
35namespace OpenSim.Region.DataSnapshot 40namespace 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");