r2691 - in trunk: BeagleClient Filters Util beagled libbeagle/beagle libbeagle/examples wrappers/python



Author: dbera
Date: 2006-07-16 01:49:07 +0000 (Sun, 16 Jul 2006)
New Revision: 2691

Added:
   trunk/libbeagle/beagle/beagle-queryable-status.c
   trunk/libbeagle/beagle/beagle-queryable-status.h
   trunk/libbeagle/beagle/beagle-scheduler-information.c
   trunk/libbeagle/beagle/beagle-scheduler-information.h
   trunk/libbeagle/examples/beagle-info.c
   trunk/wrappers/python/beagleinfo.py
Modified:
   trunk/BeagleClient/QueryableStatus.cs
   trunk/BeagleClient/RemoteControl.cs
   trunk/Filters/FilterJpeg.cs
   trunk/Util/Scheduler.cs
   trunk/beagled/FileAttributesStore.cs
   trunk/beagled/QueryDriver.cs
   trunk/beagled/RemoteControlExecutors.cs
   trunk/libbeagle/beagle/Makefile.am
   trunk/libbeagle/beagle/beagle-daemon-information-request.c
   trunk/libbeagle/beagle/beagle-daemon-information-request.h
   trunk/libbeagle/beagle/beagle-daemon-information-response.c
   trunk/libbeagle/beagle/beagle-daemon-information-response.h
   trunk/libbeagle/beagle/beagle-indexable.c
   trunk/libbeagle/beagle/beagle-private.h
   trunk/libbeagle/beagle/beagle.h
   trunk/libbeagle/examples/Makefile.am
   trunk/wrappers/python/beagle.defs
   trunk/wrappers/python/beagle.override
Log:
Add methods and messages to retrieve specific information from beagle-info. Clients can now ask for only is_indexing or tasks and gets the value in a structured form. These can be be used in GUI for notifications and displaying status.
Changed C and Python API to add these. Added C and Pythin examples.
Added camera-model as a searchable property in jpeg files.
Added the check back in AttributeStore, its actually helpful since dropping an attribute which isnt present can be costly.



Modified: trunk/BeagleClient/QueryableStatus.cs
===================================================================
--- trunk/BeagleClient/QueryableStatus.cs	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/BeagleClient/QueryableStatus.cs	2006-07-16 01:49:07 UTC (rev 2691)
@@ -25,6 +25,7 @@
 //
 
 using System;
+using System.Xml.Serialization;
 
 namespace Beagle {
 
@@ -44,29 +45,34 @@
 		private int progress_percent = -1;
 		private bool is_indexing = false;
 
+		[XmlAttribute]
 		public string Name {
 			get { return this.name; }
 			set { this.name = value; }
 		}
 
+		[XmlAttribute]
 		public int ItemCount {
 			get { return this.item_count; }
 			set { this.item_count = value; }
 		}
 
+		[XmlAttribute]
 		public QueryableState State {
 			get { return this.state; }
 			set { this.state = value; }
 		}
 
+		[XmlAttribute]
 		public int ProgressPercent {
 			get { return this.progress_percent; }
 			set { this.progress_percent = value; }
 		}
 
+		[XmlAttribute]
 		public bool IsIndexing {
 			get { return this.is_indexing; }
 			set { this.is_indexing = value; }
 		}
 	}
-}
\ No newline at end of file
+}

Modified: trunk/BeagleClient/RemoteControl.cs
===================================================================
--- trunk/BeagleClient/RemoteControl.cs	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/BeagleClient/RemoteControl.cs	2006-07-16 01:49:07 UTC (rev 2691)
@@ -24,11 +24,36 @@
 // DEALINGS IN THE SOFTWARE.
 //
 
+using System.Collections;
+using System.Text;
+using System.Xml;
+using System.Xml.Serialization;
+
+using Beagle.Util;
+
 namespace Beagle {
 
+	public class DaemonInformationRequest : RequestMessage {
+		/* User can request one or more of the four information. */
+		public bool GetVersion, GetSchedInfo, GetIndexStatus, GetIsIndexing;
+
+		// For backward compatibility
+		public DaemonInformationRequest () : this (true, false, true, false) { }
+
+		public DaemonInformationRequest (
+			bool get_version,
+			bool get_scheduler_info,
+			bool get_index_status,
+			bool get_is_indexing)
+		{
+			this.GetVersion = get_version;
+			this.GetSchedInfo = get_scheduler_info;
+			this.GetIndexStatus = get_index_status;
+			this.GetIsIndexing = get_is_indexing;
+		}
+	}
+
 	// These requests have no interesting client-side state
-	public class DaemonInformationRequest : RequestMessage { }
-
 	public class ShutdownRequest : RequestMessage { }
 
 	public class ReloadConfigRequest : RequestMessage { }
@@ -36,9 +61,48 @@
 	public class OptimizeIndexesRequest : RequestMessage { }
 
 	public class DaemonInformationResponse : ResponseMessage {
-		public string Version;
-		public string HumanReadableStatus;
-		public string IndexInformation;
-		public bool IsIndexing;
+		public string Version = null;
+
+		public SchedulerInformation SchedulerInformation = null;
+
+		[XmlArray]
+		[XmlArrayItem (ElementName = "QueryableStatus", Type = typeof (QueryableStatus))]
+		public ArrayList IndexStatus = null;
+
+		public bool IsIndexing = false;
+
+		// Methods and properties for backward compatibility and general utility
+		// The names of the properties dont match the corresponding method names,
+		// this is to not break clients out there.
+
+		[XmlIgnore]
+		public string HumanReadableStatus {
+			get {
+				if (SchedulerInformation == null)
+					return null;
+
+				return SchedulerInformation.ToHumanReadableString ();
+			}
+		}
+		
+		[XmlIgnore]
+		public string IndexInformation {
+			get {
+				if (IndexStatus == null)
+					return null;
+
+				StringBuilder builder = new StringBuilder ('\n');
+
+				foreach (QueryableStatus status in IndexStatus) {
+					builder.Append ("Name: ").Append (status.Name).Append ('\n');
+					builder.Append ("Count: ").Append (status.ItemCount).Append ('\n');
+					builder.Append ("Indexing: ").Append (status.IsIndexing).Append ('\n');
+					builder.Append ('\n');
+				}
+
+				return builder.ToString ();
+			}
+		}
+
 	}
 }

