git://wamblee.org
/
utils
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Now using dependency injection for the XslTransformer instead of
[utils]
/
trunk
/
crawler
/
basic
/
src
/
org
/
wamblee
/
crawler
/
impl
/
ConfigurationParser.java
diff --git
a/trunk/crawler/basic/src/org/wamblee/crawler/impl/ConfigurationParser.java
b/trunk/crawler/basic/src/org/wamblee/crawler/impl/ConfigurationParser.java
index e9dc4013b5c3025817e5c6daaba1fe5537733fba..7e15d4a3ae90c151a371f98214f48c3a78caf2ca 100644
(file)
--- a/
trunk/crawler/basic/src/org/wamblee/crawler/impl/ConfigurationParser.java
+++ b/
trunk/crawler/basic/src/org/wamblee/crawler/impl/ConfigurationParser.java
@@
-17,7
+17,6
@@
package org.wamblee.crawler.impl;
import java.io.InputStream;
package org.wamblee.crawler.impl;
import java.io.InputStream;
-import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@
-31,6
+30,7
@@
import org.wamblee.crawler.Configuration;
import org.wamblee.crawler.GetPageRequest;
import org.wamblee.crawler.PageRequest;
import org.wamblee.crawler.PostPageRequest;
import org.wamblee.crawler.GetPageRequest;
import org.wamblee.crawler.PageRequest;
import org.wamblee.crawler.PostPageRequest;
+import org.wamblee.xml.XslTransformer;
/**
* Parsing of the configuration from an XML file.
/**
* Parsing of the configuration from an XML file.
@@
-59,17
+59,15
@@
public class ConfigurationParser {
private static final int MAX_TRIES = 3;
private static final int MAX_TRIES = 3;
- private static final int MAX_DELAY = 5000;
-
- private PrintStream _os;
+ private static final int MAX_DELAY = 100;
+ private XslTransformer _transformer;
+
/**
* Constructs the configuration parser.
/**
* Constructs the configuration parser.
- * @param aOs The stream for logging requests.
- * TODO plain java logging should be used instead of this awkward mechanism.
*/
*/
- public ConfigurationParser(
PrintStream aOs
) {
- _
os = aOs;
+ public ConfigurationParser(
XslTransformer aTransformer
) {
+ _
transformer = aTransformer;
}
/**
}
/**
@@
-162,10
+160,10
@@
public class ConfigurationParser {
PageRequest request;
if (METHOD_POST.equals(method)) {
request = new PostPageRequest(MAX_TRIES, MAX_DELAY, paramsArray,
PageRequest request;
if (METHOD_POST.equals(method)) {
request = new PostPageRequest(MAX_TRIES, MAX_DELAY, paramsArray,
- xslt, _
os
);
+ xslt, _
transformer
);
} else if (METHOD_GET.equals(method) || method == null) {
request = new GetPageRequest(MAX_TRIES, MAX_DELAY, paramsArray,
} else if (METHOD_GET.equals(method) || method == null) {
request = new GetPageRequest(MAX_TRIES, MAX_DELAY, paramsArray,
- xslt, _
os
);
+ xslt, _
transformer
);
} else {
throw new RuntimeException("Unknown request method '" + method
+ "'. Only " + METHOD_GET + " and " + METHOD_POST
} else {
throw new RuntimeException("Unknown request method '" + method
+ "'. Only " + METHOD_GET + " and " + METHOD_POST