finally! :) command line interface is working wooohooo, more features to come

hb2143 [2005-07-20 20:21:07]
finally! :) command line interface is working wooohooo, more features to come
Filename
src/psl/crunch3/Crunch3Settings.java
src/psl/crunch3/HttpStream.java
src/psl/crunch3/MainControl.java
src/psl/crunch3/plugins/contentextractor/ContentExtractor.java
diff --git a/src/psl/crunch3/Crunch3Settings.java b/src/psl/crunch3/Crunch3Settings.java
index 89a93cf..e9f1eca 100644
--- a/src/psl/crunch3/Crunch3Settings.java
+++ b/src/psl/crunch3/Crunch3Settings.java
@@ -488,6 +488,10 @@ public class Crunch3Settings {
 		}
 	}

+	public String getSettingsFile(){
+		return SETTINGS_FILE;
+	}
+
 	/**
 	 * @param b whether or not to filter content.
 	 */
diff --git a/src/psl/crunch3/HttpStream.java b/src/psl/crunch3/HttpStream.java
index 2b6f445..3335328 100644
--- a/src/psl/crunch3/HttpStream.java
+++ b/src/psl/crunch3/HttpStream.java
@@ -96,6 +96,7 @@ public class HttpStream extends Thread {

 		try {
 			readClientFirstLine();
+			Crunch3.mainControl.printStatus();
 		} catch (Exception e) {
 			if (Crunch3.settings.isVerbose())
 				e.printStackTrace();
diff --git a/src/psl/crunch3/MainControl.java b/src/psl/crunch3/MainControl.java
index 144a2c9..0579a5f 100644
--- a/src/psl/crunch3/MainControl.java
+++ b/src/psl/crunch3/MainControl.java
@@ -10,6 +10,7 @@ import java.util.Scanner;
 import java.io.*;

 import psl.crunch3.plugins.contentextractor.ContentExtractor;
+import psl.crunch3.plugins.contentextractor.ContentExtractorDescription;
 import psl.crunch3.plugins.sample.SamplePlugin;
 import psl.crunch3.plugins.sizemodifier.SizeModifier;
 /**
@@ -22,7 +23,7 @@ public class MainControl extends Thread{

 	boolean GUIActive;
 	String currentURL;
-
+	ContentExtractorDescription description = null;

 	public MainControl(boolean gui){

@@ -48,10 +49,19 @@ public class MainControl extends Thread{

 		int choice = -1; //corresponds to the menu item number
 		Scanner in = new Scanner(System.in);
+		ContentExtractor ce = new ContentExtractor();
+		description = ce.getControl();
+		yield();
+		Crunch3.proxy.registerPlugin(ce);
+
+		if(description == null) description = new ContentExtractorDescription();
+		description.commitSettings((Crunch3.settings).getSettingsFile(), 0);


 		//only active as long as the GUI is off and the user doesn't want to exit
 		while ((GUIActive ==false) && (choice !=0)){
+
+
 			System.out.println("please choose one of the following options:");
 			System.out.println("0. Exit the program");
 			System.out.println("1. load settings file");
@@ -89,6 +99,24 @@ public class MainControl extends Thread{



+
+	public void printStatus(){
+		System.out.println("***********************************************************");
+		System.out.println();
+
+		System.out.println("check for front page: " + description.getCheckFrontPage());
+		System.out.println("check for next page links: " + description.getCheckNextPage());
+		System.out.println("current url: " + description.getCurrentURL());
+		System.out.println("settings level: " + description.getSettingsLevel());
+		System.out.println("settings file: " + Crunch3.settings.getSettingsFile());
+		System.out.println("settings label: " + description.getSettingsLabel());
+		System.out.println("***********************************************************");
+
+
+
+	}
+
+
 	/**
 	 * Sets the parameter which indicates whether the GUI is active
 	 * @param active
@@ -135,6 +163,7 @@ public class MainControl extends Thread{
 			FileReader reader = new FileReader(file);
 			reader.close();
 			Crunch3.settings.setSettingsFile(file);
+			description.commitSettings(file, 0);
 		}
 		catch(Exception e){
 			System.out.println("error reading the file, please verify the name and location of your file and try again");
@@ -153,7 +182,6 @@ public class MainControl extends Thread{

 		Crunch3.mainWindow = new MainWindow(this);

-		Crunch3.proxy.registerPlugin(new ContentExtractor());
 		Crunch3.proxy.registerPlugin(new SamplePlugin());
 		Crunch3.proxy.registerPlugin(new SizeModifier());
 	}
diff --git a/src/psl/crunch3/plugins/contentextractor/ContentExtractor.java b/src/psl/crunch3/plugins/contentextractor/ContentExtractor.java
index 55093d5..2859b26 100644
--- a/src/psl/crunch3/plugins/contentextractor/ContentExtractor.java
+++ b/src/psl/crunch3/plugins/contentextractor/ContentExtractor.java
@@ -1685,13 +1685,23 @@ public class ContentExtractor extends EnhancedProxyFilter implements SiteDepende
 		return currentDocument;
 	}

+
+	public ContentExtractorDescription getControl(){
+
+		if(ceDescription == null)
+			ceDescription = new ContentExtractorDescription();
+
+		return ceDescription;
+
+	}
+
 	/* (non-Javadoc)
 	 * @see psl.crunch3.plugins.EnhancedProxyFilter#getDescriptionGUI()
 	 */
 	public Composite getDescriptionGUI(Composite c) {
 		// FIXME Auto-generated method stub
 		if (descriptionGUI == null)
-			descriptionGUI = new ContentExtractorDescriptionGUI(c,ceDescription);
+			descriptionGUI = new ContentExtractorDescriptionGUI(c,getControl());
 		return descriptionGUI.getComposite();
 	}

@@ -1782,19 +1792,7 @@ public class ContentExtractor extends EnhancedProxyFilter implements SiteDepende
 			else System.out.println("This is not a Homepage");
 		}

-		//handles frontpage detection for GUI-less crunch
-		/**if(descriptionGUI == null) {
-
-			if(Crunch3.settings.isHomePageCheck()){
-			if( hpt.isHomePage()){
-			 	 Crunch3.mainWindow.setGUIHomepage();
-			 }
-			 else {
-			 	 Crunch3.mainWindow.setGUINoHomepage();
-			 }
-			}
-			return;
-		}**/
+

 		//compute closes cluster to current URL and apply appropriate filter settings
 		if (ceDescription.getAutomatic()){