Modified: trunk/Filters/FilterJpeg.cs
===================================================================
--- trunk/Filters/FilterJpeg.cs	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/Filters/FilterJpeg.cs	2006-07-16 01:49:07 UTC (rev 2691)
@@ -35,6 +35,7 @@
 
 namespace Beagle.Filters {
 	
+	[PropertyKeywordMapping (Keyword="imagemodel",     PropertyName="exif:Model",    IsKeyword=true)]
 	public class FilterJpeg : FilterImage {
 
 		public FilterJpeg () : base ()

Modified: trunk/Util/Scheduler.cs
===================================================================
--- trunk/Util/Scheduler.cs	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/Util/Scheduler.cs	2006-07-16 01:49:07 UTC (rev 2691)
@@ -28,6 +28,8 @@
 using System.Collections;
 using System.Text;
 using System.Threading;
+using System.Xml;
+using System.Xml.Serialization;
 
 namespace Beagle.Util {
 
@@ -1010,10 +1012,12 @@
 		
 		//////////////////////////////////////////////////////////////////////////////
 
-		public string GetHumanReadableStatus ()
+		private static StringBuilder cached_sb = new StringBuilder ();
+		
+		public SchedulerInformation GetCurrentStatus ()
 		{
-			StringBuilder sb = new StringBuilder ();
-
+		    SchedulerInformation current_status = new SchedulerInformation ();
+			
 			lock (big_lock) {
 				
 				ArrayList blocked_tasks = new ArrayList ();
@@ -1039,43 +1043,89 @@
 				pending_tasks.Sort ();
 				pending_tasks.Reverse ();
 
-				sb.Append ("Scheduler:\n");
-				sb.Append ("Count: ").Append (total_executed_task_count);
-				sb.Append ('\n');
+				foreach (Task task in pending_tasks) {
+					cached_sb.Length = 0;
+					task.AppendToStringBuilder (cached_sb);
+					current_status.PendingTasks.Add (cached_sb.ToString ());
+				}
 
-				if (status_str != null)
-					sb.Append ("Status: ").Append (status_str).Append ('\n');
+				foreach (Task task in future_tasks) {
+					cached_sb.Length = 0;
+					task.AppendToStringBuilder (cached_sb);
+					current_status.FutureTasks.Add (cached_sb.ToString ());
+				}
 
-				int pos = 1;
-				sb.Append ("\nPending Tasks:\n");
-				foreach (Task task in pending_tasks) {
-					sb.Append (pos).Append (' ');
-					task.AppendToStringBuilder (sb);
-					sb.Append ('\n');
-					++pos;
+				foreach (Task task in blocked_tasks) {
+					cached_sb.Length = 0;
+					task.AppendToStringBuilder (cached_sb);
+					current_status.BlockedTasks.Add (cached_sb.ToString ());
 				}
-				if (pos == 1)
-					sb.Append ("Scheduler queue is empty.\n");
 
+				current_status.TotalTaskCount = total_executed_task_count;
+				current_status.StatusString = status_str;
 
-				if (future_tasks.Count > 0) {
-					sb.Append ("\nFuture Tasks:\n");
-					foreach (Task task in future_tasks) {
-						task.AppendToStringBuilder (sb);
-						sb.Append ('\n');
-					}
+			}
+
+			return current_status;
+		}
+
+	}
+
+	public class SchedulerInformation {
+		[XmlAttribute]
+		public int TotalTaskCount = -1;
+
+		[XmlAttribute]
+		public string StatusString;
+
+		[XmlArray]
+		[XmlArrayItem (ElementName="PendingTask", Type=typeof (string))]
+		public ArrayList PendingTasks = new ArrayList ();
+
+		[XmlArray]
+		[XmlArrayItem (ElementName="FutureTask", Type=typeof (string))]
+		public ArrayList FutureTasks = new ArrayList ();
+
+		[XmlArray]
+		[XmlArrayItem (ElementName="BlockedTask", Type=typeof (string))]
+		public ArrayList BlockedTasks = new ArrayList ();
+
+		private static StringBuilder sb = new StringBuilder ();
+
+		public string ToHumanReadableString ()
+		{
+			sb.Length = 0;
+
+			sb.Append ("Scheduler:\n");
+			sb.Append ("Count: ").Append (TotalTaskCount);
+			sb.Append ('\n');
+
+			if (StatusString != null)
+				sb.Append ("Status: ").Append (StatusString).Append ('\n');
+
+			int pos = 1;
+			sb.Append ("\nPending Tasks:\n");
+			if (PendingTasks != null && PendingTasks.Count > 0) {
+				foreach (string task in PendingTasks) {
+					sb.Append (pos).Append (' ').Append (task).Append ('\n');
+					++pos;
 				}
+			} else
+				sb.Append ("Scheduler queue is empty.\n");
 
-				if (blocked_tasks.Count > 0) {
-					sb.Append ("\nBlocked Tasks:\n");
-					foreach (Task task in blocked_tasks) {
-						task.AppendToStringBuilder (sb);
-						sb.Append ('\n');
-					}
-				}
+
+			if (FutureTasks != null && FutureTasks.Count > 0) {
+				sb.Append ("\nFuture Tasks:\n");
+				foreach (string task in FutureTasks)
+					sb.Append (task).Append ('\n');
 			}
 
-			sb.Append ('\n');
+			if (BlockedTasks != null && BlockedTasks.Count > 0) {
+				sb.Append ("\nBlocked Tasks:\n");
+				foreach (string task in BlockedTasks)
+					sb.Append (task).Append ('\n');
+			}
+
 			return sb.ToString ();
 		}
 	}

Modified: trunk/beagled/FileAttributesStore.cs
===================================================================
--- trunk/beagled/FileAttributesStore.cs	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/beagled/FileAttributesStore.cs	2006-07-16 01:49:07 UTC (rev 2691)
@@ -56,12 +56,15 @@
 				// the attributes, clobber the old attributes and the old unique Guid.
 				if (attr == null
 				    || (unique_id != Guid.Empty && unique_id != attr.UniqueId)) {
+					// First drop the old attribute, if there is one.
+					if (attr != null)
+						ifas.Drop (path);
+
+					// Now create the new attribute
 					attr = new FileAttributes ();
 					attr.UniqueId = unique_id;
 					attr.Path = path;
 					
-					// First drop the old attribute, if there is one.
-					ifas.Drop (path);
 					// Now add the new attribute
 					ifas.Write (attr);
 					created = true;

Modified: trunk/beagled/QueryDriver.cs
===================================================================
--- trunk/beagled/QueryDriver.cs	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/beagled/QueryDriver.cs	2006-07-16 01:49:07 UTC (rev 2691)
@@ -613,20 +613,10 @@
 
 		////////////////////////////////////////////////////////
 
-		static public string GetIndexInformation ()
+		static public IEnumerable GetIndexInformation ()
 		{
-			StringBuilder builder = new StringBuilder ('\n');
-
-			foreach (Queryable q in queryables) {
-				QueryableStatus status = q.GetQueryableStatus ();
-
-				builder.Append ("Name: ").Append (status.Name).Append ('\n');
-				builder.Append ("Count: ").Append (status.ItemCount).Append ('\n');
-				builder.Append ("Indexing: ").Append (status.IsIndexing).Append ('\n');
-				builder.Append ('\n');
-			}
-
-			return builder.ToString ();
+			foreach (Queryable q in queryables)
+				yield return q.GetQueryableStatus ();
 		}
 
 		////////////////////////////////////////////////////////

Modified: trunk/beagled/RemoteControlExecutors.cs
===================================================================
--- trunk/beagled/RemoteControlExecutors.cs	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/beagled/RemoteControlExecutors.cs	2006-07-16 01:49:07 UTC (rev 2691)
@@ -36,14 +36,26 @@
 	[RequestMessage (typeof (DaemonInformationRequest))]
 	public class DaemonInformationExecutor : RequestMessageExecutor {
 
-		public override ResponseMessage Execute (RequestMessage req)
+		public override ResponseMessage Execute (RequestMessage request)
 		{
 			DaemonInformationResponse response = new DaemonInformationResponse ();
-			response.Version = ExternalStringsHack.Version;
-			response.HumanReadableStatus = Scheduler.Global.GetHumanReadableStatus ();
-			response.IndexInformation = QueryDriver.GetIndexInformation ();
-			response.IsIndexing = QueryDriver.IsIndexing;
+			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;
 		}
 	}

Modified: trunk/libbeagle/beagle/Makefile.am
===================================================================
--- trunk/libbeagle/beagle/Makefile.am	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/libbeagle/beagle/Makefile.am	2006-07-16 01:49:07 UTC (rev 2691)
@@ -34,6 +34,8 @@
 	beagle-query-part-or.c			\
 	beagle-query-part-property.c		\
 	beagle-query-part-text.c		\
+	beagle-queryable-status.c		\
+	beagle-scheduler-information.c		\
 	beagle-request.c			\
 	beagle-response.c			\
 	beagle-search-term-response.c		\
@@ -72,6 +74,8 @@
 	beagle-query-part-or.h			\
 	beagle-query-part-property.h		\
 	beagle-query-part-text.h		\
+	beagle-queryable-status.h		\
+	beagle-scheduler-information.h		\
 	beagle-request.h			\
 	beagle-response.h			\
 	beagle-search-term-response.h		\

Modified: trunk/libbeagle/beagle/beagle-daemon-information-request.c
===================================================================
--- trunk/libbeagle/beagle/beagle-daemon-information-request.c	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/libbeagle/beagle/beagle-daemon-information-request.c	2006-07-16 01:49:07 UTC (rev 2691)
@@ -35,7 +35,10 @@
 #include "beagle-daemon-information-response.h"
 
 typedef struct {
-	gint foo;
+	gboolean get_version : 1;
+	gboolean get_sched_info : 1;
+	gboolean get_index_status : 1;
+	gboolean get_is_indexing : 1;
 } BeagleDaemonInformationRequestPrivate;
 
 #define BEAGLE_DAEMON_INFORMATION_REQUEST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BEAGLE_TYPE_DAEMON_INFORMATION_REQUEST, BeagleDaemonInformationRequestPrivate))
@@ -45,10 +48,32 @@
 static GString *
 beagle_daemon_information_request_to_xml (BeagleRequest *request, GError **err)
 {
+	BeagleDaemonInformationRequestPrivate *priv = BEAGLE_DAEMON_INFORMATION_REQUEST_GET_PRIVATE (request);
 	GString *data = g_string_new (NULL);
 
 	_beagle_request_append_standard_header (data, 
 						"DaemonInformationRequest");
+
+	if (priv->get_version)
+		g_string_append (data, "<GetVersion>true</GetVersion>");
+	else
+		g_string_append (data, "<GetVersion>false</GetVersion>");
+
+	if (priv->get_sched_info)
+		g_string_append (data, "<GetSchedInfo>true</GetSchedInfo>");
+	else
+		g_string_append (data, "<GetSchedInfo>false</GetSchedInfo>");
+
+	if (priv->get_index_status)
+		g_string_append (data, "<GetIndexStatus>true</GetIndexStatus>");
+	else
+		g_string_append (data, "<GetIndexStatus>false</GetIndexStatus>");
+
+	if (priv->get_is_indexing)
+		g_string_append (data, "<GetIsIndexing>true</GetIsIndexing>");
+	else
+		g_string_append (data, "<GetIsIndexing>false</GetIsIndexing>");
+
 	_beagle_request_append_standard_footer (data);
 
 	return data;
@@ -88,17 +113,41 @@
 {
 }
 
-/**
+/*
  * beagle_daemon_information_request_new:
  *
- * Creates a new #BeagleDaemonInformationRequest.
+ * Creates a new #BeagleDaemonInformationRequest requesting all fields.
  *
  * Return value: a newly created #BeagleDaemonInformationRequest.
  **/
 BeagleDaemonInformationRequest *
 beagle_daemon_information_request_new (void)
 {
+	return beagle_daemon_information_request_new_specific (TRUE, TRUE, TRUE, TRUE);
+}
+
+/*
+ * beagle_daemon_information_request_new_specific:
+ *
+ * Creates a new #BeagleDaemonInformationRequest allowing retrieval of specific fields.
+ *
+ * Return value: a newly created #BeagleDaemonInformationRequest.
+ **/
+BeagleDaemonInformationRequest *
+beagle_daemon_information_request_new_specific (gboolean get_version,
+						gboolean get_sched_info,
+						gboolean get_index_status,
+						gboolean get_is_indexing)
+{
 	BeagleDaemonInformationRequest *daemon_information_request = g_object_new (BEAGLE_TYPE_DAEMON_INFORMATION_REQUEST, 0);
 
+	BeagleDaemonInformationRequestPrivate *priv
+		= BEAGLE_DAEMON_INFORMATION_REQUEST_GET_PRIVATE (daemon_information_request);
+
+	priv->get_version = get_version;
+	priv->get_sched_info = get_sched_info;
+	priv->get_index_status = get_index_status;
+	priv->get_is_indexing = get_is_indexing;
+
 	return daemon_information_request;
 }

Modified: trunk/libbeagle/beagle/beagle-daemon-information-request.h
===================================================================
--- trunk/libbeagle/beagle/beagle-daemon-information-request.h	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/libbeagle/beagle/beagle-daemon-information-request.h	2006-07-16 01:49:07 UTC (rev 2691)
@@ -51,7 +51,11 @@
 };
 
 GType        beagle_daemon_information_request_get_type     (void);
-BeagleDaemonInformationRequest *beagle_daemon_information_request_new          (void);
+BeagleDaemonInformationRequest *beagle_daemon_information_request_new		(void);
+BeagleDaemonInformationRequest *beagle_daemon_information_request_new_specific	(gboolean get_version,
+										 gboolean get_sched_info,
+										 gboolean get_index_status,
+										 gboolean get_is_indexing);
 
 #endif /* __BEAGLE_DAEMON_INFORMATION_REQUEST_H */
 

Modified: trunk/libbeagle/beagle/beagle-daemon-information-response.c
===================================================================
--- trunk/libbeagle/beagle/beagle-daemon-information-response.c	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/libbeagle/beagle/beagle-daemon-information-response.c	2006-07-16 01:49:07 UTC (rev 2691)
@@ -30,14 +30,16 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 
+#include "beagle-scheduler-information.h"
+#include "beagle-queryable-status.h"
 #include "beagle-daemon-information-response.h"
 #include "beagle-private.h"
 
 typedef struct {
-	char *version;
-	char *index_information;
-	char *status;
-	gboolean is_indexing;
+	char *version;					/* Version. */
+	gboolean is_indexing;				/* Currently indexing ? */
+	BeagleSchedulerInformation *scheduler_information;	/* Current task information. */
+	GSList *index_status;				/* List of BeagleQueryableStatus. */
 } BeagleDaemonInformationResponsePrivate;
 
 #define BEAGLE_DAEMON_INFORMATION_RESPONSE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BEAGLE_TYPE_DAEMON_INFORMATION_RESPONSE, BeagleDaemonInformationResponsePrivate))
@@ -52,14 +54,19 @@
 	BeagleDaemonInformationResponsePrivate *priv = BEAGLE_DAEMON_INFORMATION_RESPONSE_GET_PRIVATE (obj);
 
 	g_free (priv->version);
-	g_free (priv->index_information);
-	g_free (priv->status);
 
+	if (priv->scheduler_information)
+		beagle_scheduler_information_unref (priv->scheduler_information);
+
+	if (priv->index_status) {
+		g_slist_foreach (priv->index_status, (GFunc) beagle_queryable_status_unref, NULL);
+		g_slist_free (priv->index_status);
+	}
+
 	if (G_OBJECT_CLASS (parent_class)->finalize)
 		G_OBJECT_CLASS (parent_class)->finalize (obj);
 }
 
-
 static void
 end_version (BeagleParserContext *ctx)
 {
@@ -69,45 +76,171 @@
 	priv->version = _beagle_parser_context_get_text_buffer (ctx);
 }
 
+static void
+end_is_indexing (BeagleParserContext *ctx)
+{
+	BeagleDaemonInformationResponse *response = BEAGLE_DAEMON_INFORMATION_RESPONSE (_beagle_parser_context_get_response (ctx));
+	BeagleDaemonInformationResponsePrivate *priv = BEAGLE_DAEMON_INFORMATION_RESPONSE_GET_PRIVATE (response);
+	char *buf;
+	
+	buf = _beagle_parser_context_get_text_buffer (ctx);
 
+	priv->is_indexing = (strcmp (buf, "true") == 0);
+
+	g_free (buf);
+}
+
 static void
-end_human_readable_status (BeagleParserContext *ctx)
+start_scheduler_information (BeagleParserContext *ctx, const char **attrs)
 {
 	BeagleDaemonInformationResponse *response = BEAGLE_DAEMON_INFORMATION_RESPONSE (_beagle_parser_context_get_response (ctx));
 	BeagleDaemonInformationResponsePrivate *priv = BEAGLE_DAEMON_INFORMATION_RESPONSE_GET_PRIVATE (response);
+	int i;
+	BeagleSchedulerInformation *scheduler_information;
+
+	scheduler_information = _beagle_scheduler_information_new ();
+
+	for (i = 0; attrs[i] != NULL; i += 2) {
+		if (strcmp (attrs[i], "TotalTaskCount") == 0)
+			scheduler_information->total_task_count = (int) g_ascii_strtod (attrs[i + 1], NULL);
+		else if (strcmp (attrs[i], "StatusString") == 0)
+			scheduler_information->status_string = g_strdup (attrs[i + 1]);
+		else
+			g_warning ("unknown attribute \"%s\" with value \"%s\"", attrs[i], attrs[i + 1]);
+	}
+
+	priv->scheduler_information = scheduler_information;
+}
+
+static void
+end_scheduler_information (BeagleParserContext *ctx)
+{
+	BeagleDaemonInformationResponse *response = BEAGLE_DAEMON_INFORMATION_RESPONSE (_beagle_parser_context_get_response (ctx));
+	BeagleDaemonInformationResponsePrivate *priv = BEAGLE_DAEMON_INFORMATION_RESPONSE_GET_PRIVATE (response);
+}
+
+static void
+end_pending_task (BeagleParserContext *ctx)
+{
+	BeagleDaemonInformationResponse *response = BEAGLE_DAEMON_INFORMATION_RESPONSE (_beagle_parser_context_get_response (ctx));
+	BeagleDaemonInformationResponsePrivate *priv = BEAGLE_DAEMON_INFORMATION_RESPONSE_GET_PRIVATE (response);
+	char *buf;
 	
-	priv->status = _beagle_parser_context_get_text_buffer (ctx);
+	buf = _beagle_parser_context_get_text_buffer (ctx);
+
+	priv->scheduler_information->pending_task = g_slist_prepend (priv->scheduler_information->pending_task, buf);
 }
 
+static void
+end_pending_tasks (BeagleParserContext *ctx)
+{
+	BeagleDaemonInformationResponse *response = BEAGLE_DAEMON_INFORMATION_RESPONSE (_beagle_parser_context_get_response (ctx));
+	BeagleDaemonInformationResponsePrivate *priv = BEAGLE_DAEMON_INFORMATION_RESPONSE_GET_PRIVATE (response);
+	
+	// Fix the order of tasks
+	priv->scheduler_information->pending_task = g_slist_reverse (priv->scheduler_information->pending_task);
+}
 
 static void
-end_index_information (BeagleParserContext *ctx)
+end_future_task (BeagleParserContext *ctx)
 {
 	BeagleDaemonInformationResponse *response = BEAGLE_DAEMON_INFORMATION_RESPONSE (_beagle_parser_context_get_response (ctx));
 	BeagleDaemonInformationResponsePrivate *priv = BEAGLE_DAEMON_INFORMATION_RESPONSE_GET_PRIVATE (response);
+	char *buf;
 	
-	priv->index_information = _beagle_parser_context_get_text_buffer (ctx);
+	buf = _beagle_parser_context_get_text_buffer (ctx);
+
+	priv->scheduler_information->future_task = g_slist_prepend (priv->scheduler_information->future_task, buf);
 }
 
 static void
-end_is_indexing (BeagleParserContext *ctx)
+end_future_tasks (BeagleParserContext *ctx)
 {
 	BeagleDaemonInformationResponse *response = BEAGLE_DAEMON_INFORMATION_RESPONSE (_beagle_parser_context_get_response (ctx));
 	BeagleDaemonInformationResponsePrivate *priv = BEAGLE_DAEMON_INFORMATION_RESPONSE_GET_PRIVATE (response);
+	
+	// Fix the order of tasks
+	priv->scheduler_information->future_task = g_slist_reverse (priv->scheduler_information->future_task);
+}
+
+static void
+end_blocked_task (BeagleParserContext *ctx)
+{
+	BeagleDaemonInformationResponse *response = BEAGLE_DAEMON_INFORMATION_RESPONSE (_beagle_parser_context_get_response (ctx));
+	BeagleDaemonInformationResponsePrivate *priv = BEAGLE_DAEMON_INFORMATION_RESPONSE_GET_PRIVATE (response);
 	char *buf;
 	
 	buf = _beagle_parser_context_get_text_buffer (ctx);
 
-	priv->is_indexing = (strcmp (buf, "true") == 0);
+	priv->scheduler_information->blocked_task = g_slist_prepend (priv->scheduler_information->blocked_task, buf);
+}
 
-	g_free (buf);
+static void
+end_blocked_tasks (BeagleParserContext *ctx)
+{
+	BeagleDaemonInformationResponse *response = BEAGLE_DAEMON_INFORMATION_RESPONSE (_beagle_parser_context_get_response (ctx));
+	BeagleDaemonInformationResponsePrivate *priv = BEAGLE_DAEMON_INFORMATION_RESPONSE_GET_PRIVATE (response);
+	
+	// Fix the order of tasks
+	priv->scheduler_information->blocked_task = g_slist_reverse (priv->scheduler_information->blocked_task);
 }
 
+static void
+end_index_status (BeagleParserContext *ctx)
+{
+	BeagleDaemonInformationResponse *response = BEAGLE_DAEMON_INFORMATION_RESPONSE (_beagle_parser_context_get_response (ctx));
+	BeagleDaemonInformationResponsePrivate *priv = BEAGLE_DAEMON_INFORMATION_RESPONSE_GET_PRIVATE (response);
+
+	// Reverse the list to maintain the same order as returned by the daemon
+	priv->index_status = g_slist_reverse (priv->index_status);
+}
+
+static void
+start_queryable_status (BeagleParserContext *ctx, const char **attrs)
+{
+	BeagleDaemonInformationResponse *response = BEAGLE_DAEMON_INFORMATION_RESPONSE (_beagle_parser_context_get_response (ctx));
+	BeagleDaemonInformationResponsePrivate *priv = BEAGLE_DAEMON_INFORMATION_RESPONSE_GET_PRIVATE (response);
+
+	int i;
+	BeagleQueryableStatus *queryable_status = _beagle_queryable_status_new ();
+
+	for (i = 0; attrs[i] != NULL; i += 2) {	
+		if (strcmp (attrs[i], "Name") == 0)
+			queryable_status->name = g_strdup (attrs[i + 1]);
+		else if (strcmp (attrs[i], "ItemCount") == 0)
+			queryable_status->item_count = (int) g_ascii_strtod (attrs[i + 1], NULL);
+		else if (strcmp (attrs[i], "ProgressPercent") == 0)
+			queryable_status->progress_percent = (int) g_ascii_strtod (attrs[i + 1], NULL);
+		else if (strcmp (attrs[i], "IsIndexing") == 0)
+			queryable_status->is_indexing = strcmp (attrs[i + 1], "true") == 0;
+		else if (strcmp (attrs[i], "State") == 0) {
+		        if (strcmp (attrs [i + 1], "NotApplicable") == 0)
+			        queryable_status->state = BEAGLE_QUERYABLE_STATE_NA;
+		        else if (strcmp (attrs [i + 1], "Idle") == 0)
+			        queryable_status->state = BEAGLE_QUERYABLE_STATE_IDLE;
+			else if (strcmp (attrs [i + 1], "Crawling") == 0)
+			        queryable_status->state = BEAGLE_QUERYABLE_STATE_CRAWLING;
+			else if (strcmp (attrs [i + 1], "Indexing") == 0)
+			        queryable_status->state = BEAGLE_QUERYABLE_STATE_INDEXING;
+			else if (strcmp (attrs [i + 1], "Flushing") == 0)
+			        queryable_status->state = BEAGLE_QUERYABLE_STATE_FLUSHING;
+		} else
+			g_warning ("could not handle %s", attrs[i]);
+	}
+
+	priv->index_status = g_slist_prepend (priv->index_status, queryable_status);
+}
+
 enum {
 	PARSER_STATE_DAEMON_INFORMATION_VERSION,
-	PARSER_STATE_DAEMON_INFORMATION_HUMAN_READABLE_STATUS,
-	PARSER_STATE_DAEMON_INFORMATION_INDEX_INFORMATION,
 	PARSER_STATE_DAEMON_INFORMATION_IS_INDEXING,
+	PARSER_STATE_DAEMON_INFORMATION_SCHEDULER_INFORMATION,
+	PARSER_STATE_DAEMON_INFORMATION_SCHEDULER_INFORMATION_PENDING_TASKS,
+	PARSER_STATE_DAEMON_INFORMATION_SCHEDULER_INFORMATION_FUTURE_TASKS,
+	PARSER_STATE_DAEMON_INFORMATION_SCHEDULER_INFORMATION_BLOCKED_TASKS,
+	PARSER_STATE_DAEMON_INFORMATION_SCHEDULER_INFORMATION_TASK,
+	PARSER_STATE_DAEMON_INFORMATION_INDEX_STATUS,
+	PARSER_STATE_DAEMON_INFORMATION_QUERYABLE_STATUS,
 };
 
 static BeagleParserHandler parser_handlers[] = {
@@ -117,24 +250,65 @@
 	  NULL,
 	  end_version },
 
-	{ "HumanReadableStatus",
+	{ "IsIndexing",
 	  -1,
-	  PARSER_STATE_DAEMON_INFORMATION_HUMAN_READABLE_STATUS,
+	  PARSER_STATE_DAEMON_INFORMATION_IS_INDEXING,
 	  NULL,
-	  end_human_readable_status },
+	  end_is_indexing },
+
+	{ "SchedulerInformation",
+	  -1,
+	  PARSER_STATE_DAEMON_INFORMATION_SCHEDULER_INFORMATION,
+	  start_scheduler_information,
+	  NULL},
 	
-	{ "IndexInformation",
-	  -1,
-	  PARSER_STATE_DAEMON_INFORMATION_INDEX_INFORMATION,
+	{ "PendingTasks",
+	  PARSER_STATE_DAEMON_INFORMATION_SCHEDULER_INFORMATION,
+	  PARSER_STATE_DAEMON_INFORMATION_SCHEDULER_INFORMATION_PENDING_TASKS,
 	  NULL,
-	  end_index_information },
-
-	{ "IsIndexing",
+	  end_pending_tasks },
+	
+	{ "PendingTask",
+	  PARSER_STATE_DAEMON_INFORMATION_SCHEDULER_INFORMATION_PENDING_TASKS,
+	  PARSER_STATE_DAEMON_INFORMATION_SCHEDULER_INFORMATION_TASK,
+	  NULL,
+	  end_pending_task },
+	
+	{ "FutureTasks",
+	  PARSER_STATE_DAEMON_INFORMATION_SCHEDULER_INFORMATION,
+	  PARSER_STATE_DAEMON_INFORMATION_SCHEDULER_INFORMATION_FUTURE_TASKS,
+	  NULL,
+	  end_future_tasks },
+	
+	{ "FutureTask",
+	  PARSER_STATE_DAEMON_INFORMATION_SCHEDULER_INFORMATION_FUTURE_TASKS,
+	  PARSER_STATE_DAEMON_INFORMATION_SCHEDULER_INFORMATION_TASK,
+	  NULL,
+	  end_future_task },
+	
+	{ "BlockedTasks",
+	  PARSER_STATE_DAEMON_INFORMATION_SCHEDULER_INFORMATION,
+	  PARSER_STATE_DAEMON_INFORMATION_SCHEDULER_INFORMATION_BLOCKED_TASKS,
+	  NULL,
+	  end_blocked_tasks },
+	
+	{ "BlockedTask",
+	  PARSER_STATE_DAEMON_INFORMATION_SCHEDULER_INFORMATION_BLOCKED_TASKS,
+	  PARSER_STATE_DAEMON_INFORMATION_SCHEDULER_INFORMATION_TASK,
+	  NULL,
+	  end_blocked_task },
+	
+	{ "IndexStatus",
 	  -1,
-	  PARSER_STATE_DAEMON_INFORMATION_IS_INDEXING,
+	  PARSER_STATE_DAEMON_INFORMATION_INDEX_STATUS,
 	  NULL,
-	  end_is_indexing },
+	  end_index_status },
 
+	{ "QueryableStatus",
+	  PARSER_STATE_DAEMON_INFORMATION_INDEX_STATUS,
+	  PARSER_STATE_DAEMON_INFORMATION_QUERYABLE_STATUS,
+	  start_queryable_status,
+	  NULL },
 	{ 0 }
 };
 
@@ -155,8 +329,14 @@
 }
 
 static void
-beagle_daemon_information_response_init (BeagleDaemonInformationResponse *info)
+beagle_daemon_information_response_init (BeagleDaemonInformationResponse *response)
 {
+	BeagleDaemonInformationResponsePrivate *priv = BEAGLE_DAEMON_INFORMATION_RESPONSE_GET_PRIVATE (response);
+
+	priv->version = NULL;
+	priv->scheduler_information = NULL;
+	priv->index_status = NULL;
+	priv->is_indexing = FALSE;
 }
 
 /**
@@ -175,11 +355,33 @@
 	g_return_val_if_fail (BEAGLE_IS_DAEMON_INFORMATION_RESPONSE (response), NULL);
 
 	priv = BEAGLE_DAEMON_INFORMATION_RESPONSE_GET_PRIVATE (response);
+	g_return_val_if_fail (priv->version, NULL);
 	
 	return priv->version;
 }
 
 /**
+ * beagle_daemon_information_response_get_scheduler_information:
+ * @response: a #BeagleDaemonInformationResponse
+ *
+ * Fetches the current scheduler information from the given #BeagleDaemonInformationResponse.
+ *
+ * Return value: the current scheduler information from the #BeagleDaemonInformationResponse.
+ **/
+BeagleSchedulerInformation *
+beagle_daemon_information_response_get_scheduler_information (BeagleDaemonInformationResponse *response)
+{
+	BeagleDaemonInformationResponsePrivate *priv;
+
+	g_return_val_if_fail (BEAGLE_IS_DAEMON_INFORMATION_RESPONSE (response), NULL);
+
+	priv = BEAGLE_DAEMON_INFORMATION_RESPONSE_GET_PRIVATE (response);
+	g_return_val_if_fail (priv->scheduler_information, NULL);
+
+	return priv->scheduler_information;
+}
+
+/**
  * beagle_daemon_information_response_get_human_readable_status:
  * @response: a #BeagleDaemonInformationResponse
  *
@@ -191,32 +393,72 @@
 beagle_daemon_information_response_get_human_readable_status (BeagleDaemonInformationResponse *response)
 {
 	BeagleDaemonInformationResponsePrivate *priv;
+	BeagleSchedulerInformation *process_info;
 
 	g_return_val_if_fail (BEAGLE_IS_DAEMON_INFORMATION_RESPONSE (response), NULL);
 
 	priv = BEAGLE_DAEMON_INFORMATION_RESPONSE_GET_PRIVATE (response);
+	g_return_val_if_fail (priv->scheduler_information != NULL, NULL);
+
+	process_info = priv->scheduler_information;
 	
-	return priv->status;
+	return beagle_scheduler_information_to_human_readable_string (process_info);
 }
 
 /**
- * beagle_daemon_information_response_get_index_information:
+ * beagle_daemon_information_response_get_index_status:
  * @response: a #BeagleDaemonInformationResponse
  *
- * Fetches the index information of the given #BeagleDaemonInformationResponse.
+ * Fetches the list of #QueryableStatus from each of the currently running backends.
  *
  * Return value: the index information of the #BeagleDaemonInformationResponse.
  **/
+GSList *
+beagle_daemon_information_response_get_index_status (BeagleDaemonInformationResponse *response)
+{
+	BeagleDaemonInformationResponsePrivate *priv;
+
+	g_return_val_if_fail (BEAGLE_IS_DAEMON_INFORMATION_RESPONSE (response), NULL);
+
+	priv = BEAGLE_DAEMON_INFORMATION_RESPONSE_GET_PRIVATE (response);
+	g_return_val_if_fail (priv->index_status, NULL);
+
+	return priv->index_status;
+}
+
+/**
+ * beagle_daemon_information_response_get_index_information:
+ * @response: a #BeagleDaemonInformationResponse
+ *
+ * Fetches a human-readable string describing the index information
+ * of the given #BeagleDaemonInformationResponse.
+ *
+ * Return value: string describing the index information of the #BeagleDaemonInformationResponse.
+ **/
 G_CONST_RETURN char *
 beagle_daemon_information_response_get_index_information (BeagleDaemonInformationResponse *response)
 {
 	BeagleDaemonInformationResponsePrivate *priv;
+	BeagleQueryableStatus *status;
+	GString *tmp;
+	GSList *iter;
 
 	g_return_val_if_fail (BEAGLE_IS_DAEMON_INFORMATION_RESPONSE (response), NULL);
 
 	priv = BEAGLE_DAEMON_INFORMATION_RESPONSE_GET_PRIVATE (response);
-	
-	return priv->index_information;
+	g_return_val_if_fail (priv->index_status != NULL, NULL);
+
+	tmp = g_string_new ("\n");
+
+	for (iter = priv->index_status; iter != NULL; iter = iter->next) {
+		status = iter->data;
+		g_string_append_printf (tmp, "Name: %s\nCount: %d\nIndexing: %s\n\n",
+						status->name,
+						status->item_count,
+						(status->is_indexing ? "Yes" : "No"));
+	}
+
+	return g_string_free (tmp, FALSE);
 }
 
 /**

Modified: trunk/libbeagle/beagle/beagle-daemon-information-response.h
===================================================================
--- trunk/libbeagle/beagle/beagle-daemon-information-response.h	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/libbeagle/beagle/beagle-daemon-information-response.h	2006-07-16 01:49:07 UTC (rev 2691)
@@ -31,6 +31,7 @@
 #include <glib-object.h>
 
 #include "beagle-response.h"
+#include "beagle-scheduler-information.h"
 
 #define BEAGLE_TYPE_DAEMON_INFORMATION_RESPONSE            (beagle_daemon_information_response_get_type ())
 #define BEAGLE_DAEMON_INFORMATION_RESPONSE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), BEAGLE_TYPE_DAEMON_INFORMATION_RESPONSE, BeagleDaemonInformationResponse))
@@ -55,9 +56,16 @@
 G_CONST_RETURN char *
 beagle_daemon_information_response_get_version (BeagleDaemonInformationResponse *response);
 
+BeagleSchedulerInformation *
+beagle_daemon_information_response_get_scheduler_information (BeagleDaemonInformationResponse *response);
+
+// Kept for backward compatibility
 G_CONST_RETURN char *
 beagle_daemon_information_response_get_human_readable_status (BeagleDaemonInformationResponse *response);
 
+GSList *
+beagle_daemon_information_response_get_index_status (BeagleDaemonInformationResponse *response);
+
 G_CONST_RETURN char *
 beagle_daemon_information_response_get_index_information (BeagleDaemonInformationResponse *response);
 

Modified: trunk/libbeagle/beagle/beagle-indexable.c
===================================================================
--- trunk/libbeagle/beagle/beagle-indexable.c	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/libbeagle/beagle/beagle-indexable.c	2006-07-16 01:49:07 UTC (rev 2691)
@@ -610,7 +610,7 @@
 	case BEAGLE_INDEXABLE_TYPE_ADD:
 		tmp = "Add";
 		break;
-	    case BEAGLE_INDEXABLE_TYPE_REMOVE:
+	case BEAGLE_INDEXABLE_TYPE_REMOVE:
 		tmp = "Remove";
 		break;
 	case BEAGLE_INDEXABLE_TYPE_PROPERTY_CHANGE:
@@ -626,7 +626,7 @@
 	case BEAGLE_INDEXABLE_FILTERING_ALWAYS:
 		tmp = "Always";
 		break;
-	    case BEAGLE_INDEXABLE_FILTERING_ALREADY_FILTERED:
+	case BEAGLE_INDEXABLE_FILTERING_ALREADY_FILTERED:
 		tmp = "AlreadyFiltered";
 		break;
 	case BEAGLE_INDEXABLE_FILTERING_AUTOMATIC:

Modified: trunk/libbeagle/beagle/beagle-private.h
===================================================================
--- trunk/libbeagle/beagle/beagle-private.h	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/libbeagle/beagle/beagle-private.h	2006-07-16 01:49:07 UTC (rev 2691)
@@ -30,6 +30,8 @@
 #define __BEAGLE_PRIVATE_H
 
 #include "beagle-hit.h"
+#include "beagle-queryable-status.h"
+#include "beagle-scheduler-information.h"
 #include "beagle-parser.h"
 #include "beagle-query-part.h"
 #include "beagle-indexable.h"
@@ -63,8 +65,32 @@
 	gboolean is_stored;
 };
 
+struct _BeagleQueryableStatus {
+	int ref_count;
+
+	char *name;
+	int item_count;
+	BeagleQueryableState state;
+	int progress_percent;
+	gboolean is_indexing;
+};
+
+struct _BeagleSchedulerInformation {
+	int ref_count;
+
+	int total_task_count;
+	char *status_string;
+	GSList *pending_task; /* Of string */
+	GSList *future_task;  /* Of string */
+	GSList *blocked_task; /* Of string */
+};
+
 BeagleHit *_beagle_hit_new (void);
 
+BeagleQueryableStatus *_beagle_queryable_status_new (void);
+
+BeagleSchedulerInformation *_beagle_scheduler_information_new (void);
+
 void _beagle_hit_set_property (BeagleHit *hit, const char *name, const char *value);
 
 void _beagle_hit_list_free (GSList *list);
@@ -80,6 +106,10 @@
 
 void _beagle_hit_to_xml (BeagleHit *hit, GString *data);
 
+void _beagle_queryable_status_to_xml (BeagleQueryableStatus *status, GString *data);
+
+void _beagle_scheduler_information_to_xml (BeagleSchedulerInformation *status, GString *data);
+
 void _beagle_properties_to_xml (GSList *properties, GString *data);
 
 void _beagle_indexable_to_xml (BeagleIndexable *indexable, GString *data);

Added: trunk/libbeagle/beagle/beagle-queryable-status.c
===================================================================
--- trunk/libbeagle/beagle/beagle-queryable-status.c	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/libbeagle/beagle/beagle-queryable-status.c	2006-07-16 01:49:07 UTC (rev 2691)
@@ -0,0 +1,209 @@
+/*
+ * beagle-queryable-status.c
+ *
+ * Copyright (C) 2006 Debajyoti Bera <dbera web gmail com>
+ *
+ */
+
+/*
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "beagle-queryable-status.h"
+#include "beagle-private.h"
+
+BeagleQueryableStatus *
+_beagle_queryable_status_new (void)
+{
+	BeagleQueryableStatus *status;
+
+	status = g_new0 (BeagleQueryableStatus, 1);
+
+	status->ref_count = 1;
+
+	status->name = NULL;
+	status->item_count = -1;
+	status->state = BEAGLE_QUERYABLE_STATE_NA;
+	status->progress_percent = -1;
+	status->is_indexing = FALSE;
+
+	return status;
+}
+
+/**
+ * beagle_queryable_status_ref:
+ * @status: a #BeagleQueryableStatus
+ *
+ * Increases the reference count of the #BeagleQueryableStatus.
+ *
+ * Return value: the #BeagleQueryableStatus
+ **/
+BeagleQueryableStatus *
+beagle_queryable_status_ref (BeagleQueryableStatus *status)
+{
+	g_return_if_fail (status != NULL);
+
+	status->ref_count ++;
+
+	return status;
+}
+
+/**
+ * beagle_queryable_status_unref:
+ * @status: a #BeagleQueryableStatus
+ *
+ * Decreases the reference count of the #BeagleQueryableStatus. When the reference count drops to 0, it is freed.
+ **/
+void
+beagle_queryable_status_unref (BeagleQueryableStatus *status)
+{
+	g_return_if_fail (status != NULL);
+	g_return_if_fail (status->ref_count > 0);
+
+	status->ref_count --;
+
+	if (status->ref_count == 0) {
+		g_free (status->name);
+		g_free (status);
+	}
+}
+
+/**
+ * beagle_queryable_status_get_name:
+ * @status: a #BeagleQueryableStatus
+ *
+ * Fetches the name of the backend for the given #BeagleQueryableStatus.
+ *
+ * Return value: the name of the backend for the #BeagleQueryableStatus.
+ **/
+G_CONST_RETURN char *
+beagle_queryable_status_get_name (BeagleQueryableStatus *status)
+{
+	g_return_val_if_fail (status != NULL, NULL);
+
+	return status->name;
+}
+
+/**
+ * beagle_queryable_status_get_item_count:
+ * @status: a #BeagleQueryableStatus
+ *
+ * Fetches the number of items in the backend for the given #BeagleQueryableStatus.
+ *
+ * Return value: the number of items in the backend for the #BeagleQueryableStatus.
+ **/
+int
+beagle_queryable_status_get_item_count (BeagleQueryableStatus *status)
+{
+	g_return_val_if_fail (status != NULL, -1);
+
+	return status->item_count;
+}
+
+/**
+ * beagle_queryable_status_get_state:
+ * @status: a #BeagleQueryableStatus
+ *
+ * Fetches the state of the backend for the given #BeagleQueryableStatus.
+ *
+ * Return value: the state of the backend for the #BeagleQueryableStatus.
+ **/
+BeagleQueryableState
+beagle_queryable_status_get_state (BeagleQueryableStatus *status)
+{
+	g_return_val_if_fail (status != NULL, BEAGLE_QUERYABLE_STATE_NA);
+
+	return status->state;
+}
+
+/**
+ * beagle_queryable_status_get_progress_percent:
+ * @status: a #BeagleQueryableStatus
+ *
+ * Fetches the progress in percent of the backend for the given #BeagleQueryableStatus.
+ *
+ * Return value: the progress of the backend for the #BeagleQueryableStatus.
+ **/
+int
+beagle_queryable_status_get_progress_percent (BeagleQueryableStatus *status)
+{
+	g_return_val_if_fail (status != NULL, -1);
+
+	return status->progress_percent;
+}
+
+/**
+ * beagle_queryable_status_get_is_indexing:
+ * @status: a #BeagleQueryableStatus
+ *
+ * Fetches whether the backend for the given #BeagleQueryableStatus is currently indexing.
+ *
+ * Return value: whether the backend for the #BeagleQueryableStatus is currently indexing.
+ **/
+gboolean
+beagle_queryable_status_get_is_indexing (BeagleQueryableStatus *status)
+{
+	g_return_val_if_fail (status != NULL, FALSE);
+
+	return status->is_indexing;
+}
+
+void
+_beagle_queryable_status_to_xml (BeagleQueryableStatus *status, GString *data)
+{
+	char *tmp;
+
+	g_string_append_printf (data, "<IndexInformation");
+
+	if (status->name)
+		g_string_append_printf (data, " Name=\"%s\"", status->name);
+		
+	g_string_append_printf (data, " ItemCount=\"%d\"", status->item_count);
+
+	switch (status->state) {
+	case BEAGLE_QUERYABLE_STATE_NA:
+		tmp = "NotApplicable";
+		break;
+	case BEAGLE_QUERYABLE_STATE_IDLE:
+		tmp = "Idle";
+		break;
+	case BEAGLE_QUERYABLE_STATE_CRAWLING:
+		tmp = "Crawling";
+		break;
+	case BEAGLE_QUERYABLE_STATE_INDEXING:
+		tmp = "Indexing";
+		break;
+	case BEAGLE_QUERYABLE_STATE_FLUSHING:
+		tmp = "Flushing";
+		break;
+	default:
+		g_assert_not_reached ();
+	}
+
+	g_string_append_printf (data, " State=\"%s\"", tmp);
+
+	g_string_append_printf (data, " ProgressPercent=\"%d\"", status->progress_percent);
+
+	g_string_append_printf (data, " IsIndexing=\"%s\"",
+					status->is_indexing ? "true" : "false");
+
+	g_string_append (data, ">");
+
+	g_string_append (data, "</IndexInformation>");
+}

Added: trunk/libbeagle/beagle/beagle-queryable-status.h
===================================================================
--- trunk/libbeagle/beagle/beagle-queryable-status.h	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/libbeagle/beagle/beagle-queryable-status.h	2006-07-16 01:49:07 UTC (rev 2691)
@@ -0,0 +1,62 @@
+/*
+ * beagle-queryable-status.h
+ *
+ * Copyright (C) 2006 Debajyoti Bera <dbera web gmail com>
+ *
+ */
+
+/*
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __BEAGLE_QUERYABLE_STATUS_H
+#define __BEAGLE_QUERYABLE_STATUS_H
+
+#include <glib-object.h>
+
+typedef struct _BeagleQueryableStatus BeagleQueryableStatus;
+
+typedef enum {
+	BEAGLE_QUERYABLE_STATE_NA, /* Not Applicable */
+	BEAGLE_QUERYABLE_STATE_IDLE,
+	BEAGLE_QUERYABLE_STATE_CRAWLING,
+	BEAGLE_QUERYABLE_STATE_INDEXING,
+	BEAGLE_QUERYABLE_STATE_FLUSHING
+} BeagleQueryableState;
+
+BeagleQueryableStatus * beagle_queryable_status_ref (BeagleQueryableStatus *status);
+void beagle_queryable_status_unref (BeagleQueryableStatus *status);
+
+G_CONST_RETURN char *
+beagle_queryable_status_get_name (BeagleQueryableStatus *status);
+
+int
+beagle_queryable_status_get_item_count (BeagleQueryableStatus *status);
+
+BeagleQueryableState
+beagle_queryable_status_get_state (BeagleQueryableStatus *status);
+
+int
+beagle_queryable_status_get_progress_percent (BeagleQueryableStatus *status);
+
+gboolean
+beagle_queryable_status_get_is_indexing (BeagleQueryableStatus *status);
+
+#endif /* __BEAGLE_QUERYABLE_STATUS_H */
+

