Modified: nutch/branches/2.x/src/java/org/apache/nutch/util/TrieStringMatcher.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/util/TrieStringMatcher.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/util/TrieStringMatcher.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/util/TrieStringMatcher.java Fri Jan 9 06:34:33 2015 @@ -17,21 +17,19 @@ package org.apache.nutch.util; - import java.util.Arrays; import java.util.LinkedList; import java.util.ListIterator; /** - * TrieStringMatcher is a base class for simple tree-based string - * matching. - * + * TrieStringMatcher is a base class for simple tree-based string matching. + * */ public abstract class TrieStringMatcher { protected TrieNode root; protected TrieStringMatcher() { - this.root= new TrieNode('\000', false); + this.root = new TrieNode('\000', false); } /** @@ -44,20 +42,19 @@ public abstract class TrieStringMatcher protected boolean terminal; /** - * Creates a new TrieNode, which contains the given - * <code>nodeChar</code>. If <code>isTerminal</code> is - * <code>true</code>, the new node is a <em>terminal</em> node in - * the trie. - */ + * Creates a new TrieNode, which contains the given <code>nodeChar</code>. + * If <code>isTerminal</code> is <code>true</code>, the new node is a + * <em>terminal</em> node in the trie. + */ TrieNode(char nodeChar, boolean isTerminal) { - this.nodeChar= nodeChar; - this.terminal= isTerminal; - this.childrenList= new LinkedList<TrieNode>(); + this.nodeChar = nodeChar; + this.terminal = isTerminal; + this.childrenList = new LinkedList<TrieNode>(); } /** - * Returns <code>true</code> if this node is a <em>terminal</em> - * node in the trie. + * Returns <code>true</code> if this node is a <em>terminal</em> node in the + * trie. */ boolean isTerminal() { return terminal; @@ -65,67 +62,68 @@ public abstract class TrieStringMatcher /** * Returns the child node of this node whose node-character is - * <code>nextChar</code>. If no such node exists, one will be is - * added. If <em>isTerminal</em> is <code>true</code>, the node - * will be a terminal node in the trie. + * <code>nextChar</code>. If no such node exists, one will be is added. If + * <em>isTerminal</em> is <code>true</code>, the node will be a terminal + * node in the trie. */ TrieNode getChildAddIfNotPresent(char nextChar, boolean isTerminal) { if (childrenList == null) { - childrenList= new LinkedList<TrieNode>(); + childrenList = new LinkedList<TrieNode>(); childrenList.addAll(Arrays.asList(children)); - children= null; + children = null; } if (childrenList.size() == 0) { - TrieNode newNode= new TrieNode(nextChar, isTerminal); + TrieNode newNode = new TrieNode(nextChar, isTerminal); childrenList.add(newNode); return newNode; } - ListIterator<TrieNode> iter= childrenList.listIterator(); - TrieNode node= iter.next(); - while ( (node.nodeChar < nextChar) && iter.hasNext() ) - node= iter.next(); - + ListIterator<TrieNode> iter = childrenList.listIterator(); + TrieNode node = iter.next(); + while ((node.nodeChar < nextChar) && iter.hasNext()) + node = iter.next(); + if (node.nodeChar == nextChar) { - node.terminal= node.terminal | isTerminal; + node.terminal = node.terminal | isTerminal; return node; } - if (node.nodeChar > nextChar) + if (node.nodeChar > nextChar) iter.previous(); - TrieNode newNode= new TrieNode(nextChar, isTerminal); + TrieNode newNode = new TrieNode(nextChar, isTerminal); iter.add(newNode); - return newNode; + return newNode; } /** * Returns the child node of this node whose node-character is - * <code>nextChar</code>. If no such node exists, - * <code>null</code> is returned. + * <code>nextChar</code>. If no such node exists, <code>null</code> is + * returned. */ TrieNode getChild(char nextChar) { if (children == null) { - children= childrenList.toArray(new TrieNode[childrenList.size()]); - childrenList= null; + children = childrenList.toArray(new TrieNode[childrenList.size()]); + childrenList = null; Arrays.sort(children); } - int min= 0; - int max= children.length - 1; - int mid= 0; + int min = 0; + int max = children.length - 1; + int mid = 0; while (min < max) { - mid= (min + max) / 2; - if (children[mid].nodeChar == nextChar) + mid = (min + max) / 2; + if (children[mid].nodeChar == nextChar) return children[mid]; if (children[mid].nodeChar < nextChar) - min= mid + 1; - else // if (children[mid].nodeChar > nextChar) - max= mid - 1; + min = mid + 1; + else + // if (children[mid].nodeChar > nextChar) + max = mid - 1; } - if (min == max) + if (min == max) if (children[min].nodeChar == nextChar) return children[min]; @@ -133,59 +131,57 @@ public abstract class TrieStringMatcher } public int compareTo(TrieNode other) { - if (this.nodeChar < other.nodeChar) + if (this.nodeChar < other.nodeChar) return -1; - if (this.nodeChar == other.nodeChar) + if (this.nodeChar == other.nodeChar) return 0; -// if (this.nodeChar > other.nodeChar) + // if (this.nodeChar > other.nodeChar) return 1; } } /** * Returns the next {@link TrieNode} visited, given that you are at - * <code>node</code>, and the the next character in the input is - * the <code>idx</code>'th character of <code>s</code>. + * <code>node</code>, and the the next character in the input is the + * <code>idx</code>'th character of <code>s</code>. */ protected final TrieNode matchChar(TrieNode node, String s, int idx) { return node.getChild(s.charAt(idx)); } /** - * Adds any necessary nodes to the trie so that the given - * <code>String</code> can be decoded and the last character is - * represented by a terminal node. Zero-length <code>Strings</code> - * are ignored. + * Adds any necessary nodes to the trie so that the given <code>String</code> + * can be decoded and the last character is represented by a terminal node. + * Zero-length <code>Strings</code> are ignored. */ protected final void addPatternForward(String s) { - TrieNode node= root; - int stop= s.length() - 1; + TrieNode node = root; + int stop = s.length() - 1; int i; if (s.length() > 0) { - for (i= 0; i < stop; i++) - node= node.getChildAddIfNotPresent(s.charAt(i), false); - node= node.getChildAddIfNotPresent(s.charAt(i), true); + for (i = 0; i < stop; i++) + node = node.getChildAddIfNotPresent(s.charAt(i), false); + node = node.getChildAddIfNotPresent(s.charAt(i), true); } } /** - * Adds any necessary nodes to the trie so that the given - * <code>String</code> can be decoded <em>in reverse</em> and the - * first character is represented by a terminal node. Zero-length - * <code>Strings</code> are ignored. + * Adds any necessary nodes to the trie so that the given <code>String</code> + * can be decoded <em>in reverse</em> and the first character is represented + * by a terminal node. Zero-length <code>Strings</code> are ignored. */ protected final void addPatternBackward(String s) { - TrieNode node= root; + TrieNode node = root; if (s.length() > 0) { - for (int i= s.length()-1; i > 0; i--) - node= node.getChildAddIfNotPresent(s.charAt(i), false); - node= node.getChildAddIfNotPresent(s.charAt(0), true); + for (int i = s.length() - 1; i > 0; i--) + node = node.getChildAddIfNotPresent(s.charAt(i), false); + node = node.getChildAddIfNotPresent(s.charAt(0), true); } } /** - * Returns true if the given <code>String</code> is matched by a - * pattern in the trie + * Returns true if the given <code>String</code> is matched by a pattern in + * the trie */ public abstract boolean matches(String input);
Modified: nutch/branches/2.x/src/java/org/apache/nutch/util/URLUtil.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/util/URLUtil.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/util/URLUtil.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/util/URLUtil.java Fri Jan 9 06:34:33 2015 @@ -28,15 +28,18 @@ import org.apache.nutch.util.domain.Doma public class URLUtil { /** - * Resolve relative URL-s and fix a java.net.URL error - * in handling of URLs with pure query targets. - * @param base base url - * @param target target url (may be relative) + * Resolve relative URL-s and fix a java.net.URL error in handling of URLs + * with pure query targets. + * + * @param base + * base url + * @param target + * target url (may be relative) * @return resolved absolute url. * @throws MalformedURLException */ public static URL resolveURL(URL base, String target) - throws MalformedURLException { + throws MalformedURLException { target = target.trim(); // handle the case that there is a target that is a pure query, @@ -58,9 +61,10 @@ public class URLUtil { } /** Handle the case in RFC3986 section 5.4.1 example 7, and similar. */ - static URL fixPureQueryTargets(URL base, String target) - throws MalformedURLException { - if (!target.startsWith("?")) return new URL(base, target); + static URL fixPureQueryTargets(URL base, String target) + throws MalformedURLException { + if (!target.startsWith("?")) + return new URL(base, target); String basePath = base.getPath(); String baseRightMost = ""; @@ -69,130 +73,148 @@ public class URLUtil { baseRightMost = basePath.substring(baseRightMostIdx + 1); } - if (target.startsWith("?")) target = baseRightMost + target; + if (target.startsWith("?")) + target = baseRightMost + target; return new URL(base, target); } - private static Pattern IP_PATTERN = Pattern.compile("(\\d{1,3}\\.){3}(\\d{1,3})"); + private static Pattern IP_PATTERN = Pattern + .compile("(\\d{1,3}\\.){3}(\\d{1,3})"); - /** Returns the domain name of the url. The domain name of a url is - * the substring of the url's hostname, w/o subdomain names. As an - * example <br><code> + /** + * Returns the domain name of the url. The domain name of a url is the + * substring of the url's hostname, w/o subdomain names. As an example <br> + * <code> * getDomainName(conf, new URL(http://lucene.apache.org/)) * </code><br> - * will return <br><code> apache.org</code> - * */ + * will return <br> + * <code> apache.org</code> + * */ public static String getDomainName(URL url) { DomainSuffixes tlds = DomainSuffixes.getInstance(); String host = url.getHost(); - //it seems that java returns hostnames ending with . - if(host.endsWith(".")) + // it seems that java returns hostnames ending with . + if (host.endsWith(".")) host = host.substring(0, host.length() - 1); - if(IP_PATTERN.matcher(host).matches()) + if (IP_PATTERN.matcher(host).matches()) return host; - + int index = 0; String candidate = host; - for(;index >= 0;) { + for (; index >= 0;) { index = candidate.indexOf('.'); - String subCandidate = candidate.substring(index+1); - if(tlds.isDomainSuffix(subCandidate)) { - return candidate; + String subCandidate = candidate.substring(index + 1); + if (tlds.isDomainSuffix(subCandidate)) { + return candidate; } candidate = subCandidate; } return candidate; } - /** Returns the domain name of the url. The domain name of a url is - * the substring of the url's hostname, w/o subdomain names. As an - * example <br><code> + /** + * Returns the domain name of the url. The domain name of a url is the + * substring of the url's hostname, w/o subdomain names. As an example <br> + * <code> * getDomainName(conf, new http://lucene.apache.org/) * </code><br> - * will return <br><code> apache.org</code> + * will return <br> + * <code> apache.org</code> + * * @throws MalformedURLException */ public static String getDomainName(String url) throws MalformedURLException { return getDomainName(new URL(url)); } - /** Returns whether the given urls have the same domain name. - * As an example, <br> + /** + * Returns whether the given urls have the same domain name. As an example, <br> * <code> isSameDomain(new URL("http://lucene.apache.org") * , new URL("http://people.apache.org/")) * <br> will return true. </code> - * + * * @return true if the domain names are equal */ public static boolean isSameDomainName(URL url1, URL url2) { return getDomainName(url1).equalsIgnoreCase(getDomainName(url2)); } - /**Returns whether the given urls have the same domain name. - * As an example, <br> - * <code> isSameDomain("http://lucene.apache.org" - * ,"http://people.apache.org/") - * <br> will return true. </code> - * @return true if the domain names are equal - * @throws MalformedURLException - */ + /** + * Returns whether the given urls have the same domain name. As an example, <br> + * <code> isSameDomain("http://lucene.apache.org" + * ,"http://people.apache.org/") + * <br> will return true. </code> + * + * @return true if the domain names are equal + * @throws MalformedURLException + */ public static boolean isSameDomainName(String url1, String url2) - throws MalformedURLException { + throws MalformedURLException { return isSameDomainName(new URL(url1), new URL(url2)); } - /** Returns the {@link DomainSuffix} corresponding to the - * last public part of the hostname + /** + * Returns the {@link DomainSuffix} corresponding to the last public part of + * the hostname */ public static DomainSuffix getDomainSuffix(URL url) { DomainSuffixes tlds = DomainSuffixes.getInstance(); String host = url.getHost(); - if(IP_PATTERN.matcher(host).matches()) + if (IP_PATTERN.matcher(host).matches()) return null; - + int index = 0; String candidate = host; - for(;index >= 0;) { + for (; index >= 0;) { index = candidate.indexOf('.'); - String subCandidate = candidate.substring(index+1); + String subCandidate = candidate.substring(index + 1); DomainSuffix d = tlds.get(subCandidate); - if(d != null) { - return d; + if (d != null) { + return d; } candidate = subCandidate; } return null; } - /** Returns the {@link DomainSuffix} corresponding to the - * last public part of the hostname + /** + * Returns the {@link DomainSuffix} corresponding to the last public part of + * the hostname */ - public static DomainSuffix getDomainSuffix(String url) throws MalformedURLException { + public static DomainSuffix getDomainSuffix(String url) + throws MalformedURLException { return getDomainSuffix(new URL(url)); } - /** Partitions of the hostname of the url by "." */ + /** Partitions of the hostname of the url by "." */ public static String[] getHostBatches(URL url) { String host = url.getHost(); - //return whole hostname, if it is an ipv4 - //TODO : handle ipv6 - if(IP_PATTERN.matcher(host).matches()) - return new String[] {host}; + // return whole hostname, if it is an ipv4 + // TODO : handle ipv6 + if (IP_PATTERN.matcher(host).matches()) + return new String[] { host }; return host.split("\\."); } - /** Partitions of the hostname of the url by "." - * @throws MalformedURLException */ - public static String[] getHostBatches(String url) throws MalformedURLException { - return getHostBatches(new URL(url)); + /** + * Partitions of the hostname of the url by "." + * + * @throws MalformedURLException + */ + public static String[] getHostBatches(String url) + throws MalformedURLException { + return getHostBatches(new URL(url)); } /** - * <p>Given two urls, a src and a destination of a redirect, it returns the - * representative url.<p> + * <p> + * Given two urls, a src and a destination of a redirect, it returns the + * representative url. + * <p> * - * <p>This method implements an extended version of the algorithm used by the + * <p> + * This method implements an extended version of the algorithm used by the * Yahoo! Slurp crawler described here:<br> * <a href= * "http://help.yahoo.com/l/nz/yahooxtra/search/webcrawler/slurp-11.html"> How @@ -200,46 +222,63 @@ public class URLUtil { * <br> * <ol> * <li>Choose target url if either url is malformed.</li> - * <li>If different domains the keep the destination whether or not the + * <li>If different domains the keep the destination whether or not the * redirect is temp or perm</li> - * <ul><li>a.com -> b.com*</li></ul> + * <ul> + * <li>a.com -> b.com*</li> + * </ul> * <li>If the redirect is permanent and the source is root, keep the source.</li> - * <ul><li>*a.com -> a.com?y=1 || *a.com -> a.com/xyz/index.html</li></ul> - * <li>If the redirect is permanent and the source is not root and the + * <ul> + * <li>*a.com -> a.com?y=1 || *a.com -> a.com/xyz/index.html</li> + * </ul> + * <li>If the redirect is permanent and the source is not root and the * destination is root, keep the destination</li> - * <ul><li>a.com/xyz/index.html -> a.com*</li></ul> + * <ul> + * <li>a.com/xyz/index.html -> a.com*</li> + * </ul> * <li>If the redirect is permanent and neither the source nor the destination * is root, then keep the destination</li> - * <ul><li>a.com/xyz/index.html -> a.com/abc/page.html*</li></ul> + * <ul> + * <li>a.com/xyz/index.html -> a.com/abc/page.html*</li> + * </ul> * <li>If the redirect is temporary and source is root and destination is not * root, then keep the source</li> - * <ul><li>*a.com -> a.com/xyz/index.html</li></ul> + * <ul> + * <li>*a.com -> a.com/xyz/index.html</li> + * </ul> * <li>If the redirect is temporary and source is not root and destination is * root, then keep the destination</li> - * <ul><li>a.com/xyz/index.html -> a.com*</li></ul> + * <ul> + * <li>a.com/xyz/index.html -> a.com*</li> + * </ul> * <li>If the redirect is temporary and neither the source or the destination - * is root, then keep the shortest url. First check for the shortest host, - * and if both are equal then check by path. Path is first by length then by - * the number of / path separators.</li> + * is root, then keep the shortest url. First check for the shortest host, and + * if both are equal then check by path. Path is first by length then by the + * number of / path separators.</li> * <ul> * <li>a.com/xyz/index.html -> a.com/abc/page.html*</li> * <li>*www.a.com/xyz/index.html -> www.news.a.com/xyz/index.html</li> * </ul> * <li>If the redirect is temporary and both the source and the destination * are root, then keep the shortest sub-domain</li> - * <ul><li>*www.a.com -> www.news.a.com</li></ul> + * <ul> + * <li>*www.a.com -> www.news.a.com</li> + * </ul> * <br> - * While not in this logic there is a further piece of representative url - * logic that occurs during indexing and after scoring. During creation of - * the basic fields before indexing, if a url has a representative url stored - * we check both the url and its representative url (which should never be - * the same) against their linkrank scores and the highest scoring one is - * kept as the url and the lower scoring one is held as the orig url inside - * of the index. + * While not in this logic there is a further piece of representative url + * logic that occurs during indexing and after scoring. During creation of the + * basic fields before indexing, if a url has a representative url stored we + * check both the url and its representative url (which should never be the + * same) against their linkrank scores and the highest scoring one is kept as + * the url and the lower scoring one is held as the orig url inside of the + * index. * - * @param src The source url. - * @param dst The destination url. - * @param temp Is the redirect a temporary redirect. + * @param src + * The source url. + * @param dst + * The destination url. + * @param temp + * Is the redirect a temporary redirect. * * @return String The representative url. */ @@ -251,8 +290,7 @@ public class URLUtil { try { srcUrl = new URL(src); dstUrl = new URL(dst); - } - catch (MalformedURLException e) { + } catch (MalformedURLException e) { return dst; } @@ -270,27 +308,27 @@ public class URLUtil { // 1) different domain them keep dest, temp or perm // a.com -> b.com* - // + // // 2) permanent and root, keep src // *a.com -> a.com?y=1 || *a.com -> a.com/xyz/index.html - // + // // 3) permanent and not root and dest root, keep dest // a.com/xyz/index.html -> a.com* - // + // // 4) permanent and neither root keep dest // a.com/xyz/index.html -> a.com/abc/page.html* - // + // // 5) temp and root and dest not root keep src // *a.com -> a.com/xyz/index.html - // + // // 7) temp and not root and dest root keep dest // a.com/xyz/index.html -> a.com* - // + // // 8) temp and neither root, keep shortest, if hosts equal by path else by // hosts. paths are first by length then by number of / separators // a.com/xyz/index.html -> a.com/abc/page.html* // *www.a.com/xyz/index.html -> www.news.a.com/xyz/index.html - // + // // 9) temp and both root keep shortest sub domain // *www.a.com -> www.news.a.com @@ -302,39 +340,33 @@ public class URLUtil { // if it is a permanent redirect if (!temp) { - + // if source is root return source, otherwise destination if (srcRoot) { return src; - } - else { + } else { return dst; } - } - else { // temporary redirect + } else { // temporary redirect // source root and destination not root if (srcRoot && !destRoot) { return src; - } - else if (!srcRoot && destRoot) { // destination root and source not + } else if (!srcRoot && destRoot) { // destination root and source not return dst; - } - else if (!srcRoot && !destRoot && (srcHost.equals(dstHost))) { + } else if (!srcRoot && !destRoot && (srcHost.equals(dstHost))) { // source and destination hosts are the same, check paths, host length int numSrcPaths = srcFile.split("/").length; int numDstPaths = dstFile.split("/").length; if (numSrcPaths != numDstPaths) { return (numDstPaths < numSrcPaths ? dst : src); - } - else { + } else { int srcPathLength = srcFile.length(); int dstPathLength = dstFile.length(); return (dstPathLength < srcPathLength ? dst : src); } - } - else { + } else { // different host names and both root take the shortest int numSrcSubs = srcHost.split("\\.").length; @@ -348,24 +380,25 @@ public class URLUtil { * Returns the lowercased hostname for the url or null if the url is not well * formed. * - * @param url The url to check. + * @param url + * The url to check. * @return String The hostname for the url. */ public static String getHost(String url) { try { return new URL(url).getHost().toLowerCase(); - } - catch (MalformedURLException e) { + } catch (MalformedURLException e) { return null; } } /** - * Returns the page for the url. The page consists of the protocol, host, - * and path, but does not include the query string. The host is lowercased - * but the path is not. + * Returns the page for the url. The page consists of the protocol, host, and + * path, but does not include the query string. The host is lowercased but the + * path is not. * - * @param url The url to check. + * @param url + * The url to check. * @return String The page for the url. */ public static String getPage(String url) { @@ -374,12 +407,11 @@ public class URLUtil { url = url.toLowerCase(); String queryStr = new URL(url).getQuery(); return (queryStr != null) ? url.replace("?" + queryStr, "") : url; - } - catch (MalformedURLException e) { + } catch (MalformedURLException e) { return null; } } - + public static String toASCII(String url) { try { URL u = new URL(url); @@ -389,17 +421,11 @@ public class URLUtil { // also do not add additional slashes for file: URLs (NUTCH-1880) return url; } - URI p = new URI(u.getProtocol(), - u.getUserInfo(), - IDN.toASCII(host), - u.getPort(), - u.getPath(), - u.getQuery(), - u.getRef()); + URI p = new URI(u.getProtocol(), u.getUserInfo(), IDN.toASCII(host), + u.getPort(), u.getPath(), u.getQuery(), u.getRef()); return p.toString(); - } - catch (Exception e) { + } catch (Exception e) { return null; } } @@ -432,26 +458,23 @@ public class URLUtil { } return sb.toString(); - } - catch (Exception e) { + } catch (Exception e) { return null; } } - /** For testing */ - public static void main(String[] args){ - - if(args.length!=1) { + public static void main(String[] args) { + + if (args.length != 1) { System.err.println("Usage : URLUtil <url>"); - return ; + return; } - + String url = args[0]; try { System.out.println(URLUtil.getDomainName(new URL(url))); - } - catch (MalformedURLException ex) { + } catch (MalformedURLException ex) { ex.printStackTrace(); } } Modified: nutch/branches/2.x/src/java/org/apache/nutch/util/WebPageWritable.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/util/WebPageWritable.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/util/WebPageWritable.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/util/WebPageWritable.java Fri Jan 9 06:34:33 2015 @@ -26,8 +26,7 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; -public class WebPageWritable extends Configured -implements Writable { +public class WebPageWritable extends Configured implements Writable { private WebPage webPage; @@ -53,7 +52,7 @@ implements Writable { public WebPage getWebPage() { return webPage; } - + public void setWebPage(WebPage webPage) { this.webPage = webPage; } Modified: nutch/branches/2.x/src/java/org/apache/nutch/util/domain/DomainStatistics.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/util/domain/DomainStatistics.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/util/domain/DomainStatistics.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/util/domain/DomainStatistics.java Fri Jan 9 06:34:33 2015 @@ -71,7 +71,8 @@ public class DomainStatistics extends Co public int run(String[] args) throws IOException, ClassNotFoundException, InterruptedException { if (args.length < 2) { - System.out.println("usage: DomainStatistics outDir host|domain|suffix [-numReducers n] [-crawlId <id>]"); + System.out + .println("usage: DomainStatistics outDir host|domain|suffix [-numReducers n] [-crawlId <id>]"); return 1; } String outputDir = args[0]; @@ -193,9 +194,8 @@ public class DomainStatistics extends Co } @Override - protected void map( - String key, WebPage value, Context context) - throws IOException, InterruptedException { + protected void map(String key, WebPage value, Context context) + throws IOException, InterruptedException { if (value.getStatus() == CrawlStatus.STATUS_FETCHED) { try { URL url = new URL(TableUtil.unreverseUrl(key.toString())); Modified: nutch/branches/2.x/src/java/org/apache/nutch/util/domain/DomainSuffix.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/util/domain/DomainSuffix.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/util/domain/DomainSuffix.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/util/domain/DomainSuffix.java Fri Jan 9 06:34:33 2015 @@ -18,17 +18,18 @@ package org.apache.nutch.util.domain; /** - * This class represents the last part of the host name, - * which is operated by authoritives, not individuals. This information - * is needed to find the domain name of a host. The domain name of a host - * is defined to be the last part before the domain suffix, w/o subdomain - * names. As an example the domain name of <br><code> http://lucene.apache.org/ - * </code><br> is <code> apache.org</code> - * <br> - * This class holds three fields, - * <strong>domain</strong> field represents the suffix (such as "co.uk") - * <strong>boost</strong> is a float for boosting score of url's with this suffix - * <strong>status</strong> field represents domain's status + * This class represents the last part of the host name, which is operated by + * authoritives, not individuals. This information is needed to find the domain + * name of a host. The domain name of a host is defined to be the last part + * before the domain suffix, w/o subdomain names. As an example the domain name + * of <br> + * <code> http://lucene.apache.org/ + * </code><br> + * is <code> apache.org</code> <br> + * This class holds three fields, <strong>domain</strong> field represents the + * suffix (such as "co.uk") <strong>boost</strong> is a float for boosting score + * of url's with this suffix <strong>status</strong> field represents domain's + * status * * @author Enis Soztutar <[email protected]> * @see TopLevelDomain @@ -37,10 +38,10 @@ package org.apache.nutch.util.domain; public class DomainSuffix { /** - * Enumeration of the status of the tld. Please see domain-suffixes.xml. + * Enumeration of the status of the tld. Please see domain-suffixes.xml. */ - public enum Status { INFRASTRUCTURE, SPONSORED, UNSPONSORED - , STARTUP, PROPOSED, DELETED, PSEUDO_DOMAIN, DEPRECATED, IN_USE, NOT_IN_USE, REJECTED + public enum Status { + INFRASTRUCTURE, SPONSORED, UNSPONSORED, STARTUP, PROPOSED, DELETED, PSEUDO_DOMAIN, DEPRECATED, IN_USE, NOT_IN_USE, REJECTED }; private String domain; @@ -49,7 +50,7 @@ public class DomainSuffix { public static final float DEFAULT_BOOST = 1.0f; public static final Status DEFAULT_STATUS = Status.IN_USE; - + public DomainSuffix(String domain, Status status, float boost) { this.domain = domain; this.status = status; @@ -59,7 +60,7 @@ public class DomainSuffix { public DomainSuffix(String domain) { this(domain, DEFAULT_STATUS, DEFAULT_BOOST); } - + public String getDomain() { return domain; } @@ -71,7 +72,7 @@ public class DomainSuffix { public float getBoost() { return boost; } - + @Override public String toString() { return domain; Modified: nutch/branches/2.x/src/java/org/apache/nutch/util/domain/DomainSuffixes.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/util/domain/DomainSuffixes.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/util/domain/DomainSuffixes.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/util/domain/DomainSuffixes.java Fri Jan 9 06:34:33 2015 @@ -25,57 +25,62 @@ import org.slf4j.LoggerFactory; import org.apache.hadoop.util.StringUtils; /** - * Storage class for <code>DomainSuffix</code> objects - * Note: this class is singleton + * Storage class for <code>DomainSuffix</code> objects Note: this class is + * singleton + * * @author Enis Soztutar <[email protected]> */ public class DomainSuffixes { - private static final Logger LOG = LoggerFactory.getLogger(DomainSuffixes.class); - - private HashMap<String, DomainSuffix> domains = new HashMap<String, DomainSuffix>(); - + private static final Logger LOG = LoggerFactory + .getLogger(DomainSuffixes.class); + + private HashMap<String, DomainSuffix> domains = new HashMap<String, DomainSuffix>(); + private static DomainSuffixes instance; - + /** private ctor */ private DomainSuffixes() { String file = "domain-suffixes.xml"; - InputStream input = this.getClass().getClassLoader().getResourceAsStream(file); + InputStream input = this.getClass().getClassLoader() + .getResourceAsStream(file); try { new DomainSuffixesReader().read(this, input); - } - catch (Exception ex) { + } catch (Exception ex) { LOG.warn(StringUtils.stringifyException(ex)); } } - + /** * Singleton instance, lazy instantination + * * @return */ public static DomainSuffixes getInstance() { - if(instance == null) { + if (instance == null) { instance = new DomainSuffixes(); } return instance; } - + void addDomainSuffix(DomainSuffix tld) { domains.put(tld.getDomain(), tld); } /** return whether the extension is a registered domain entry */ public boolean isDomainSuffix(String extension) { - return domains.containsKey(extension); + return domains.containsKey(extension); } - + /** - * Return the {@link DomainSuffix} object for the extension, if - * extension is a top level domain returned object will be an - * instance of {@link TopLevelDomain} - * @param extension of the domain + * Return the {@link DomainSuffix} object for the extension, if extension is a + * top level domain returned object will be an instance of + * {@link TopLevelDomain} + * + * @param extension + * of the domain */ public DomainSuffix get(String extension) { return domains.get(extension); } - + } Modified: nutch/branches/2.x/src/java/org/apache/nutch/util/domain/DomainSuffixesReader.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/util/domain/DomainSuffixesReader.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/util/domain/DomainSuffixesReader.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/util/domain/DomainSuffixesReader.java Fri Jan 9 06:34:33 2015 @@ -36,16 +36,17 @@ import org.xml.sax.InputSource; import org.xml.sax.SAXException; /** - * For parsing xml files containing domain suffix definitions. - * Parsed xml files should validate against - * <code>domain-suffixes.xsd</code> + * For parsing xml files containing domain suffix definitions. Parsed xml files + * should validate against <code>domain-suffixes.xsd</code> + * * @author Enis Soztutar <[email protected]> */ class DomainSuffixesReader { - private static final Logger LOG = LoggerFactory.getLogger(DomainSuffixesReader.class); + private static final Logger LOG = LoggerFactory + .getLogger(DomainSuffixesReader.class); - void read(DomainSuffixes tldEntries, InputStream input) throws IOException{ + void read(DomainSuffixes tldEntries, InputStream input) throws IOException { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); @@ -54,28 +55,29 @@ class DomainSuffixesReader { Document document = builder.parse(new InputSource(input)); Element root = document.getDocumentElement(); - - if(root != null && root.getTagName().equals("domains")) { - - Element tlds = (Element)root.getElementsByTagName("tlds").item(0); - Element suffixes = (Element)root.getElementsByTagName("suffixes").item(0); - - //read tlds - readITLDs(tldEntries, (Element)tlds.getElementsByTagName("itlds").item(0)); - readGTLDs(tldEntries, (Element)tlds.getElementsByTagName("gtlds").item(0)); - readCCTLDs(tldEntries, (Element)tlds.getElementsByTagName("cctlds").item(0)); - + + if (root != null && root.getTagName().equals("domains")) { + + Element tlds = (Element) root.getElementsByTagName("tlds").item(0); + Element suffixes = (Element) root.getElementsByTagName("suffixes") + .item(0); + + // read tlds + readITLDs(tldEntries, (Element) tlds.getElementsByTagName("itlds") + .item(0)); + readGTLDs(tldEntries, (Element) tlds.getElementsByTagName("gtlds") + .item(0)); + readCCTLDs(tldEntries, (Element) tlds.getElementsByTagName("cctlds") + .item(0)); + readSuffixes(tldEntries, suffixes); - } - else { + } else { throw new IOException("xml file is not valid"); } - } - catch (ParserConfigurationException ex) { + } catch (ParserConfigurationException ex) { LOG.warn(StringUtils.stringifyException(ex)); throw new IOException(ex.getMessage()); - } - catch (SAXException ex) { + } catch (SAXException ex) { LOG.warn(StringUtils.stringifyException(ex)); throw new IOException(ex.getMessage()); } @@ -83,22 +85,24 @@ class DomainSuffixesReader { void readITLDs(DomainSuffixes tldEntries, Element el) { NodeList children = el.getElementsByTagName("tld"); - for(int i=0;i<children.getLength();i++) { - tldEntries.addDomainSuffix(readGTLD((Element)children.item(i), Type.INFRASTRUCTURE)); + for (int i = 0; i < children.getLength(); i++) { + tldEntries.addDomainSuffix(readGTLD((Element) children.item(i), + Type.INFRASTRUCTURE)); } } - + void readGTLDs(DomainSuffixes tldEntries, Element el) { NodeList children = el.getElementsByTagName("tld"); - for(int i=0;i<children.getLength();i++) { - tldEntries.addDomainSuffix(readGTLD((Element)children.item(i), Type.GENERIC)); + for (int i = 0; i < children.getLength(); i++) { + tldEntries.addDomainSuffix(readGTLD((Element) children.item(i), + Type.GENERIC)); } } void readCCTLDs(DomainSuffixes tldEntries, Element el) throws IOException { NodeList children = el.getElementsByTagName("tld"); - for(int i=0;i<children.getLength();i++) { - tldEntries.addDomainSuffix(readCCTLD((Element)children.item(i))); + for (int i = 0; i < children.getLength(); i++) { + tldEntries.addDomainSuffix(readCCTLD((Element) children.item(i))); } } @@ -113,39 +117,40 @@ class DomainSuffixesReader { String domain = el.getAttribute("domain"); Status status = readStatus(el); float boost = readBoost(el); - String countryName = readCountryName(el); - return new TopLevelDomain(domain, status, boost, countryName); + String countryName = readCountryName(el); + return new TopLevelDomain(domain, status, boost, countryName); } - + /** read optional field status */ Status readStatus(Element el) { NodeList list = el.getElementsByTagName("status"); - if(list == null || list.getLength() == 0) + if (list == null || list.getLength() == 0) return DomainSuffix.DEFAULT_STATUS; return Status.valueOf(list.item(0).getFirstChild().getNodeValue()); } - + /** read optional field boost */ float readBoost(Element el) { NodeList list = el.getElementsByTagName("boost"); - if(list == null || list.getLength() == 0) + if (list == null || list.getLength() == 0) return DomainSuffix.DEFAULT_BOOST; return Float.parseFloat(list.item(0).getFirstChild().getNodeValue()); } - - /** read field countryname - */ + + /** + * read field countryname + */ String readCountryName(Element el) throws IOException { NodeList list = el.getElementsByTagName("country"); - if(list == null || list.getLength() == 0) + if (list == null || list.getLength() == 0) throw new IOException("Country name should be given"); return list.item(0).getNodeValue(); } - + void readSuffixes(DomainSuffixes tldEntries, Element el) { NodeList children = el.getElementsByTagName("suffix"); - for(int i=0;i<children.getLength();i++) { - tldEntries.addDomainSuffix(readSuffix((Element)children.item(i))); + for (int i = 0; i < children.getLength(); i++) { + tldEntries.addDomainSuffix(readSuffix((Element) children.item(i))); } } @@ -155,5 +160,5 @@ class DomainSuffixesReader { float boost = readBoost(el); return new DomainSuffix(domain, status, boost); } - + } Modified: nutch/branches/2.x/src/java/org/apache/nutch/util/domain/TopLevelDomain.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/util/domain/TopLevelDomain.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/util/domain/TopLevelDomain.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/util/domain/TopLevelDomain.java Fri Jan 9 06:34:33 2015 @@ -18,41 +18,47 @@ package org.apache.nutch.util.domain; /** - * (From wikipedia) A top-level domain (TLD) is the last part of an - * Internet domain name; that is, the letters which follow the final - * dot of any domain name. For example, in the domain name - * <code>www.website.com</code>, the top-level domain is <code>com</code>. + * (From wikipedia) A top-level domain (TLD) is the last part of an Internet + * domain name; that is, the letters which follow the final dot of any domain + * name. For example, in the domain name <code>www.website.com</code>, the + * top-level domain is <code>com</code>. + * * @author Enis Soztutar <[email protected]> * @see http://www.iana.org/ * @see http://en.wikipedia.org/wiki/Top-level_domain */ public class TopLevelDomain extends DomainSuffix { - public enum Type { INFRASTRUCTURE, GENERIC, COUNTRY }; - + public enum Type { + INFRASTRUCTURE, GENERIC, COUNTRY + }; + private Type type; private String countryName = null; - - public TopLevelDomain(String domain, Type type, Status status, float boost){ + + public TopLevelDomain(String domain, Type type, Status status, float boost) { super(domain, status, boost); this.type = type; } - public TopLevelDomain(String domain, Status status, float boost, String countryName){ + public TopLevelDomain(String domain, Status status, float boost, + String countryName) { super(domain, status, boost); this.type = Type.COUNTRY; this.countryName = countryName; } - + public Type getType() { return type; } - /** Returns the country name if TLD is Country Code TLD + /** + * Returns the country name if TLD is Country Code TLD + * * @return country name or null - */ - public String getCountryName(){ + */ + public String getCountryName() { return countryName; } - + } Modified: nutch/branches/2.x/src/java/org/apache/nutch/util/package-info.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/util/package-info.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/util/package-info.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/util/package-info.java Fri Jan 9 06:34:33 2015 @@ -19,3 +19,4 @@ * Miscellaneous utility classes. */ package org.apache.nutch.util; + Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/NutchUiApplication.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/NutchUiApplication.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/NutchUiApplication.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/NutchUiApplication.java Fri Jan 9 06:34:33 2015 @@ -34,7 +34,8 @@ import de.agilecoders.wicket.core.settin import de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesomeCssReference; @Component -public class NutchUiApplication extends WebApplication implements ApplicationContextAware { +public class NutchUiApplication extends WebApplication implements + ApplicationContextAware { private static final String THEME_NAME = "bootstrap"; private ApplicationContext context; @@ -56,7 +57,8 @@ public class NutchUiApplication extends Bootstrap.install(this, settings); configureTheme(settings); - getComponentInstantiationListeners().add(new SpringComponentInjector(this, context)); + getComponentInstantiationListeners().add( + new SpringComponentInjector(this, context)); } private void configureTheme(BootstrapSettings settings) { @@ -66,7 +68,8 @@ public class NutchUiApplication extends } @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + public void setApplicationContext(ApplicationContext applicationContext) + throws BeansException { this.context = applicationContext; } } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/NutchUiServer.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/NutchUiServer.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/NutchUiServer.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/NutchUiServer.java Fri Jan 9 06:34:33 2015 @@ -50,7 +50,7 @@ public class NutchUiServer { HelpFormatter formatter = new HelpFormatter(); try { commandLine = parser.parse(options, args); - } catch (Exception e) { + } catch (Exception e) { formatter.printHelp("NutchUiServer", options, true); StringUtils.stringifyException(e); } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/client/NutchClient.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/client/NutchClient.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/client/NutchClient.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/client/NutchClient.java Fri Jan 9 06:34:33 2015 @@ -36,7 +36,7 @@ public interface NutchClient { public String executeJob(JobConfig jobConfig); public JobInfo getJobInfo(String jobId); - + public Map<String, String> getNutchConfig(String config); /** Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/client/NutchClientFactory.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/client/NutchClientFactory.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/client/NutchClientFactory.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/client/NutchClientFactory.java Fri Jan 9 06:34:33 2015 @@ -42,7 +42,8 @@ public class NutchClientFactory { } } - private static class NutchClientCacheLoader extends CacheLoader<NutchInstance, NutchClient> { + private static class NutchClientCacheLoader extends + CacheLoader<NutchInstance, NutchClient> { @Override public NutchClient load(NutchInstance key) throws Exception { return new NutchClientImpl(key); Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/CrawlingCycle.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/CrawlingCycle.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/CrawlingCycle.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/CrawlingCycle.java Fri Jan 9 06:34:33 2015 @@ -43,8 +43,8 @@ public class CrawlingCycle { private List<RemoteCommand> remoteCommands; private List<RemoteCommand> executedCommands = Lists.newArrayList(); - public CrawlingCycle(CrawlingCycleListener listener, RemoteCommandExecutor executor, Crawl crawl, - List<RemoteCommand> commands) { + public CrawlingCycle(CrawlingCycleListener listener, + RemoteCommandExecutor executor, Crawl crawl, List<RemoteCommand> commands) { this.listener = listener; this.executor = executor; this.crawl = crawl; @@ -64,7 +64,7 @@ public class CrawlingCycle { listener.onCrawlError(crawl, jobInfo.getMsg()); return; } - + executedCommands.add(command); listener.commandExecuted(crawl, command, calculateProgress()); } @@ -75,7 +75,8 @@ public class CrawlingCycle { if (CollectionUtils.isEmpty(remoteCommands)) { return 0; } - return (int) ((float) executedCommands.size() / (float) remoteCommands.size() * 100); + return (int) ((float) executedCommands.size() + / (float) remoteCommands.size() * 100); } } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/NutchClientImpl.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/NutchClientImpl.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/NutchClientImpl.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/NutchClientImpl.java Fri Jan 9 06:34:33 2015 @@ -46,14 +46,16 @@ public class NutchClientImpl implements public void createClient() { ClientConfig clientConfig = new DefaultClientConfig(); - clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, true); + clientConfig.getFeatures() + .put(JSONConfiguration.FEATURE_POJO_MAPPING, true); this.client = Client.create(clientConfig); this.nutchResource = client.resource(instance.getUrl()); } @Override public NutchStatus getNutchStatus() { - return nutchResource.path("/admin").type(APPLICATION_JSON).get(NutchStatus.class); + return nutchResource.path("/admin").type(APPLICATION_JSON) + .get(NutchStatus.class); } @Override @@ -66,12 +68,14 @@ public class NutchClientImpl implements @Override public String executeJob(JobConfig jobConfig) { - return nutchResource.path("/job/create").type(APPLICATION_JSON).post(String.class, jobConfig); + return nutchResource.path("/job/create").type(APPLICATION_JSON) + .post(String.class, jobConfig); } @Override public JobInfo getJobInfo(String jobId) { - return nutchResource.path("/job/" + jobId).type(APPLICATION_JSON).get(JobInfo.class); + return nutchResource.path("/job/" + jobId).type(APPLICATION_JSON) + .get(JobInfo.class); } @Override @@ -82,11 +86,13 @@ public class NutchClientImpl implements @SuppressWarnings("unchecked") @Override public Map<String, String> getNutchConfig(String config) { - return nutchResource.path("/config/" + config).type(APPLICATION_JSON).get(Map.class); + return nutchResource.path("/config/" + config).type(APPLICATION_JSON) + .get(Map.class); } - + @Override public String createSeed(SeedList seedList) { - return nutchResource.path("/seed/create").type(APPLICATION_JSON).post(String.class, seedList); + return nutchResource.path("/seed/create").type(APPLICATION_JSON) + .post(String.class, seedList); } } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/RemoteCommand.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/RemoteCommand.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/RemoteCommand.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/RemoteCommand.java Fri Jan 9 06:34:33 2015 @@ -70,6 +70,7 @@ public class RemoteCommand implements Se if (jobInfo != null) { statusInfo = MessageFormat.format("{0}", jobInfo.getState()); } - return MessageFormat.format("{0} status: {1}", jobConfig.getType(), statusInfo); + return MessageFormat.format("{0} status: {1}", jobConfig.getType(), + statusInfo); } } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/RemoteCommandBuilder.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/RemoteCommandBuilder.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/RemoteCommandBuilder.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/RemoteCommandBuilder.java Fri Jan 9 06:34:33 2015 @@ -40,10 +40,12 @@ public class RemoteCommandBuilder { jobConfig.setConfId(configId); return this; } + public RemoteCommandBuilder withCrawlId(String crawlId) { jobConfig.setCrawlId(crawlId); return this; } + public RemoteCommandBuilder withArgument(String key, String value) { jobConfig.setArgument(key, value); return this; Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/RemoteCommandExecutor.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/RemoteCommandExecutor.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/RemoteCommandExecutor.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/RemoteCommandExecutor.java Fri Jan 9 06:34:33 2015 @@ -56,7 +56,8 @@ public class RemoteCommandExecutor { public JobInfo executeRemoteJob(RemoteCommand command) { try { String jobId = client.executeJob(command.getJobConfig()); - Future<JobInfo> chekerFuture = executor.submit(new JobStateChecker(jobId)); + Future<JobInfo> chekerFuture = executor + .submit(new JobStateChecker(jobId)); return chekerFuture.get(getTimeout(command), TimeUnit.MILLISECONDS); } catch (Exception e) { log.error("Remote command failed", e); Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/RemoteCommandsBatchFactory.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/RemoteCommandsBatchFactory.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/RemoteCommandsBatchFactory.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/client/impl/RemoteCommandsBatchFactory.java Fri Jan 9 06:34:33 2015 @@ -62,8 +62,9 @@ public class RemoteCommandsBatchFactory } private RemoteCommand inject() { - RemoteCommandBuilder builder = RemoteCommandBuilder.instance(JobType.INJECT) - .withCrawlId(crawl.getCrawlId()).withArgument("seedDir", crawl.getSeedDirectory()); + RemoteCommandBuilder builder = RemoteCommandBuilder + .instance(JobType.INJECT).withCrawlId(crawl.getCrawlId()) + .withArgument("seedDir", crawl.getSeedDirectory()); return builder.build(); } @@ -72,7 +73,8 @@ public class RemoteCommandsBatchFactory } private RemoteCommand createFetchCommand() { - return createBuilder(JobType.FETCH).withTimeout(Duration.standardSeconds(50)).build(); + return createBuilder(JobType.FETCH).withTimeout( + Duration.standardSeconds(50)).build(); } private RemoteCommand createParseCommand() { @@ -88,8 +90,8 @@ public class RemoteCommandsBatchFactory } private RemoteCommandBuilder createBuilder(JobType jobType) { - return RemoteCommandBuilder.instance(jobType).withCrawlId(crawl.getCrawlId()) - .withArgument("batch", batchId); + return RemoteCommandBuilder.instance(jobType) + .withCrawlId(crawl.getCrawlId()).withArgument("batch", batchId); } } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/client/model/JobConfig.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/client/model/JobConfig.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/client/model/JobConfig.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/client/model/JobConfig.java Fri Jan 9 06:34:33 2015 @@ -34,7 +34,7 @@ public class JobConfig implements Serial public void setArgument(String key, String value) { args.put(key, value); } - + public String getCrawlId() { return crawlId; } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/client/model/NutchStatus.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/client/model/NutchStatus.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/client/model/NutchStatus.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/client/model/NutchStatus.java Fri Jan 9 06:34:33 2015 @@ -22,7 +22,7 @@ import java.util.Date; import java.util.Set; public class NutchStatus implements Serializable { - + private Date startDate; private Set<String> configuration; private Collection<JobInfo> jobs; Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/config/CustomDaoFactory.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/config/CustomDaoFactory.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/config/CustomDaoFactory.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/config/CustomDaoFactory.java Fri Jan 9 06:34:33 2015 @@ -27,7 +27,8 @@ import com.j256.ormlite.support.Connecti public class CustomDaoFactory { private ConnectionSource connectionSource; - private List<Dao<?, ?>> registredDaos = Collections.synchronizedList(new ArrayList<Dao<?, ?>>()); + private List<Dao<?, ?>> registredDaos = Collections + .synchronizedList(new ArrayList<Dao<?, ?>>()); public CustomDaoFactory(ConnectionSource connectionSource) { this.connectionSource = connectionSource; Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/config/CustomTableCreator.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/config/CustomTableCreator.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/config/CustomTableCreator.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/config/CustomTableCreator.java Fri Jan 9 06:34:33 2015 @@ -30,7 +30,8 @@ public class CustomTableCreator { private ConnectionSource connectionSource; private List<Dao<?, ?>> configuredDaos; - public CustomTableCreator(ConnectionSource connectionSource, List<Dao<?, ?>> configuredDaos) { + public CustomTableCreator(ConnectionSource connectionSource, + List<Dao<?, ?>> configuredDaos) { this.connectionSource = connectionSource; this.configuredDaos = configuredDaos; initialize(); @@ -38,7 +39,8 @@ public class CustomTableCreator { private void initialize() { if (configuredDaos == null) { - throw new IllegalStateException("configuredDaos was not set in " + getClass().getSimpleName()); + throw new IllegalStateException("configuredDaos was not set in " + + getClass().getSimpleName()); } for (Dao<?, ?> dao : configuredDaos) { Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/config/SpringConfiguration.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/config/SpringConfiguration.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/config/SpringConfiguration.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/config/SpringConfiguration.java Fri Jan 9 06:34:33 2015 @@ -51,8 +51,8 @@ public class SpringConfiguration impleme @Bean public JdbcConnectionSource getConnectionSource() throws SQLException { - JdbcConnectionSource source = new JdbcConnectionSource("jdbc:h2:~/.nutch/config", - new H2DatabaseType()); + JdbcConnectionSource source = new JdbcConnectionSource( + "jdbc:h2:~/.nutch/config", new H2DatabaseType()); source.initialize(); return source; } @@ -84,7 +84,8 @@ public class SpringConfiguration impleme @Bean public CustomTableCreator createTableCreator() throws SQLException { - return new CustomTableCreator(getConnectionSource(), getDaoFactory().getCreatedDaos()); + return new CustomTableCreator(getConnectionSource(), getDaoFactory() + .getCreatedDaos()); } } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/model/NutchConfig.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/model/NutchConfig.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/model/NutchConfig.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/model/NutchConfig.java Fri Jan 9 06:34:33 2015 @@ -3,16 +3,19 @@ package org.apache.nutch.webui.model; public class NutchConfig { private String name = "name"; private String value; - - public void setName (String name){ + + public void setName(String name) { this.name = name; } - public String getName(){ + + public String getName() { return this.name; } + public String getValue() { return value; } + public void setValue(String value) { this.value = value; } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/model/SeedUrl.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/model/SeedUrl.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/model/SeedUrl.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/model/SeedUrl.java Fri Jan 9 06:34:33 2015 @@ -57,7 +57,7 @@ public class SeedUrl implements Serializ public void setUrl(String url) { this.url = url; } - + @JsonIgnore public SeedList getSeedList() { return seedList; Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/AbstractBasePage.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/AbstractBasePage.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/AbstractBasePage.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/AbstractBasePage.java Fri Jan 9 06:34:33 2015 @@ -74,16 +74,25 @@ public abstract class AbstractBasePage<T navbar.setPosition(Position.TOP); add(navbar); - addMenuItem(DashboardPage.class, "navbar.menu.dashboard", FontAwesomeIconType.dashboard); - addMenuItem(StatisticsPage.class, "navbar.menu.statistics", FontAwesomeIconType.bar_chart_o); - addMenuItem(InstancesPage.class, "navbar.menu.instances", FontAwesomeIconType.gears); - addMenuItem(SettingsPage.class, "navbar.menu.settings", FontAwesomeIconType.wrench); - addMenuItem(CrawlsPage.class, "navbar.menu.crawls", FontAwesomeIconType.refresh); - addMenuItem(SchedulingPage.class, "navbar.menu.scheduling", FontAwesomeIconType.clock_o); - addMenuItem(SearchPage.class, "navbar.menu.search", FontAwesomeIconType.search); - addMenuItem(SeedListsPage.class, "navbar.menu.seedLists", FontAwesomeIconType.file); + addMenuItem(DashboardPage.class, "navbar.menu.dashboard", + FontAwesomeIconType.dashboard); + addMenuItem(StatisticsPage.class, "navbar.menu.statistics", + FontAwesomeIconType.bar_chart_o); + addMenuItem(InstancesPage.class, "navbar.menu.instances", + FontAwesomeIconType.gears); + addMenuItem(SettingsPage.class, "navbar.menu.settings", + FontAwesomeIconType.wrench); + addMenuItem(CrawlsPage.class, "navbar.menu.crawls", + FontAwesomeIconType.refresh); + addMenuItem(SchedulingPage.class, "navbar.menu.scheduling", + FontAwesomeIconType.clock_o); + addMenuItem(SearchPage.class, "navbar.menu.search", + FontAwesomeIconType.search); + addMenuItem(SeedListsPage.class, "navbar.menu.seedLists", + FontAwesomeIconType.file); - navbar.addComponents(transform(ComponentPosition.RIGHT, addInstancesMenuMenu())); + navbar.addComponents(transform(ComponentPosition.RIGHT, + addInstancesMenuMenu())); navbar.addComponents(transform(ComponentPosition.RIGHT, addUserMenu())); add(new NotificationPanel("globalNotificationPanel")); @@ -99,11 +108,13 @@ public abstract class AbstractBasePage<T @Override protected List<AbstractLink> newSubMenuButtons(final String buttonMarkupId) { List<AbstractLink> subMenu = Lists.newArrayList(); - subMenu.add(new MenuBookmarkablePageLink<Void>(UserSettingsPage.class, new ResourceModel( - "navbar.userMenu.settings")).setIconType(FontAwesomeIconType.gear)); + subMenu.add(new MenuBookmarkablePageLink<Void>(UserSettingsPage.class, + new ResourceModel("navbar.userMenu.settings")) + .setIconType(FontAwesomeIconType.gear)); subMenu.add(new MenuDivider()); - subMenu.add(new MenuBookmarkablePageLink<Void>(LogOutPage.class, new ResourceModel( - "navbar.userMenu.logout")).setIconType(FontAwesomeIconType.power_off)); + subMenu.add(new MenuBookmarkablePageLink<Void>(LogOutPage.class, + new ResourceModel("navbar.userMenu.logout")) + .setIconType(FontAwesomeIconType.power_off)); return subMenu; } }.setIconType(FontAwesomeIconType.user); @@ -119,7 +130,8 @@ public abstract class AbstractBasePage<T List<NutchInstance> instances = instanceService.getInstances(); List<AbstractLink> subMenu = Lists.newArrayList(); for (NutchInstance instance : instances) { - subMenu.add(new Link<NutchInstance>(buttonMarkupId, Model.of(instance)) { + subMenu.add(new Link<NutchInstance>(buttonMarkupId, Model + .of(instance)) { @Override public void onClick() { currentInstance.setObject(getModelObject()); @@ -134,8 +146,10 @@ public abstract class AbstractBasePage<T return instancesMenu; } - private <P extends Page> void addMenuItem(Class<P> page, String label, IconType icon) { - Component button = new NavbarButton<Void>(page, Model.of(getString(label))).setIconType(icon); + private <P extends Page> void addMenuItem(Class<P> page, String label, + IconType icon) { + Component button = new NavbarButton<Void>(page, Model.of(getString(label))) + .setIconType(icon); navbar.addComponents(NavbarComponents.transform(LEFT, button)); } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/LogOutPage.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/LogOutPage.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/LogOutPage.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/LogOutPage.java Fri Jan 9 06:34:33 2015 @@ -16,6 +16,6 @@ */ package org.apache.nutch.webui.pages; -public class LogOutPage extends AbstractBasePage{ +public class LogOutPage extends AbstractBasePage { } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/SchedulingPage.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/SchedulingPage.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/SchedulingPage.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/SchedulingPage.java Fri Jan 9 06:34:33 2015 @@ -16,6 +16,6 @@ */ package org.apache.nutch.webui.pages; -public class SchedulingPage extends AbstractBasePage{ +public class SchedulingPage extends AbstractBasePage { } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/SearchPage.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/SearchPage.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/SearchPage.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/SearchPage.java Fri Jan 9 06:34:33 2015 @@ -16,6 +16,6 @@ */ package org.apache.nutch.webui.pages; -public class SearchPage extends AbstractBasePage{ +public class SearchPage extends AbstractBasePage { } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/StatisticsPage.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/StatisticsPage.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/StatisticsPage.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/StatisticsPage.java Fri Jan 9 06:34:33 2015 @@ -16,6 +16,6 @@ */ package org.apache.nutch.webui.pages; -public class StatisticsPage extends AbstractBasePage{ +public class StatisticsPage extends AbstractBasePage { } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/UrlsUploadPage.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/UrlsUploadPage.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/UrlsUploadPage.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/UrlsUploadPage.java Fri Jan 9 06:34:33 2015 @@ -16,6 +16,6 @@ */ package org.apache.nutch.webui.pages; -public class UrlsUploadPage extends AbstractBasePage{ +public class UrlsUploadPage extends AbstractBasePage { } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/UserSettingsPage.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/UserSettingsPage.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/UserSettingsPage.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/UserSettingsPage.java Fri Jan 9 06:34:33 2015 @@ -16,6 +16,6 @@ */ package org.apache.nutch.webui.pages; -public class UserSettingsPage extends AbstractBasePage{ +public class UserSettingsPage extends AbstractBasePage { } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/components/ColorEnumLabel.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/components/ColorEnumLabel.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/components/ColorEnumLabel.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/components/ColorEnumLabel.java Fri Jan 9 06:34:33 2015 @@ -63,7 +63,8 @@ public class ColorEnumLabel<E extends En } } - public static <E extends Enum<E>> ColorEnumLabelBuilder<E> getBuilder(String id) { + public static <E extends Enum<E>> ColorEnumLabelBuilder<E> getBuilder( + String id) { return new ColorEnumLabelBuilder<E>(id); } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/components/CpmIteratorAdapter.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/components/CpmIteratorAdapter.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/components/CpmIteratorAdapter.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/components/CpmIteratorAdapter.java Fri Jan 9 06:34:33 2015 @@ -21,9 +21,11 @@ import org.apache.wicket.model.CompoundP import org.apache.wicket.model.IModel; /** - * This is iterator adapter, which wraps iterable items with CompoundPropertyModel. + * This is iterator adapter, which wraps iterable items with + * CompoundPropertyModel. + * * @author feodor - * + * * @param <T> */ public class CpmIteratorAdapter<T> extends ModelIteratorAdapter<T> { Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/crawls/CrawlPanel.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/crawls/CrawlPanel.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/crawls/CrawlPanel.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/crawls/CrawlPanel.java Fri Jan 9 06:34:33 2015 @@ -65,8 +65,9 @@ public class CrawlPanel extends Modal { form.add(new TextField<String>("crawlName").setRequired(true)); form.add(new DropDownChoice<Integer>("numberOfRounds", getNumbersOfRounds())); - form.add(new DropDownChoice<SeedList>("seedList", seedListService.findAll(), - new ChoiceRenderer<SeedList>("name")).setRequired(true)); + form.add(new DropDownChoice<SeedList>("seedList", + seedListService.findAll(), new ChoiceRenderer<SeedList>("name")) + .setRequired(true)); addButton(new AjaxSubmitLink("button", form) { @Override Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/crawls/CrawlsPage.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/crawls/CrawlsPage.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/crawls/CrawlsPage.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/crawls/CrawlsPage.java Fri Jan 9 06:34:33 2015 @@ -103,7 +103,7 @@ public class CrawlsPage extends Abstract } }.add(new Label("crawlName"))); item.add(new Label("seedList.name")); - + item.add(new Label("progress")); item.add(createStatusLabel()); item.add(new Link<Crawl>("start", item.getModel()) { @@ -132,8 +132,8 @@ public class CrawlsPage extends Abstract } private EnumLabel<CrawlStatus> createStatusLabel() { - return new ColorEnumLabelBuilder<CrawlStatus>("status").withEnumColor(NEW, Default) - .withEnumColor(ERROR, Danger).withEnumColor(FINISHED, Success) - .withEnumColor(CRAWLING, Info).build(); + return new ColorEnumLabelBuilder<CrawlStatus>("status") + .withEnumColor(NEW, Default).withEnumColor(ERROR, Danger) + .withEnumColor(FINISHED, Success).withEnumColor(CRAWLING, Info).build(); } } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/instances/InstancePanel.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/instances/InstancePanel.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/instances/InstancePanel.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/instances/InstancePanel.java Fri Jan 9 06:34:33 2015 @@ -37,7 +37,8 @@ public class InstancePanel extends Modal form.add(new TextField<String>("host").setRequired(true)); form.add(new TextField<Integer>("port").setRequired(true)); form.add(new TextField<String>("username")); - form.add(new PasswordTextField("password").setResetPassword(false).setRequired(false)); + form.add(new PasswordTextField("password").setResetPassword(false) + .setRequired(false)); addButton(new AjaxSubmitLink("button", form) { @Override Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/instances/InstancesPage.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/instances/InstancesPage.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/instances/InstancesPage.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/instances/InstancesPage.java Fri Jan 9 06:34:33 2015 @@ -53,11 +53,13 @@ public class InstancesPage extends Abstr } private RefreshingView<NutchInstance> refreshingView() { - RefreshingView<NutchInstance> instances = new RefreshingView<NutchInstance>("instances") { + RefreshingView<NutchInstance> instances = new RefreshingView<NutchInstance>( + "instances") { @Override protected Iterator<IModel<NutchInstance>> getItemModels() { - return new CpmIteratorAdapter<NutchInstance>(instanceService.getInstances()); + return new CpmIteratorAdapter<NutchInstance>( + instanceService.getInstances()); } @Override @@ -72,7 +74,8 @@ public class InstancesPage extends Abstr return new AjaxLink<NutchInstance>("addInstance") { @Override public void onClick(AjaxRequestTarget target) { - instancePanel.setModel(new CompoundPropertyModel<NutchInstance>(new NutchInstance())); + instancePanel.setModel(new CompoundPropertyModel<NutchInstance>( + new NutchInstance())); target.add(instancePanel); instancePanel.appendShowDialogJavaScript(target); } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/menu/VerticalMenu.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/menu/VerticalMenu.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/menu/VerticalMenu.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/menu/VerticalMenu.java Fri Jan 9 06:34:33 2015 @@ -18,7 +18,7 @@ package org.apache.nutch.webui.pages.men import de.agilecoders.wicket.core.markup.html.bootstrap.navbar.Navbar; -public class VerticalMenu extends Navbar{ +public class VerticalMenu extends Navbar { public VerticalMenu(String componentId) { super(componentId); Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/seed/SeedListsPage.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/seed/SeedListsPage.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/seed/SeedListsPage.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/seed/SeedListsPage.java Fri Jan 9 06:34:33 2015 @@ -44,7 +44,8 @@ public class SeedListsPage extends Abstr public SeedListsPage() { - RefreshingView<SeedList> seedLists = new RefreshingView<SeedList>("seedLists") { + RefreshingView<SeedList> seedLists = new RefreshingView<SeedList>( + "seedLists") { @Override protected Iterator<IModel<SeedList>> getItemModels() { @@ -56,7 +57,8 @@ public class SeedListsPage extends Abstr PageParameters params = new PageParameters(); params.add("id", item.getModelObject().getId()); - Link<Void> edit = new BookmarkablePageLink<Void>("edit", SeedPage.class, params); + Link<Void> edit = new BookmarkablePageLink<Void>("edit", + SeedPage.class, params); edit.add(new Label("name")); item.add(edit); Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/seed/SeedPage.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/seed/SeedPage.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/seed/SeedPage.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/seed/SeedPage.java Fri Jan 9 06:34:33 2015 @@ -122,7 +122,8 @@ public class SeedPage extends AbstractBa } private void addUrlForm() { - urlForm = new Form<SeedUrl>("urlForm", CompoundPropertyModel.of(Model.of(new SeedUrl()))); + urlForm = new Form<SeedUrl>("urlForm", CompoundPropertyModel.of(Model + .of(new SeedUrl()))); urlForm.setOutputMarkupId(true); urlForm.add(new TextField<String>("url")); urlForm.add(new AjaxSubmitLink("addUrl", urlForm) { Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/settings/SettingsPage.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/settings/SettingsPage.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/settings/SettingsPage.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/pages/settings/SettingsPage.java Fri Jan 9 06:34:33 2015 @@ -26,12 +26,14 @@ public class SettingsPage extends Abstra public SettingsPage() { settingsTable = new WebMarkupContainer("settingsTable"); settingsTable.setOutputMarkupId(true); - RefreshingView<NutchConfig> nutchConfig = new RefreshingView<NutchConfig>("settings") { + RefreshingView<NutchConfig> nutchConfig = new RefreshingView<NutchConfig>( + "settings") { @Override protected Iterator<IModel<NutchConfig>> getItemModels() { return new CpmIteratorAdapter<NutchConfig>( - convertNutchConfig(nutchService.getNutchConfig(getCurrentInstance().getId()))); + convertNutchConfig(nutchService.getNutchConfig(getCurrentInstance() + .getId()))); } @Override Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/service/CrawlService.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/service/CrawlService.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/service/CrawlService.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/service/CrawlService.java Fri Jan 9 06:34:33 2015 @@ -22,7 +22,7 @@ import org.apache.nutch.webui.client.mod import org.apache.nutch.webui.model.NutchInstance; public interface CrawlService { - + public void saveCrawl(Crawl crawl); public List<Crawl> getCrawls(); Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/service/NutchService.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/service/NutchService.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/service/NutchService.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/service/NutchService.java Fri Jan 9 06:34:33 2015 @@ -24,8 +24,8 @@ import org.apache.nutch.webui.client.mod public interface NutchService { public ConnectionStatus getConnectionStatus(Long instanceId); - public Map<String, String> getNutchConfig(Long instanceId); - + public Map<String, String> getNutchConfig(Long instanceId); + public NutchStatus getNutchStatus(Long instanceId); } Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/service/impl/CrawlServiceImpl.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/service/impl/CrawlServiceImpl.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/service/impl/CrawlServiceImpl.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/service/impl/CrawlServiceImpl.java Fri Jan 9 06:34:33 2015 @@ -67,7 +67,7 @@ public class CrawlServiceImpl implements CrawlingCycle cycle = new CrawlingCycle(this, executor, crawl, commands); cycle.executeCrawlCycle(); - + } catch (Exception e) { crawl.setStatus(CrawlStatus.ERROR); saveCrawl(crawl); Modified: nutch/branches/2.x/src/java/org/apache/nutch/webui/service/impl/NutchServiceImpl.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/webui/service/impl/NutchServiceImpl.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/webui/service/impl/NutchServiceImpl.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/webui/service/impl/NutchServiceImpl.java Fri Jan 9 06:34:33 2015 @@ -36,7 +36,8 @@ import com.sun.jersey.api.client.ClientH @Service public class NutchServiceImpl implements NutchService { - private static final Logger logger = LoggerFactory.getLogger(NutchServiceImpl.class); + private static final Logger logger = LoggerFactory + .getLogger(NutchServiceImpl.class); @Resource private NutchClientFactory nutchClientFactory;
