beagle r4632 - in trunk/beagle: . BeagleClient BeagleClient/generated Util beagled search tools



Author: dbera
Date: Sat Mar 22 15:30:20 2008
New Revision: 4632
URL: http://svn.gnome.org/viewvc/beagle?rev=4632&view=rev

Log:
Revert the sgen changes (4620-4627). After lots of testing, MONO_XMLSERIALIZER_THS is a better        alternative suitable to the organization of our classes and does not requrie a whole lot of hack      while delivering the same results.
Some other minor fixes (comments, whitespace changes, better messages).


Removed:
   trunk/beagle/BeagleClient/generated/
   trunk/beagle/Util/sgen.cs
Modified:
   trunk/beagle/BeagleClient/Makefile.am
   trunk/beagle/BeagleClient/Transport.cs
   trunk/beagle/Util/Makefile.am
   trunk/beagle/beagled/RemoteIndexer.cs
   trunk/beagle/configure.in
   trunk/beagle/search/Makefile.am
   trunk/beagle/tools/Query.cs

Modified: trunk/beagle/BeagleClient/Makefile.am
==============================================================================
--- trunk/beagle/BeagleClient/Makefile.am	(original)
+++ trunk/beagle/BeagleClient/Makefile.am	Sat Mar 22 15:30:20 2008
@@ -10,8 +10,10 @@
 CSFLAGS += -define:ENABLE_AVAHI
 endif
 
-SERIALIZER_CSFILES = 					\
+CSFILES = 						\
+	$(srcdir)/AssemblyInfo.cs			\
 	$(srcdir)/Hit.cs                		\
+	$(srcdir)/IIndexableGenerator.cs       		\
 	$(srcdir)/Indexable.cs          		\
 	$(srcdir)/IndexingService.cs			\
 	$(srcdir)/IndexingStatusResponse.cs		\
@@ -24,16 +26,9 @@
 	$(srcdir)/QueryableStatus.cs			\
 	$(srcdir)/RemoteControl.cs			\
 	$(srcdir)/Snippet.cs				\
-	$(srcdir)/Versioned.cs
-
-OTHER_CSFILES =	\
-	$(srcdir)/AssemblyInfo.cs			\
-	$(srcdir)/IIndexableGenerator.cs       		\
 	$(srcdir)/Transport.cs				\
-	$(srcdir)/UnixTransport.cs
-
-CSFILES = $(SERIALIZER_CSFILES)	\
-	  $(OTHER_CSFILES)
+	$(srcdir)/UnixTransport.cs			\
+	$(srcdir)/Versioned.cs
 
 LOCAL_ASSEMBLIES =					\
 	../Util/Util.dll
@@ -46,22 +41,8 @@
 
 RESOURCES =
 