Added: trunk/libbeagle/beagle/beagle-scheduler-information.c
===================================================================
--- trunk/libbeagle/beagle/beagle-scheduler-information.c	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/libbeagle/beagle/beagle-scheduler-information.c	2006-07-16 01:49:07 UTC (rev 2691)
@@ -0,0 +1,280 @@
+/*
+ * beagle-scheduler-information.c
+ *
+ * Copyright (C) 2006 Debajyoti Bera <dbera web gmail com>
+ *
+ */
+
+/*
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "beagle-scheduler-information.h"
+#include "beagle-private.h"
+
+BeagleSchedulerInformation *
+_beagle_scheduler_information_new ()
+{
+	BeagleSchedulerInformation *sched_info;
+
+	sched_info = g_new0 (BeagleSchedulerInformation, 1);
+
+	sched_info->ref_count = 1;
+
+	sched_info->total_task_count = -1;
+	sched_info->status_string = NULL;
+	sched_info->pending_task = NULL;
+	sched_info->future_task = NULL;
+	sched_info->blocked_task = NULL;
+
+	return sched_info;
+}
+
+/**
+ * beagle_scheduler_information_ref:
+ * @sched_info: a #BeagleSchedulerInformation
+ *
+ * Increases the reference count of the #BeagleSchedulerInformation.
+ *
+ * Return value: the #BeagleSchedulerInformation
+ **/
+BeagleSchedulerInformation *
+beagle_scheduler_information_ref (BeagleSchedulerInformation *sched_info)
+{
+	g_return_if_fail (sched_info != NULL);
+
+	sched_info->ref_count ++;
+
+	return sched_info;
+}
+
+/**
+ * beagle_scheduler_information_unref:
+ * @sched_info: a #BeagleSchedulerInformation
+ *
+ * Decreases the reference count of the #BeagleSchedulerInformation. When the reference count drops to 0, it is freed.
+ **/
+void
+beagle_scheduler_information_unref (BeagleSchedulerInformation *sched_info)
+{
+	g_return_if_fail (sched_info != NULL);
+	g_return_if_fail (sched_info->ref_count > 0);
+
+	sched_info->ref_count --;
+
+	if (sched_info->ref_count == 0) {
+		g_free (sched_info->status_string);
+                
+		if (sched_info->pending_task) {
+			g_slist_foreach (sched_info->pending_task, (GFunc) g_free, NULL);
+			g_slist_free (sched_info->pending_task);
+		}
+		
+		if (sched_info->future_task) {
+			g_slist_foreach (sched_info->future_task, (GFunc) g_free, NULL);
+			g_slist_free (sched_info->future_task);
+		}
+		
+		if (sched_info->blocked_task) {
+			g_slist_foreach (sched_info->blocked_task, (GFunc) g_free, NULL);
+			g_slist_free (sched_info->blocked_task);
+		}
+		
+		g_free (sched_info);
+	}
+}
+
+/**
+ * beagle_scheduler_information_get_total_task_count:
+ * @sched_info: a #BeagleSchedulerInformation
+ *
+ * Fetches the total number of tasks from the given #BeagleSchedulerInformation.
+ *
+ * Return value: the number of tasks from the #BeagleSchedulerInformation.
+ **/
+int
+beagle_scheduler_information_get_total_task_count (BeagleSchedulerInformation *sched_info)
+{
+	g_return_val_if_fail (sched_info != NULL, -1);
+
+	return sched_info->total_task_count;
+}
+
+/**
+ * beagle_scheduler_information_get_status_string:
+ * @sched_info: a #BeagleSchedulerInformation
+ *
+ * Fetches the status string from the given #BeagleSchedulerInformation.
+ *
+ * Return value: the status string from the #BeagleSchedulerInformation.
+ **/
+G_CONST_RETURN char *
+beagle_scheduler_information_get_status_string (BeagleSchedulerInformation *sched_info)
+{
+	g_return_val_if_fail (sched_info != NULL, NULL);
+
+	return sched_info->status_string;
+}
+
+/**
+ * beagle_scheduler_information_get_pending_tasks:
+ * @sched_info: a #BeagleSchedulerInformation
+ *
+ * Fetches the list of pending tasks as strings from the given #BeagleSchedulerInformation.
+ *
+ * Return value: the list of pending tasks from the #BeagleSchedulerInformation.
+ **/
+GSList *
+beagle_scheduler_information_get_pending_tasks (BeagleSchedulerInformation *sched_info)
+{
+	g_return_val_if_fail (sched_info != NULL, NULL);
+
+	return sched_info->pending_task;
+}
+
+/**
+ * beagle_scheduler_information_get_future_tasks:
+ * @sched_info: a #BeagleSchedulerInformation
+ *
+ * Fetches the list of future tasks as strings from the given #BeagleSchedulerInformation.
+ *
+ * Return value: the list of future tasks from the #BeagleSchedulerInformation.
+ **/
+GSList *
+beagle_scheduler_information_get_future_tasks (BeagleSchedulerInformation *sched_info)
+{
+	g_return_val_if_fail (sched_info != NULL, NULL);
+
+	return sched_info->future_task;
+}
+
+/**
+ * beagle_scheduler_information_get_blocked_tasks:
+ * @sched_info: a #BeagleSchedulerInformation
+ *
+ * Fetches the list of blocked tasks as strings from the given #BeagleSchedulerInformation.
+ *
+ * Return value: the list of blocked tasks from the #BeagleSchedulerInformation.
+ **/
+GSList *
+beagle_scheduler_information_get_blocked_tasks (BeagleSchedulerInformation *sched_info)
+{
+	g_return_val_if_fail (sched_info != NULL, NULL);
+
+	return sched_info->blocked_task;
+}
+
+/**
+ * beagle_scheduler_information_to_human_readable_string:
+ * @sched_info: a #BeagleSchedulerInformation
+ *
+ * Fetches a string version of the given #BeagleSchedulerInformation.
+ *
+ * Return value: a string version from the #BeagleSchedulerInformation.
+ **/
+G_CONST_RETURN char *
+beagle_scheduler_information_to_human_readable_string (BeagleSchedulerInformation *sched_info)
+{
+	int pos;
+	char *task;
+	GSList *iter;
+	GString *tmp = g_string_new (NULL);
+
+	g_string_append_printf (tmp, "Scheduler:\nCount: %d\n", sched_info->total_task_count);
+
+	if (sched_info->status_string)
+		g_string_append_printf (tmp, "Status: %s\n", sched_info->status_string);
+
+	pos = 1;
+
+	g_string_append (tmp, "\nPending Tasks:\n");
+	if (g_slist_length (sched_info->pending_task) > 0) {
+		iter = sched_info->pending_task;
+		while (iter != NULL) {
+			task = iter->data;
+			g_string_append_printf (tmp, "%d %s\n", pos, task);
+			iter = iter->next;
+			pos ++;
+		}
+	} else
+		g_string_append (tmp, "Scheduler queue is empty.\n");
+
+	if (g_slist_length (sched_info->future_task) > 0) {
+		g_string_append (tmp, "\nFuture Tasks:\n");
+		iter = sched_info->future_task;
+		while (iter != NULL) {
+			task = iter->data;
+			g_string_append_printf (tmp, "%s\n", task);
+			iter = iter->next;
+		}
+	}
+
+	if (g_slist_length (sched_info->blocked_task) > 0) {
+		g_string_append (tmp, "\nBlocked Tasks:\n");
+		iter = sched_info->blocked_task;
+		while (iter != NULL) {
+			task = iter->data;
+			g_string_append_printf (tmp, "%s\n", task);
+			iter = iter->next;
+		}
+	}
+
+	return g_string_free (tmp, FALSE);
+}
+
+void _task_to_xml (GSList *task_list, const char *list_name, const char *list_item_name, GString *data)
+{
+	char *task_data;
+	GSList *iter;
+
+	g_string_append_printf (data, "<%s>", list_name);
+	
+	if (task_list != NULL) {
+		iter = task_list;
+		while (iter != NULL) {
+			task_data = iter->data;
+			g_string_append_printf (data, "<%s>%s</%s>", list_item_name, task_data, list_item_name);
+			iter = iter->next;
+		}
+	}
+	
+	g_string_append_printf (data, "</%s>", list_name);
+}
+
+void
+_beagle_scheduler_information_to_xml (BeagleSchedulerInformation *sched_info, GString *data)
+{
+	char *tmp, *task;
+	GSList *iter;
+
+	g_string_append_printf (data, "<SchedulerInformation");
+
+	g_string_append_printf (data, " TotalTaskCount=\"%d\"", sched_info->total_task_count);
+	
+	if (sched_info->status_string)
+		g_string_append_printf (data, " StatusString=\"%s\"", sched_info->status_string);
+
+	g_string_append (data, ">");
+
+	_task_to_xml (sched_info->pending_task, "PendingTasks", "PendingTask", data);
+	_task_to_xml (sched_info->future_task, "FutureTasks", "FutureTask", data);
+	_task_to_xml (sched_info->blocked_task, "BlockedTasks", "BlockedTask", data);
+		
+	g_string_append (data, "</SchedulerInformation>");
+}

