public override ResponseMessage Execute(RequestMessage request) { DaemonInformationResponse response = new DaemonInformationResponse(); DaemonInformationRequest req = (DaemonInformationRequest)request; if (req.GetVersion) { response.Version = ExternalStringsHack.Version; } if (req.GetSchedInfo) { response.SchedulerInformation = Scheduler.Global.GetCurrentStatus(); } if (req.GetIndexStatus) { response.IndexStatus = new ArrayList(); foreach (QueryableStatus status in QueryDriver.GetIndexInformation()) { response.IndexStatus.Add(status); } } if (req.GetIsIndexing) { response.IsIndexing = QueryDriver.IsIndexing; } return(response); }
private void OnStartDaemon() { notification_area.Hide(); DaemonInformationRequest request = new DaemonInformationRequest(true, false, false, false); try { request.Send(); } catch (Beagle.ResponseMessageException) { // beagled is not running // Start beagled and once it is started, display the quicktips page Beagle.Search.Pages.StartDaemon.DoStartDaemon(delegate() { this.statusbar.Pop(0); this.statusbar.Push(0, Catalog.GetString("Search service started")); }); pages.CurrentPage = pages.PageNum(quicktips); return; } catch (Exception e) { Console.WriteLine("Stopping the Beagle daemon failed: {0}", e.Message); } // beagled is running NotificationMessage m = new NotificationMessage(); m.Icon = Gtk.Stock.DialogError; m.Title = Catalog.GetString("Starting service failed"); m.Message = Catalog.GetString("Service is already running!"); notification_area.Display(m); }
public static int Main(string[] args) { // Is Beagle up? DaemonInformationRequest infoReq = new DaemonInformationRequest(); try { infoReq.Send(); } catch { Console.Error.WriteLine("Error: beagled does not appear to be running"); return -1; } Bus bus = Bus.Session; ObjectPath opath = new ObjectPath("/org/freedesktop/xesam/searcher/main"); string service = "org.freedesktop.xesam.searcher"; Searcher search = new Searcher(); bus.Register(service, opath, search); RequestNameReply nameReply = bus.RequestName(service); System.Threading.Thread t = new System.Threading.Thread(BusIterate); t.Start(); MainLoop ml = new MainLoop(); ml.Run(); return 0; }
public string NewSession() { if (beagleVersion == 0) { DaemonInformationRequest infoReq = new DaemonInformationRequest(true, false, false, false); DaemonInformationResponse infoResp = (DaemonInformationResponse)infoReq.Send(); beagleVersion = (uint)VersionStringToInt(infoResp.Version); } Session session = new Session(); session.VendorId = "Beagle"; session.VendorVersion = beagleVersion; session.VendorDisplay = "The Beagle desktop search tool"; session.VendorXesam = 90; session.VendorOntologyFields = Ontologies.GetSupportedXesamFields(); session.VendorOntologySources = Ontologies.GetSupportedXesamSources(); session.VendorOntologyContents = Ontologies.GetSupportedXesamContents(); sessions.Add(Convert.ToString(sessionCount), session); if (Debug) { Console.Error.WriteLine("NewSession() -- {0}", sessionCount); } return(Convert.ToString(sessionCount++)); }
public string[] GetState() { // FIXME: Is there any way to find out if we're doing a FULL_INDEX ? string[] ret = new string[] { null, null }; DaemonInformationRequest infoReq = new DaemonInformationRequest(false, false, true, true); DaemonInformationResponse infoResp = (DaemonInformationResponse)infoReq.Send(); if (!infoResp.IsIndexing) { ret [0] = "IDLE"; ret [1] = ""; } else { ret [0] = "UPDATE"; ret [1] = "0"; // FIXME: We were building total progress percentage as an average of all // Queryables' percentages and this does not work (the Queryables seem to not // set ProgressPercent) } if (Debug) { Console.Error.WriteLine("GetState() -- {0} - {1}", ret [0], ret [1]); } return(ret); }
public static int Main(string[] args) { // Is Beagle up? DaemonInformationRequest infoReq = new DaemonInformationRequest(); try { infoReq.Send(); } catch { Console.Error.WriteLine("Error: beagled does not appear to be running"); return(-1); } Bus bus = Bus.Session; ObjectPath opath = new ObjectPath("/org/freedesktop/xesam/searcher/main"); string service = "org.freedesktop.xesam.searcher"; Searcher search = new Searcher(); bus.Register(service, opath, search); RequestNameReply nameReply = bus.RequestName(service); System.Threading.Thread t = new System.Threading.Thread(BusIterate); t.Start(); MainLoop ml = new MainLoop(); ml.Run(); return(0); }
internal bool Refresh() { DaemonInformationRequest request = new DaemonInformationRequest(false, false, true, true); DaemonInformationResponse response; try { response = (DaemonInformationResponse)request.Send(); } catch (Beagle.ResponseMessageException) { Console.WriteLine("Could not connect to the daemon."); return(false); } if (response.IsIndexing) { note.Show(); } else { note.Hide(); } int i = 0; StringBuilder sb = new StringBuilder(); foreach (QueryableStatus status in response.IndexStatus) { if (i++ > 20) { break; } // Skip all those metadata and networking services backends if (status.ItemCount < 0) { continue; } sb.AppendFormat("<b>{0}</b>: {1}", status.Name, status.ItemCount); if (status.ProgressPercent > 0) { sb.AppendFormat(" ({0})", status.ProgressPercent); } sb.Append("\n"); } label.Markup = sb.ToString(); label.Show(); return(true); }
private static int PrintDaemonInformation(string[] args) { DaemonInformationRequest request = new DaemonInformationRequest(); DaemonInformationResponse response; bool get_version = false; bool get_sched_info = false; bool get_index_status = false; bool get_is_indexing = false; get_version = (Array.IndexOf(args, "--daemon-version") > -1); get_sched_info = (Array.IndexOf(args, "--status") > -1); get_index_status = (Array.IndexOf(args, "--index-info") > -1); get_is_indexing = (Array.IndexOf(args, "--is-indexing") > -1); if (Array.IndexOf(args, "--all-info") > -1) { get_version = get_sched_info = get_index_status = get_is_indexing = true; } try { response = (DaemonInformationResponse)request.Send(); } catch (Beagle.ResponseMessageException) { Console.WriteLine("Could not connect to the daemon."); return(1); } if (get_version) { Console.WriteLine("Daemon version: {0}", response.Version); } if (get_sched_info) { Console.Write(response.HumanReadableStatus); } if (get_index_status) { Console.WriteLine("Index information:"); Console.WriteLine(response.IndexInformation); } if (get_is_indexing) { Console.WriteLine("Daemon indexing: {0}", response.IsIndexing); } return(0); }
public string NewSession () { if (beagleVersion == 0) { DaemonInformationRequest infoReq = new DaemonInformationRequest (true, false, false, false); DaemonInformationResponse infoResp = (DaemonInformationResponse) infoReq.Send (); beagleVersion = (uint)VersionStringToInt (infoResp.Version); } Session session = new Session (); session.VendorId = "Beagle"; session.VendorVersion = beagleVersion; session.VendorDisplay = "The Beagle desktop search tool"; session.VendorXesam = 90; session.VendorOntologyFields = Ontologies.GetSupportedXesamFields (); session.VendorOntologySources = Ontologies.GetSupportedXesamSources (); session.VendorOntologyContents = Ontologies.GetSupportedXesamContents (); sessions.Add (Convert.ToString (sessionCount), session); if (Debug) Console.Error.WriteLine ("NewSession() -- {0}", sessionCount); return Convert.ToString (sessionCount++); }
public string[] GetState () { // FIXME: Is there any way to find out if we're doing a FULL_INDEX ? string[] ret = new string[] { null, null }; DaemonInformationRequest infoReq = new DaemonInformationRequest (false, false, true, true); DaemonInformationResponse infoResp = (DaemonInformationResponse) infoReq.Send (); if (!infoResp.IsIndexing) { ret [0] = "IDLE"; ret [1] = ""; } else { ret [0] = "UPDATE"; ret [1] = "0"; // FIXME: We were building total progress percentage as an average of all // Queryables' percentages and this does not work (the Queryables seem to not // set ProgressPercent) } if (Debug) Console.Error.WriteLine ("GetState() -- {0} - {1}", ret [0], ret [1]); return ret; }