*** empty log message ***
authorhkhang <hkhang>
Mon, 9 Nov 2009 23:43:44 +0000 (23:43 +0000)
committerhkhang <hkhang>
Mon, 9 Nov 2009 23:43:44 +0000 (23:43 +0000)
Robust/src/Benchmarks/Spider/recovery/GlobalQuery.java
Robust/src/Benchmarks/Spider/recovery/QueryTask.java
Robust/src/Benchmarks/Spider/recovery/Spider.java

index 7efff695e90dcd45efd5d6717d7fa50c8b4663aa..718728b8c6ebd97b549f473f9822d3a7a6b80fc4 100644 (file)
@@ -3,9 +3,9 @@ public class GlobalQuery {
   GlobalString path;
        int depth;
   
-       public GlobalQuery(GlobalString hostname) {
+       public GlobalQuery(GlobalString hostname, GlobalString path) {
                this.hostname = hostname;
-               this.path = global new GlobalString("");
+               this.path = path;
                this.depth = 0;
        }
 
index 743d63e01be6b0d7c7c73a0aeeb1fbe0c18e6178..d8b9a12147bde8f266080e16a511776694b7db64 100644 (file)
@@ -86,18 +86,21 @@ public class QueryTask extends Task {
                        else if ((str.subString(index+1)).equals("ppt")) return true;
                        else if ((str.subString(index+1)).equals("pptx")) return true;
                        else if ((str.subString(index+1)).equals("jpg")) return true;
+                       else if ((str.subString(index+1)).equals("mp3")) return true;
+                       else if ((str.subString(index+1)).equals("wmv")) return true;
+                       else if ((str.subString(index+1)).equals("doc")) return true;
+                       else if ((str.subString(index+1)).equals("docx")) return true;
+                       else if ((str.subString(index+1)).equals("mov")) return true;
+                       else if ((str.subString(index+1)).equals("flv")) return true;
                        else return false;
                }
                return false;
        }
 
        public void done(Object obj) {
-               if (gTitle != null) 
+               if ((gTitle != null) && (gTitle.length() > 0)) {
                        processList();
-
-               GlobalString str = global new GlobalString("true");
-
-               doneList.put(workingURL, str);
+               }
 
                while(!toprocess.isEmpty()) {
                        GlobalQuery q = (GlobalQuery)toprocess.pop();
@@ -111,6 +114,9 @@ public class QueryTask extends Task {
 
                        if (!doneList.containsKey(gsb.toGlobalString())) {
                                todoList.push(q);
+                                       
+                               GlobalString str = global new GlobalString("1");
+                               doneList.put(gsb.toGlobalString(), str);
                        }
                }
        }
@@ -325,18 +331,21 @@ public class QueryTask extends Task {
                else if (str.equals("but")) return true;
                else if (str.equals("to")) return true;
                else if (str.equals("The")) return true;
-               else if (str.equals(".")) return true;
-               else if (str.equals("-")) return true;
-               else if (str.equals("=")) return true;
-               else if (str.equals("_")) return true;
-               else if (str.equals(":")) return true;
-               else if (str.equals(";")) return true;
-               else if (str.equals("\'")) return true;
-               else if (str.equals("\"")) return true;
-               else if (str.equals("|")) return true;
-               else if (str.equals("@")) return true;
-               else if (str.equals("&")) return true;
-               else if (str.equals(" ")) return true;
+               else if (str.length() == 1) {
+                       if (str.charAt(0) == '.') return true;
+                       else if (str.charAt(0) == '.') return true;
+                       else if (str.charAt(0) == '-') return true;
+                       else if (str.charAt(0) == '=') return true;
+                       else if (str.charAt(0) == '_') return true;
+                       else if (str.charAt(0) == ':') return true;
+                       else if (str.charAt(0) == ';') return true;
+                       else if (str.charAt(0) == '\'') return true;
+                       else if (str.charAt(0) == '\"') return true;
+                       else if (str.charAt(0) == '|') return true;
+                       else if (str.charAt(0) == '@') return true;
+                       else if (str.charAt(0) == '&') return true;
+                       else if (str.charAt(0) == ' ') return true;
+               }
                else return false;
        }
 
index 54aea28888f3ffc567b8249dcb590f46642827a6..11f37189b8b459c1b7a843f864ff26565b0833f4 100644 (file)
@@ -1,7 +1,7 @@
 public class Spider {
        public static void main(String[] args) {
                int NUM_THREADS = 3;
-               int maxDepth = 3;
+               int maxDepth = 4;
                int i, j;
                Work[] works;
                QueryTask[] qt;
@@ -9,11 +9,12 @@ public class Spider {
 
                NUM_THREADS = Integer.parseInt(args[0]);
 
-               if (args.length == 3) {
-                       maxDepth = Integer.parseInt(args[2]);
-               }
+//             if (args.length == 3) {
+//                     maxDepth = Integer.parseInt(args[2]);
+//             }
 
                GlobalString firstmachine;
+               GlobalString firstpage;
 
                int mid[] = new int[NUM_THREADS];
 //             mid[0] = (128<<24)|(195<<16)|(180<<8)|21;        
@@ -25,12 +26,17 @@ public class Spider {
 
                atomic {
                        firstmachine = global new GlobalString(args[1]);
+                       if (args.length == 3) {
+                               firstpage = global new GlobalString(args[2]);
+                       }
+                       else 
+                               firstpage = global new GlobalString("");;
 
                        works = global new Work[NUM_THREADS];
                        qt = global new QueryTask[NUM_THREADS];
                        currentWorkList = global new GlobalQuery[NUM_THREADS];
                        
-                       GlobalQuery firstquery = global new GlobalQuery(firstmachine);
+                       GlobalQuery firstquery = global new GlobalQuery(firstmachine, firstpage);
 
                        Queue todoList = global new Queue();
                        DistributedHashMap doneList = global new DistributedHashMap(500, 500, 0.75f);