Added: trunk/libbeagle/beagle/beagle-scheduler-information.h
===================================================================
--- trunk/libbeagle/beagle/beagle-scheduler-information.h	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/libbeagle/beagle/beagle-scheduler-information.h	2006-07-16 01:49:07 UTC (rev 2691)
@@ -0,0 +1,57 @@
+/*
+ * beagle-scheduler-information.h
+ *
+ * Copyright (C) 2006 Debajyoti Bera <dbera web gmail com>
+ *
+ */
+
+/*
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __BEAGLE_SCHEDULER_INFORMATION_H
+#define __BEAGLE_SCHEDULER_INFORMATION_H
+
+#include <glib-object.h>
+
+typedef struct _BeagleSchedulerInformation BeagleSchedulerInformation;
+
+BeagleSchedulerInformation * beagle_scheduler_information_ref (BeagleSchedulerInformation *status);
+void beagle_scheduler_information_unref (BeagleSchedulerInformation *status);
+
+int
+beagle_scheduler_information_get_total_task_count (BeagleSchedulerInformation *status);
+
+G_CONST_RETURN char *
+beagle_scheduler_information_get_status_string (BeagleSchedulerInformation *status);
+
+GSList *
+beagle_scheduler_information_get_pending_tasks (BeagleSchedulerInformation *status);
+
+GSList *
+beagle_scheduler_information_get_future_tasks (BeagleSchedulerInformation *status);
+
+GSList *
+beagle_scheduler_information_get_blocked_tasks (BeagleSchedulerInformation *status);
+
+G_CONST_RETURN char *
+beagle_scheduler_information_to_human_readable_string (BeagleSchedulerInformation *status);
+
+#endif /* __BEAGLE_SCHEDULER_INFORMATION_H */
+