-DUMMY_TARGET = Beagle.Dummy.dll
-GENERATED_DIR = generated
-GENERATED_TARGET = $(GENERATED_DIR)/$(DUMMY_TARGET:%.dll=%.XmlSerializers.dll)
-
-$(DUMMY_TARGET): $(CSFILES) $(LOCAL_ASSEMBLIES) $(RESOURCES)
-	$(CSC) -out:$@ $(CSFLAGS) -define:GENERATE_SERIALIZE $(CSFILES) $(ASSEMBLIES) $(RESOURCES)
-
-$(GENERATED_TARGET): $(SERIALIZER_CSFILES) $(DUMMY_TARGET)
-	DUMMY_TARGET="$(DUMMY_TARGET)" $(MAKE) -e -C $(GENERATED_DIR)
-
-$(TARGET): $(CSFILES) $(LOCAL_ASSEMBLIES) $(RESOURCES) $(GENERATED_TARGET)
-	$(CSC) -out:$@ $(CSFLAGS) $(CSFILES) $(ASSEMBLIES) $(RESOURCES) $(GENERATED_DIR)/*.cs
-	@echo ""
-	@echo "WARNING! Keep an eye on the warning messages."
-	@echo "If some methods of the generated files are unused, make sure they only relate to writing of Enum variables."
-	@echo "Make sure all the required types have their serializer generated."
+$(TARGET): $(CSFILES) $(LOCAL_ASSEMBLIES) $(RESOURCES)
+	$(CSC) -out:$@ $(CSFLAGS) $(CSFILES) $(ASSEMBLIES) $(RESOURCES)
 
 all: $(TARGET)
 
@@ -75,10 +56,6 @@
 EXTRA_DIST =		\
 	$(CSFILES)
 
-CLEANFILES =			\
-	$(DUMMY_TARGET)		\
-	$(DUMMY_TARGET).mdb 	\
-	$(GENERATED_TARGET)	\
-	$(GENERATED_TARGET).mdb	\
-	$(TARGET)		\
+CLEANFILES =		\
+	$(TARGET)	\
 	$(TARGET).mdb

Modified: trunk/beagle/BeagleClient/Transport.cs
==============================================================================
--- trunk/beagle/BeagleClient/Transport.cs	(original)
+++ trunk/beagle/BeagleClient/Transport.cs	Sat Mar 22 15:30:20 2008
@@ -41,38 +41,8 @@
 
 	public abstract class Transport {
 
-		//////////////// Serialization ////////////////
-
-		protected static XmlSerializer req_serializer, resp_serializer;
-#if GENERATE_SERIALIZE
-		static Transport () {
-			req_serializer = null;
-			resp_serializer = null;
-			Logger.Log.Error ("Should not be here");
-			Environment.Exit (1);
-		}
-#else
-		static Transport () {
-			Beagle.GeneratedSerializers.Literal.XmlSerializerContract factory = new Beagle.GeneratedSerializers.Literal.XmlSerializerContract ();
-
-			// What happens when the factory does not have a serializer for a particular type
-			// Does it fallback to its reflection based approach ?
-			req_serializer = factory.GetSerializer (typeof (RequestWrapper));
-			resp_serializer = factory.GetSerializer (typeof (ResponseWrapper));
-		}
-#endif
-
-		// This should be called by any Client class which needs to send/receive messages that are not defined
-		// in BeagleClient's Beagle.dll assembly. Server classes (like one side of beagled and indexhelper) need
-		// not call this since Server.cs has its own serializer.
-		// Currently RemoteIndexer calls this.
-		public static void SetLegacySerializers ()
-		{
-			req_serializer = new XmlSerializer (typeof (RequestWrapper), RequestMessage.Types);
-			resp_serializer = new XmlSerializer (typeof (ResponseWrapper), ResponseMessage.Types);
-		}
-
-		//////////////////////////////////////////////////////////////
+		protected static XmlSerializer req_serializer = new XmlSerializer (typeof (RequestWrapper), RequestMessage.Types);
+		protected static XmlSerializer resp_serializer = new XmlSerializer (typeof (ResponseWrapper), ResponseMessage.Types);
 
 		private bool local = false;
 

Modified: trunk/beagle/Util/Makefile.am
==============================================================================
--- trunk/beagle/Util/Makefile.am	(original)
+++ trunk/beagle/Util/Makefile.am	Sat Mar 22 15:30:20 2008
@@ -220,14 +220,9 @@
 Inotify.exe: $(INOTIFY_TEST_CSFILES)
 	$(CSC) -unsafe -out:$@ $^ -r:Mono.Posix -define:INOTIFY_TEST -define:ENABLE_INOTIFY
 
-# Local copy due to a mono bug https://bugzilla.novell.com/show_bug.cgi?id=372780
-sgen.exe: sgen.cs
-	$(CSC) -r:System.Xml.dll -define:NET_2_0 -out:$@ $^
-
 ALL_TARGETS =			\
 	$(UTIL_TARGET)		\
-	$(INOTIFY_EXE)		\
-	sgen.exe
+	$(INOTIFY_EXE)
 
 if ENABLE_GUI
 ALL_TARGETS += $(UI_UTIL_TARGET)
@@ -269,6 +264,5 @@
 	$(UI_UTIL_TARGET)	\
 	$(UI_UTIL_TARGET).mdb	\
 	Inotify.exe		\
-	Inotify.exe.mdb		\
-	sgen.exe
+	Inotify.exe.mdb
 

Modified: trunk/beagle/beagled/RemoteIndexer.cs
==============================================================================
--- trunk/beagle/beagled/RemoteIndexer.cs	(original)
+++ trunk/beagle/beagled/RemoteIndexer.cs	Sat Mar 22 15:30:20 2008
@@ -55,9 +55,6 @@
 			if (! File.Exists (helper_path))
 				throw new Exception ("Could not find " + helper_path);
 			Logger.Log.Debug ("Found index helper at {0}", helper_path);
-
-			// Beagled acts as a client here but sends message that is not defined in BeagleClient
-			Transport.SetLegacySerializers ();
 		}
 
 		static public IIndexer NewRemoteIndexer (string name, int minor_version)

Modified: trunk/beagle/configure.in
==============================================================================
--- trunk/beagle/configure.in	(original)
+++ trunk/beagle/configure.in	Sat Mar 22 15:30:20 2008
@@ -12,8 +12,8 @@
 ### Some dependencies
 ###
 
-MONO_REQUIRED=1.2.6
-MONODOC_REQUIRED=1.2.6
+MONO_REQUIRED=1.2.4
+MONODOC_REQUIRED=1.2.4
 NDESK_DBUS_REQUIRED=0.5.2
 NDESK_DBUS_GLIB_REQUIRED=0.3.0
 GTK_SHARP_REQUIRED=2.6.0
@@ -73,8 +73,10 @@
 # Temporary: check for mono-1.9
 PKG_CHECK_MODULES(MONO, mono >= 1.9, mono_1_9=yes, mono_1_9=no) 
 if test "x$mono_1_9" = "xno"; then
+	AC_MSG_RESULT([missing mono >= 1.9. Searching for mono >= 1.2.4])
 	PKG_CHECK_MODULES(MONO, mono >= $MONO_REQUIRED) 
 else
+	AC_MSG_RESULT([found mono >= 1.9])
 	BEAGLE_DEFINES="$BEAGLE_DEFINES -define:MONO_1_9"
 fi
 

Modified: trunk/beagle/search/Makefile.am
==============================================================================
--- trunk/beagle/search/Makefile.am	(original)
+++ trunk/beagle/search/Makefile.am	Sat Mar 22 15:30:20 2008
@@ -42,7 +42,7 @@
 	$(srcdir)/Beagle.Search.Tiles/Audio.cs			\
 	$(srcdir)/Beagle.Search.Tiles/CApplet.cs		\
 	$(srcdir)/Beagle.Search.Tiles/Calendar.cs		\
-	$(srcdir)/Beagle.Search.Tiles/Contact.cs		\	
+	$(srcdir)/Beagle.Search.Tiles/Contact.cs		\
 	$(srcdir)/Beagle.Search.Tiles/Docbook.cs		\
 	$(srcdir)/Beagle.Search.Tiles/File.cs			\
 	$(srcdir)/Beagle.Search.Tiles/Folder.cs			\

Modified: trunk/beagle/tools/Query.cs
==============================================================================
--- trunk/beagle/tools/Query.cs	(original)
+++ trunk/beagle/tools/Query.cs	Sat Mar 22 15:30:20 2008
@@ -69,8 +69,11 @@
 					   (lastQueryTime - queryStartTime).TotalSeconds);
 		}
 
-		if (verbose && response.NumMatches >= 0)
-			Console.WriteLine ("Returned latest {0} results out of total {1} matches", response.Hits.Count, response.NumMatches);
+		if (verbose)
+			if (response.NumMatches >= 0)
+				Console.WriteLine ("Returned latest {0} results out of total {1} matches", response.Hits.Count, response.NumMatches);
+			else
+				Console.WriteLine ("Returned latest {0} results", response.Hits.Count);
 
 		if (! display_hits) {
 			count += response.Hits.Count;
@@ -323,8 +326,26 @@
 		else
 			query.ClosedEvent += OnClosed;
 
+		do {
 		SendQuery ();
 
 		main_loop.Run ();
+
+		query.HitsAddedEvent -= OnHitsAdded;
+		query.HitsSubtractedEvent -= OnHitsSubtracted;
+		query.FinishedEvent -= OnFinished;
+		query = null;
+
+		query = new Query ();
+		query.AddText (Console.ReadLine ());
+		query.MaxHits = 1000;
+
+		query.HitsAddedEvent += OnHitsAdded;
+		query.HitsSubtractedEvent += OnHitsSubtracted;
+		query.FinishedEvent += OnFinished;
+
+		count = 0;
+		lastQueryTime = DateTime.Now;
+		} while (true);
 	}
 }



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