if ((param = getParameter ("log")) != null)
workbench.setLoggerVisible (isTrue (param));
*/
Crawler crawler = workbench.getCrawler();
String action = getParameter ("action");
if (action != null) {
String filename = getParameter ("filename");
String pattern = getParameter ("pattern");
if (action.equalsIgnoreCase ("concatenate"))
crawler.setAction (new ConcatAction (filename, true));
else if (action.equalsIgnoreCase ("save"))
crawler.setAction (new MirrorAction (filename, true));
else if (action.equalsIgnoreCase ("visualize")) {
crawler.setAction (null);
//workbench.setGraphVisible (true);
}
else if (action.equalsIgnoreCase ("extract"))
crawler.setAction (new ExtractAction (new Tagexp (pattern),
true, filename, false));
else if (action.equalsIgnoreCase ("none"))
crawler.setAction (null);
else
throw new RuntimeException ("unknown action: " +action);
}
String urls = getParameter ("urls");
if (urls != null)
try {
crawler.setRootHrefs (urls);
} catch (java.net.MalformedURLException e) {
throw new RuntimeException (e.toString());
}
String domain = getParameter ("domain");
if (domain != null) {
if (domain.equalsIgnoreCase ("server"))
crawler.setDomain (Crawler.SERVER);
else if (domain.equalsIgnoreCase ("subtree"))
crawler.setDomain (Crawler.SUBTREE);
else
crawler.setDomain (Crawler.WEB);
}
String type = getParameter ("type");
if (type != null) {
if (type.equalsIgnoreCase ("images+hyperlinks"))
crawler.setLinkType (Crawler.HYPERLINKS_AND_IMAGES);
else if (type.equalsIgnoreCase ("all"))
crawler.setLinkType (Crawler.ALL_LINKS);
else
crawler.setLinkType (Crawler.WEB);
}
String depth = getParameter ("depth");
if (depth != null)
crawler.setMaxDepth (Integer.parseInt (depth));
String dfs = getParameter ("depthfirst");
if (dfs != null)
crawler.setDepthFirst (isTrue (dfs));
workbench.setCrawler (crawler);
setLayout (new BorderLayout ());
add ("Center", workbench);