Modified: trunk/libbeagle/beagle/beagle.h
===================================================================
--- trunk/libbeagle/beagle/beagle.h	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/libbeagle/beagle/beagle.h	2006-07-16 01:49:07 UTC (rev 2691)
@@ -39,6 +39,7 @@
 #include <beagle/beagle-indexable.h>
 #include <beagle/beagle-indexing-service-request.h>
 #include <beagle/beagle-property.h>
+#include <beagle/beagle-scheduler-information.h>
 #include <beagle/beagle-query.h>
 #include <beagle/beagle-query-part.h>
 #include <beagle/beagle-query-part-date.h>
@@ -46,6 +47,7 @@
 #include <beagle/beagle-query-part-or.h>
 #include <beagle/beagle-query-part-property.h>
 #include <beagle/beagle-query-part-text.h>
+#include <beagle/beagle-queryable-status.h>
 #include <beagle/beagle-request.h>
 #include <beagle/beagle-response.h>
 #include <beagle/beagle-search-term-response.h>

Modified: trunk/libbeagle/examples/Makefile.am
===================================================================
--- trunk/libbeagle/examples/Makefile.am	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/libbeagle/examples/Makefile.am	2006-07-16 01:49:07 UTC (rev 2691)
@@ -7,8 +7,10 @@
 
 noinst_PROGRAMS =			\
 	beagle-search			\
