import java.net.MalformedURLException;
import java.net.URL;
+import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executor;
private final List<Page> pages = new ArrayList<Page>();
//
+ // ACCESSORS
+ //
+
+ /**
+ * Sets the host name of the node.
+ *
+ * @param nodeHost
+ * The node’s host name
+ */
+ public void setNodeHost(String nodeHost) {
+ this.nodeHost = nodeHost;
+ }
+
+ //
// ACTIONS
//
logger.log(Level.INFO, "Skipping “" + nextPage + "”.");
continue;
}
- URLFetcher urlFetcher = new URLFetcher(this, nextURL);
- urlFetcherExecutor.execute(urlFetcher);
+ URLFetcher urlFetcher;
+ try {
+ logger.log(Level.INFO, "Fetching “" + nextURL + "”...");
+ urlFetcher = new URLFetcher(this, nextURL);
+ urlFetcherExecutor.execute(urlFetcher);
+ } catch (NoSuchAlgorithmException nsae1) {
+ logger.log(Level.SEVERE, "Could not get “SHA-256” message digest!", nsae1);
+ }
}
}
* @return The joined path
*/
private String createPath(String[] pathComponents, int index) {
- Validation.begin().isNotNull("pathComponents", pathComponents).check().isLess("index", index, pathComponents.length).check();
+ Validation.begin().isNotNull("pathComponents", pathComponents).check().isLessOrEqual("index", index, pathComponents.length).check();
StringBuilder path = new StringBuilder();
for (int pathComponentIndex = index; pathComponentIndex < pathComponents.length; pathComponentIndex++) {
if (path.length() > 0) {
*/
private URL createURL(Page page) {
try {
- return new URL("http://" + nodeHost + ":" + nodePort + "/");
+ return new URL("http://" + nodeHost + ":" + nodePort + "/SSK@" + page.getEdition().getSite().getKey() + "/" + page.getEdition().getSite().getBasename() + "-" + page.getEdition().getNumber() + "/" + page.getPath());
} catch (MalformedURLException mue1) {
/* nearly impossible. */
}