-	beagle-shutdown
+	beagle-shutdown			\
+	beagle-info
 
 beagle_search_SOURCES   = beagle-search.c
 beagle_shutdown_SOURCES = beagle-shutdown.c
+beagle_info_SOURCES	= beagle-info.c
 

Added: trunk/libbeagle/examples/beagle-info.c
===================================================================
--- trunk/libbeagle/examples/beagle-info.c	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/libbeagle/examples/beagle-info.c	2006-07-16 01:49:07 UTC (rev 2691)
@@ -0,0 +1,43 @@
+#include <beagle/beagle.h>
+
+static void
+test_daemon_information (BeagleClient *client)
+{
+	BeagleDaemonInformationRequest *request;
+	BeagleResponse *response;
+	gboolean get_version = TRUE, get_info = TRUE, get_status = TRUE, is_indexing = TRUE;
+
+	request = beagle_daemon_information_request_new_specific (get_version,
+								  get_info,
+								  get_status,
+								  is_indexing
+								);
+	response = beagle_client_send_request (client, BEAGLE_REQUEST (request), NULL);
+
+	g_object_unref (request);
+
+	if (get_version)
+		g_print ("Beagle version: %s\n", beagle_daemon_information_response_get_version (BEAGLE_DAEMON_INFORMATION_RESPONSE (response)));
+	if (get_info)
+		g_print ("%s\n", beagle_daemon_information_response_get_human_readable_status (BEAGLE_DAEMON_INFORMATION_RESPONSE (response)));
+	if (get_status)
+		g_print ("%s\n", beagle_daemon_information_response_get_index_information (BEAGLE_DAEMON_INFORMATION_RESPONSE (response)));
+	if (is_indexing)
+		g_print ("%s\n", (beagle_daemon_information_response_is_indexing (BEAGLE_DAEMON_INFORMATION_RESPONSE (response)) ? "Indexing" : "Not Indexing"));
+
+	g_object_unref (response);
+}
+
+int
+main ()
+{
+	BeagleClient *client;
+
+	g_type_init ();
+
+	client = beagle_client_new (NULL);
+	test_daemon_information (client);
+
+	return 0;
+}
+	

Modified: trunk/wrappers/python/beagle.defs
===================================================================
--- trunk/wrappers/python/beagle.defs	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/wrappers/python/beagle.defs	2006-07-16 01:49:07 UTC (rev 2691)
@@ -206,6 +206,17 @@
   )
 )
 
+(define-enum QueryableState
+  (in-module "Beagle")
+  (c-name "BeagleQueryableState")
+  (values
+    '("NotApplicable" "BEAGLE_QUERYABLE_STATE_NA")
+    '("Idle" "BEAGLE_QUERYABLE_STATE_IDLE")
+    '("Crawling" "BEAGLE_QUERYABLE_STATE_CRAWLING")
+    '("Indexing" "BEAGLE_QUERYABLE_STATE_INDEXING")
+    '("Flushing" "BEAGLE_QUERYABLE_STATE_FLUSHING")
+  )
+)
 
 ;; From ../../libbeagle/beagle/beagle-client.h
 
@@ -261,13 +272,17 @@
 )
 
 (define-function beagle_daemon_information_request_new
-  (c-name "beagle_daemon_information_request_new")
+  (c-name "beagle_daemon_information_request_new_specific")
   (is-constructor-of "BeagleDaemonInformationRequest")
   (return-type "BeagleDaemonInformationRequest*")
+  (parameters
+    '("gboolean" "get_version" (default "TRUE"))
+    '("gboolean" "get_sched_info" (default "TRUE"))
+    '("gboolean" "get_index_status" (default "TRUE"))
+    '("gboolean" "get_is_indexing" (default "TRUE"))
+  )
 )
 
-
-
 ;; From ../../libbeagle/beagle/beagle-daemon-information-response.h
 
 (define-function beagle_daemon_information_response_get_type
@@ -281,12 +296,24 @@
   (return-type "const-char*")
 )
 
+(define-method ger_scheduler_information
+  (of-object "BeagleDaemonInformationResponse")
+  (c-name "beagle_daemon_information_response_get_scheduler_information")
+  (return-type "BeagleSchedulerInformation*")
+)
+
 (define-method get_human_readable_status
   (of-object "BeagleDaemonInformationResponse")
   (c-name "beagle_daemon_information_response_get_human_readable_status")
   (return-type "const-char*")
 )
 
+(define-method get_index_status
+  (of-object "BeagleDaemonInformationResponse")
+  (c-name "beagle_daemon_information_response_get_index_status")
+  (return-type "GSList*")
+)
+
 (define-method get_index_information
   (of-object "BeagleDaemonInformationResponse")
   (c-name "beagle_daemon_information_response_get_index_information")
@@ -1118,8 +1145,100 @@
   )
 )
 
+;; From ../../libbeagle/beagle/beagle-scheduler-information.h
 
+(define-method ref
+  (of-object "BeagleSchedulerInformation")
+  (c-name "beagle_scheduler_information_ref")
+  (return-type "BeagleSchedulerInformation*")
+)
 
+(define-method unref
+  (of-object "BeagleSchedulerInformation")
+  (c-name "beagle_scheduler_information_unref")
+  (return-type "none")
+)
+
+(define-method get_total_task_count
+  (of-object "BeagleSchedulerInformation")
+  (c-name "beagle_scheduler_information_get_total_task_count")
+  (return-type "int")
+)
+
+(define-method get_status_string
+  (of-object "BeagleSchedulerInformation")
+  (c-name "beagle_scheduler_information_get_status_string")
+  (return-type "const-char*")
+)
+
+(define-method get_pending_tasks
+  (of-object "BeagleSchedulerInformation")
+  (c-name "beagle_scheduler_information_get_pending_tasks")
+  (return-type "GSList*")
+)
+
+(define-method get_future_tasks
+  (of-object "BeagleSchedulerInformation")
+  (c-name "beagle_scheduler_information_get_future_tasks")
+  (return-type "GSList*")
+)
+
+(define-method get_blocked_tasks
+  (of-object "BeagleSchedulerInformation")
+  (c-name "beagle_scheduler_information_get_blocked_tasks")
+  (return-type "GSList*")
+)
+
+(define-method to_human_readable_string
+  (of-object "BeagleSchedulerInformation")
+  (c-name "beagle_scheduler_information_to_human_readable_string")
+  (return-type "const-char*")
+)
+
+;; From ../../libbeagle/beagle/beagle-queryable-status.h
+
+(define-method ref
+  (of-object "BeagleQueryableStatus")
+  (c-name "beagle_queryable_status_ref")
+  (return-type "BeagleQueryableStatus*")
+)
+
+(define-method unref
+  (of-object "BeagleQueryableStatus")
+  (c-name "beagle_queryable_status_unref")
+  (return-type "none")
+)
+
+(define-method get_name
+  (of-object "BeagleQueryableStatus")
+  (c-name "beagle_queryable_status_get_name")
+  (return-type "const-char*")
+)
+
+(define-method get_item_count
+  (of-object "BeagleQueryableStatus")
+  (c-name "beagle_queryable_status_get_item_count")
+  (return-type "int")
+)
+
+(define-method get_state
+  (of-object "BeagleQueryableStatus")
+  (c-name "beagle_queryable_status_get_state")
+  (return-type "BeagleQueryableState")
+)
+
+(define-method get_progress_percent
+  (of-object "BeagleQueryableStatus")
+  (c-name "beagle_queryable_status_get_progress_percent")
+  (return-type "int")
+)
+
+(define-method get_is_indexing
+  (of-object "BeagleQueryableStatus")
+  (c-name "beagle_queryable_status_get_is_indexing")
+  (return-type "gboolean")
+)
+
 ;; From ../../libbeagle/beagle/beagle-request.h
 
 (define-function beagle_request_get_type
@@ -1285,3 +1404,16 @@
   (c-name "BeagleTimestamp")
   (gtype-id "BEAGLE_TYPE_TIMESTAMP")    
 )
+
+(define-pointer QueryableStatus
+  (in-module "Beagle")
+  (c-name "BeagleQueryableStatus")
+  (gtype-id "BEAGLE_TYPE_QUERYABLE_STATUS")
+)
+
+(define-pointer SchedulerInformation
+  (in-module "Beagle")
+  (c-name "BeagleSchedulerInformation")
+  (gtype-id "BEAGLE_TYPE_SCHEDULER_INFORMATION")
+)
+

Modified: trunk/wrappers/python/beagle.override
===================================================================
--- trunk/wrappers/python/beagle.override	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/wrappers/python/beagle.override	2006-07-16 01:49:07 UTC (rev 2691)
@@ -12,6 +12,8 @@
 #define BEAGLE_TYPE_HIT       (beagle_hit_get_gtype ())
 #define BEAGLE_TYPE_PROPERTY  (beagle_property_get_gtype ())
 #define BEAGLE_TYPE_TIMESTAMP (beagle_timestamp_get_gtype ())
+#define BEAGLE_TYPE_QUERYABLE_STATUS	(beagle_queryable_status_get_gtype ())
+#define BEAGLE_TYPE_SCHEDULER_INFORMATION   (beagle_scheduler_information_get_gtype ())
 
 GType
 beagle_hit_get_gtype (void)
@@ -40,6 +42,24 @@
 	return our_type;
 }
 
+GType
+beagle_queryable_status_get_gtype (void)
+{
+	static GType our_type = 0;
+	if (!our_type)
+		our_type = g_pointer_type_register_static ("BeagleQueryableStatus");
+	return our_type;
+}
+
+GType
+beagle_scheduler_information_get_gtype (void)
+{
+	static GType our_type = 0;
+	if (!our_type)
+		our_type = g_pointer_type_register_static ("BeagleSchedulerInformation");
+	return our_type;
+}
+
 static PyObject *
 _helper_wrap_pointer_gslist (GType type, GSList *list)
 {
@@ -226,3 +246,47 @@
 
     return PyInt_FromLong (t);
 }
+%%
+override beagle_scheduler_information_get_pending_tasks noargs
+static PyObject *
+_wrap_beagle_scheduler_information_get_pending_tasks (PyGObject *self)
+{
+    GSList *list;
+
+    list = beagle_scheduler_information_get_pending_tasks ((BeagleSchedulerInformation *) self->obj);
+
+    return _helper_wrap_string_gslist (list);
+}
+%%
+override beagle_scheduler_information_get_future_tasks noargs
+static PyObject *
+_wrap_beagle_scheduler_information_get_future_tasks (PyGObject *self)
+{
+    GSList *list;
+
+    list = beagle_scheduler_information_get_future_tasks ((BeagleSchedulerInformation *) self->obj);
+
+    return _helper_wrap_string_gslist (list);
+}
+%%
+override beagle_scheduler_information_get_blocked_tasks noargs
+static PyObject *
+_wrap_beagle_scheduler_information_get_blocked_tasks (PyGObject *self)
+{
+    GSList *list;
+
+    list = beagle_scheduler_information_get_blocked_tasks ((BeagleSchedulerInformation *) self->obj);
+
+    return _helper_wrap_string_gslist (list);
+}
+%%
+override beagle_daemon_information_response_get_index_status
+static PyObject *
+_wrap_beagle_daemon_information_response_get_index_status (PyGObject *self)
+{
+    GSList *list;
+
+    list = beagle_daemon_information_response_get_index_status ((BeagleDaemonInformationResponse *) self->obj);
+
+    return _helper_wrap_pointer_gslist (BEAGLE_TYPE_QUERYABLE_STATUS, list);
+}

Added: trunk/wrappers/python/beagleinfo.py
===================================================================
--- trunk/wrappers/python/beagleinfo.py	2006-07-14 08:31:41 UTC (rev 2690)
+++ trunk/wrappers/python/beagleinfo.py	2006-07-16 01:49:07 UTC (rev 2691)
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+
+import beagle
+import gobject
+import sys
+
+def process_inputs (choice, val):
+    if choice [val] == "y":
+	choice [val] = True
+    else:
+	choice [val] = False
+
+request = beagle.DaemonInformationRequest()
+
+get_version = raw_input ("Get version (y/n)? ")
+get_scheduler_status = raw_input ("Get scheduler status (y/n)? ")
+get_index_info = raw_input ("Get index information (y/n)? ")
+get_is_indexing = raw_input ("Find out if currently indexing (y/n)? ")
+
+choice = {
+    'get_version': get_version,
+    'get_scheduler_status': get_scheduler_status,
+    'get_index_info': get_index_info,
+    'get_is_indexing': get_is_indexing}
+
+process_inputs (choice, 'get_version')
+process_inputs (choice, 'get_scheduler_status')
+process_inputs (choice, 'get_index_info')
+process_inputs (choice, 'get_is_indexing')
+
+client = beagle.Client ()
+
+request = beagle.DaemonInformationRequest (choice ['get_version'],
+					   choice ['get_scheduler_status'],
+					   choice ['get_index_info'],
+					   choice ['get_is_indexing'])
+response = client.send_request (request)
+del request
+request = None
+
+if choice ['get_version']:
+    print "Version = %s" % response.get_version ()
+if choice ['get_scheduler_status']:
+    print "Scheduler status:\n %s" % response.get_human_readable_status ()
+if choice ['get_index_info']:
+    print "Index information:\n %s" % response.get_index_information ()
+if choice ['get_is_indexing']:
+    print "Is indexing ? %s" % response.is_indexing ()
+


Property changes on: trunk/wrappers/python/beagleinfo.py
___________________________________________________________________
Name: svn:executable
   + *




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]