Modified: nutch/branches/2.x/src/java/org/apache/nutch/scoring/ScoreDatum.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/scoring/ScoreDatum.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/scoring/ScoreDatum.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/scoring/ScoreDatum.java Fri Jan 9 06:34:33 2015 @@ -35,9 +35,10 @@ public class ScoreDatum implements Writa private String anchor; private int distance; private Map<String, byte[]> metaData = new HashMap<String, byte[]>(); - - public ScoreDatum() { } - + + public ScoreDatum() { + } + public ScoreDatum(float score, String url, String anchor, int depth) { this.score = score; this.url = url; @@ -52,13 +53,13 @@ public class ScoreDatum implements Writa anchor = Text.readString(in); distance = WritableUtils.readVInt(in); metaData.clear(); - + int size = WritableUtils.readVInt(in); for (int i = 0; i < size; i++) { String key = Text.readString(in); byte[] value = Bytes.readByteArray(in); metaData.put(key, value); - } + } } @Override @@ -67,30 +68,30 @@ public class ScoreDatum implements Writa Text.writeString(out, url); Text.writeString(out, anchor); WritableUtils.writeVInt(out, distance); - + WritableUtils.writeVInt(out, metaData.size()); for (Entry<String, byte[]> e : metaData.entrySet()) { Text.writeString(out, e.getKey()); Bytes.writeByteArray(out, e.getValue()); } } - + public byte[] getMeta(String key) { return metaData.get(key); } - + public void setMeta(String key, byte[] value) { metaData.put(key, value); } - + public byte[] deleteMeta(String key) { return metaData.remove(key); } - + public float getScore() { return score; } - + public void setScore(float score) { this.score = score; } @@ -98,7 +99,7 @@ public class ScoreDatum implements Writa public String getUrl() { return url; } - + public void setUrl(String url) { this.url = url; } @@ -106,7 +107,7 @@ public class ScoreDatum implements Writa public String getAnchor() { return anchor; } - + public int getDistance() { return distance; } @@ -114,8 +115,7 @@ public class ScoreDatum implements Writa @Override public String toString() { return "ScoreDatum [score=" + score + ", url=" + url + ", anchor=" + anchor - + ", distance="+distance + ", metaData=" + metaData + "]"; + + ", distance=" + distance + ", metaData=" + metaData + "]"; } - - + }
Modified: nutch/branches/2.x/src/java/org/apache/nutch/scoring/ScoringFilter.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/scoring/ScoringFilter.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/scoring/ScoringFilter.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/scoring/ScoringFilter.java Fri Jan 9 06:34:33 2015 @@ -26,11 +26,11 @@ import org.apache.nutch.storage.WebPage; /** * A contract defining behavior of scoring plugins. - * - * A scoring filter will manipulate scoring variables in CrawlDatum and - * in resulting search indexes. Filters can be chained in a specific order, - * to provide multi-stage scoring adjustments. - * + * + * A scoring filter will manipulate scoring variables in CrawlDatum and in + * resulting search indexes. Filters can be chained in a specific order, to + * provide multi-stage scoring adjustments. + * * @author Andrzej Bialecki */ public interface ScoringFilter extends Configurable, FieldPluggable { @@ -39,74 +39,101 @@ public interface ScoringFilter extends C /** * Set an initial score for newly injected pages. Note: newly injected pages - * may have no inlinks, so filter implementations may wish to set this - * score to a non-zero value, to give newly injected pages some initial - * credit. - * @param url url of the page - * @param page new page. Filters will modify it in-place. + * may have no inlinks, so filter implementations may wish to set this score + * to a non-zero value, to give newly injected pages some initial credit. + * + * @param url + * url of the page + * @param page + * new page. Filters will modify it in-place. * @throws ScoringFilterException */ - public void injectedScore(String url, WebPage page) throws ScoringFilterException; + public void injectedScore(String url, WebPage page) + throws ScoringFilterException; /** - * Set an initial score for newly discovered pages. Note: newly discovered pages - * have at least one inlink with its score contribution, so filter implementations - * may choose to set initial score to zero (unknown value), and then the inlink - * score contribution will set the "real" value of the new page. - * @param url url of the page + * Set an initial score for newly discovered pages. Note: newly discovered + * pages have at least one inlink with its score contribution, so filter + * implementations may choose to set initial score to zero (unknown value), + * and then the inlink score contribution will set the "real" value of the new + * page. + * + * @param url + * url of the page * @param page * @throws ScoringFilterException */ - public void initialScore(String url, WebPage page) throws ScoringFilterException; + public void initialScore(String url, WebPage page) + throws ScoringFilterException; /** - * This method prepares a sort value for the purpose of sorting and - * selecting top N scoring pages during fetchlist generation. - * @param url url of the page - * @param datum page row. Modifications will be persisted. - * @param initSort initial sort value, or a value from previous filters in chain + * This method prepares a sort value for the purpose of sorting and selecting + * top N scoring pages during fetchlist generation. + * + * @param url + * url of the page + * @param datum + * page row. Modifications will be persisted. + * @param initSort + * initial sort value, or a value from previous filters in chain */ - public float generatorSortValue(String url, WebPage page, float initSort) throws ScoringFilterException; + public float generatorSortValue(String url, WebPage page, float initSort) + throws ScoringFilterException; /** * Distribute score value from the current page to all its outlinked pages. - * @param fromUrl url of the source page - * @param row page row - * @param scoreData A list of {@link OutlinkedScoreDatum}s for every outlink. - * These {@link OutlinkedScoreDatum}s will be passed to - * {@link #updateScore(String, OldWebTableRow, List)} - * for every outlinked URL. - * @param allCount number of all collected outlinks from the source page + * + * @param fromUrl + * url of the source page + * @param row + * page row + * @param scoreData + * A list of {@link OutlinkedScoreDatum}s for every outlink. These + * {@link OutlinkedScoreDatum}s will be passed to + * {@link #updateScore(String, OldWebTableRow, List)} for every + * outlinked URL. + * @param allCount + * number of all collected outlinks from the source page * @throws ScoringFilterException */ - public void distributeScoreToOutlinks(String fromUrl, - WebPage page, Collection<ScoreDatum> scoreData, - int allCount) throws ScoringFilterException; + public void distributeScoreToOutlinks(String fromUrl, WebPage page, + Collection<ScoreDatum> scoreData, int allCount) + throws ScoringFilterException; /** - * This method calculates a new score during table update, based on the values contributed - * by inlinked pages. - * @param url url of the page + * This method calculates a new score during table update, based on the values + * contributed by inlinked pages. + * + * @param url + * url of the page * @param page - * @param inlinked list of {@link OutlinkedScoreDatum}s for all inlinks pointing to this URL. + * @param inlinked + * list of {@link OutlinkedScoreDatum}s for all inlinks pointing to + * this URL. * @throws ScoringFilterException */ - public void updateScore(String url, WebPage page, List<ScoreDatum> inlinkedScoreData) - throws ScoringFilterException; + public void updateScore(String url, WebPage page, + List<ScoreDatum> inlinkedScoreData) throws ScoringFilterException; /** * This method calculates a Lucene document boost. - * @param url url of the page - * @param doc document. NOTE: this already contains all information collected - * by indexing filters. Implementations may modify this instance, in order to store/remove - * some information. - * @param row page row - * @param initScore initial boost value for the Lucene document. - * @return boost value for the Lucene document. This value is passed as an argument - * to the next scoring filter in chain. NOTE: implementations may also express - * other scoring strategies by modifying Lucene document directly. + * + * @param url + * url of the page + * @param doc + * document. NOTE: this already contains all information collected by + * indexing filters. Implementations may modify this instance, in + * order to store/remove some information. + * @param row + * page row + * @param initScore + * initial boost value for the Lucene document. + * @return boost value for the Lucene document. This value is passed as an + * argument to the next scoring filter in chain. NOTE: implementations + * may also express other scoring strategies by modifying Lucene + * document directly. * @throws ScoringFilterException */ - public float indexerScore(String url, NutchDocument doc, WebPage page, float initScore) - throws ScoringFilterException; + public float indexerScore(String url, NutchDocument doc, WebPage page, + float initScore) throws ScoringFilterException; } Modified: nutch/branches/2.x/src/java/org/apache/nutch/scoring/ScoringFilterException.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/scoring/ScoringFilterException.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/scoring/ScoringFilterException.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/scoring/ScoringFilterException.java Fri Jan 9 06:34:33 2015 @@ -1,19 +1,19 @@ /* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.nutch.scoring; /** Modified: nutch/branches/2.x/src/java/org/apache/nutch/scoring/ScoringFilters.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/scoring/ScoringFilters.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/scoring/ScoringFilters.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/scoring/ScoringFilters.java Fri Jan 9 06:34:33 2015 @@ -35,7 +35,7 @@ import org.apache.nutch.util.ObjectCache /** * Creates and caches {@link ScoringFilter} implementing plugins. - * + * * @author Andrzej Bialecki */ public class ScoringFilters extends Configured implements ScoringFilter { @@ -46,7 +46,8 @@ public class ScoringFilters extends Conf super(conf); ObjectCache objectCache = ObjectCache.get(conf); String order = conf.get("scoring.filter.order"); - this.filters = (ScoringFilter[]) objectCache.getObject(ScoringFilter.class.getName()); + this.filters = (ScoringFilter[]) objectCache.getObject(ScoringFilter.class + .getName()); if (this.filters == null) { String[] orderedFilters = null; @@ -55,20 +56,23 @@ public class ScoringFilters extends Conf } try { - ExtensionPoint point = PluginRepository.get(conf).getExtensionPoint(ScoringFilter.X_POINT_ID); - if (point == null) throw new RuntimeException(ScoringFilter.X_POINT_ID + " not found."); + ExtensionPoint point = PluginRepository.get(conf).getExtensionPoint( + ScoringFilter.X_POINT_ID); + if (point == null) + throw new RuntimeException(ScoringFilter.X_POINT_ID + " not found."); Extension[] extensions = point.getExtensions(); - HashMap<String, ScoringFilter> filterMap = - new HashMap<String, ScoringFilter>(); + HashMap<String, ScoringFilter> filterMap = new HashMap<String, ScoringFilter>(); for (int i = 0; i < extensions.length; i++) { Extension extension = extensions[i]; - ScoringFilter filter = (ScoringFilter) extension.getExtensionInstance(); + ScoringFilter filter = (ScoringFilter) extension + .getExtensionInstance(); if (!filterMap.containsKey(filter.getClass().getName())) { filterMap.put(filter.getClass().getName(), filter); } } if (orderedFilters == null) { - objectCache.setObject(ScoringFilter.class.getName(), filterMap.values().toArray(new ScoringFilter[0])); + objectCache.setObject(ScoringFilter.class.getName(), filterMap + .values().toArray(new ScoringFilter[0])); } else { ScoringFilter[] filter = new ScoringFilter[orderedFilters.length]; for (int i = 0; i < orderedFilters.length; i++) { @@ -79,14 +83,15 @@ public class ScoringFilters extends Conf } catch (PluginRuntimeException e) { throw new RuntimeException(e); } - this.filters = (ScoringFilter[]) objectCache.getObject(ScoringFilter.class.getName()); + this.filters = (ScoringFilter[]) objectCache + .getObject(ScoringFilter.class.getName()); } } /** Calculate a sort value for Generate. */ @Override public float generatorSortValue(String url, WebPage row, float initSort) - throws ScoringFilterException { + throws ScoringFilterException { for (ScoringFilter filter : filters) { initSort = filter.generatorSortValue(url, row, initSort); } @@ -95,7 +100,8 @@ public class ScoringFilters extends Conf /** Calculate a new initial score, used when adding newly discovered pages. */ @Override - public void initialScore(String url, WebPage row) throws ScoringFilterException { + public void initialScore(String url, WebPage row) + throws ScoringFilterException { for (ScoringFilter filter : filters) { filter.initialScore(url, row); } @@ -103,7 +109,8 @@ public class ScoringFilters extends Conf /** Calculate a new initial score, used when injecting new pages. */ @Override - public void injectedScore(String url, WebPage row) throws ScoringFilterException { + public void injectedScore(String url, WebPage row) + throws ScoringFilterException { for (ScoringFilter filter : filters) { filter.injectedScore(url, row); } Modified: nutch/branches/2.x/src/java/org/apache/nutch/scoring/package-info.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/scoring/package-info.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/scoring/package-info.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/scoring/package-info.java Fri Jan 9 06:34:33 2015 @@ -19,3 +19,4 @@ * The {@link org.apache.nutch.scoring.ScoringFilter ScoringFilter} interface. */ package org.apache.nutch.scoring; + Modified: nutch/branches/2.x/src/java/org/apache/nutch/storage/Host.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/storage/Host.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/storage/Host.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/storage/Host.java Fri Jan 9 06:34:33 2015 @@ -1,40 +1,40 @@ /******************************************************************************* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with -* the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -******************************************************************************/ + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ /** * Autogenerated by Avro * * DO NOT EDIT DIRECTLY */ -package org.apache.nutch.storage; +package org.apache.nutch.storage; import org.apache.avro.util.Utf8; import org.apache.nutch.util.Bytes; @SuppressWarnings("all") /** Host represents a store of webpages or other data which resides on a server or other computer so that it can be accessed over the Internet */ -public class Host extends org.apache.gora.persistency.impl.PersistentBase implements org.apache.avro.specific.SpecificRecord, org.apache.gora.persistency.Persistent { - public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Host\",\"namespace\":\"org.apache.nutch.storage\",\"doc\":\"Host represents a store of webpages or other data which resides on a server or other computer so that it can be accessed over the Internet\",\"fields\":[{\"name\":\"metadata\",\"type\":{\"type\":\"map\",\"values\":[\"null\",\"bytes\"]},\"doc\":\"A multivalued metadata container used for storing a wide variety of host metadata such as structured web server characterists etc\",\"default\":{}},{\"name\":\"outlinks\",\"type\":{\"type\":\"map\",\"values\":[\"null\",\"string\"]},\"doc\":\"Hyperlinks which direct outside of the current host domain these can used in a histogram style manner to generate host statistics\",\"default\":{}},{\"name\":\"inlinks\",\"type\":{\"type\":\"map\",\"values\":[\"null\",\"string\"]},\"doc\":\"Hyperlinks which link to pages within the current host domain these can used i n a histogram style manner to generate host statistics\",\"default\":{}}]}"); +public class Host extends org.apache.gora.persistency.impl.PersistentBase + implements org.apache.avro.specific.SpecificRecord, + org.apache.gora.persistency.Persistent { + public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser() + .parse("{\"type\":\"record\",\"name\":\"Host\",\"namespace\":\"org.apache.nutch.storage\",\"doc\":\"Host represents a store of webpages or other data which resides on a server or other computer so that it can be accessed over the Internet\",\"fields\":[{\"name\":\"metadata\",\"type\":{\"type\":\"map\",\"values\":[\"null\",\"bytes\"]},\"doc\":\"A multivalued metadata container used for storing a wide variety of host metadata such as structured web server characterists etc\",\"default\":{}},{\"name\":\"outlinks\",\"type\":{\"type\":\"map\",\"values\":[\"null\",\"string\"]},\"doc\":\"Hyperlinks which direct outside of the current host domain these can used in a histogram style manner to generate host statistics\",\"default\":{}},{\"name\":\"inlinks\",\"type\":{\"type\":\"map\",\"values\":[\"null\",\"string\"]},\"doc\":\"Hyperlinks which link to pages within the current host domain these can used in a histogram style manner to generate host statistics\",\"default\":{}}]}"); /** Enum containing all data bean's fields. */ public static enum Field { - METADATA(0, "metadata"), - OUTLINKS(1, "outlinks"), - INLINKS(2, "inlinks"), - ; + METADATA(0, "metadata"), OUTLINKS(1, "outlinks"), INLINKS(2, "inlinks"), ; /** * Field's index. */ @@ -47,141 +47,211 @@ public class Host extends org.apache.gor /** * Field's constructor - * @param index field's index. - * @param name field's name. + * + * @param index + * field's index. + * @param name + * field's name. */ - Field(int index, String name) {this.index=index;this.name=name;} + Field(int index, String name) { + this.index = index; + this.name = name; + } /** * Gets field's index. + * * @return int field's index. */ - public int getIndex() {return index;} + public int getIndex() { + return index; + } /** * Gets field's name. + * * @return String field's name. */ - public String getName() {return name;} + public String getName() { + return name; + } /** * Gets field's attributes to string. + * * @return String field's attributes to string. */ - public String toString() {return name;} + public String toString() { + return name; + } }; - public static final String[] _ALL_FIELDS = { - "metadata", - "outlinks", - "inlinks", - }; + public static final String[] _ALL_FIELDS = { "metadata", "outlinks", + "inlinks", }; /** * Gets the total field count. + * * @return int field count */ public int getFieldsCount() { return Host._ALL_FIELDS.length; } - /** A multivalued metadata container used for storing a wide variety of host metadata such as structured web server characterists etc */ - private java.util.Map<java.lang.CharSequence,java.nio.ByteBuffer> metadata; - /** Hyperlinks which direct outside of the current host domain these can used in a histogram style manner to generate host statistics */ - private java.util.Map<java.lang.CharSequence,java.lang.CharSequence> outlinks; - /** Hyperlinks which link to pages within the current host domain these can used in a histogram style manner to generate host statistics */ - private java.util.Map<java.lang.CharSequence,java.lang.CharSequence> inlinks; - public org.apache.avro.Schema getSchema() { return SCHEMA$; } - // Used by DatumWriter. Applications should not call. + /** + * A multivalued metadata container used for storing a wide variety of host + * metadata such as structured web server characterists etc + */ + private java.util.Map<java.lang.CharSequence, java.nio.ByteBuffer> metadata; + /** + * Hyperlinks which direct outside of the current host domain these can used + * in a histogram style manner to generate host statistics + */ + private java.util.Map<java.lang.CharSequence, java.lang.CharSequence> outlinks; + /** + * Hyperlinks which link to pages within the current host domain these can + * used in a histogram style manner to generate host statistics + */ + private java.util.Map<java.lang.CharSequence, java.lang.CharSequence> inlinks; + + public org.apache.avro.Schema getSchema() { + return SCHEMA$; + } + + // Used by DatumWriter. Applications should not call. public java.lang.Object get(int field$) { switch (field$) { - case 0: return metadata; - case 1: return outlinks; - case 2: return inlinks; - default: throw new org.apache.avro.AvroRuntimeException("Bad index"); + case 0: + return metadata; + case 1: + return outlinks; + case 2: + return inlinks; + default: + throw new org.apache.avro.AvroRuntimeException("Bad index"); } } - - // Used by DatumReader. Applications should not call. - @SuppressWarnings(value="unchecked") + + // Used by DatumReader. Applications should not call. + @SuppressWarnings(value = "unchecked") public void put(int field$, java.lang.Object value) { switch (field$) { - case 0: metadata = (java.util.Map<java.lang.CharSequence,java.nio.ByteBuffer>)((value instanceof org.apache.gora.persistency.Dirtyable) ? value : new org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)value)); break; - case 1: outlinks = (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>)((value instanceof org.apache.gora.persistency.Dirtyable) ? value : new org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)value)); break; - case 2: inlinks = (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>)((value instanceof org.apache.gora.persistency.Dirtyable) ? value : new org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)value)); break; - default: throw new org.apache.avro.AvroRuntimeException("Bad index"); + case 0: + metadata = (java.util.Map<java.lang.CharSequence, java.nio.ByteBuffer>) ((value instanceof org.apache.gora.persistency.Dirtyable) ? value + : new org.apache.gora.persistency.impl.DirtyMapWrapper( + (java.util.Map) value)); + break; + case 1: + outlinks = (java.util.Map<java.lang.CharSequence, java.lang.CharSequence>) ((value instanceof org.apache.gora.persistency.Dirtyable) ? value + : new org.apache.gora.persistency.impl.DirtyMapWrapper( + (java.util.Map) value)); + break; + case 2: + inlinks = (java.util.Map<java.lang.CharSequence, java.lang.CharSequence>) ((value instanceof org.apache.gora.persistency.Dirtyable) ? value + : new org.apache.gora.persistency.impl.DirtyMapWrapper( + (java.util.Map) value)); + break; + default: + throw new org.apache.avro.AvroRuntimeException("Bad index"); } } /** - * Gets the value of the 'metadata' field. - * A multivalued metadata container used for storing a wide variety of host metadata such as structured web server characterists etc */ - public java.util.Map<java.lang.CharSequence,java.nio.ByteBuffer> getMetadata() { + * Gets the value of the 'metadata' field. A multivalued metadata container + * used for storing a wide variety of host metadata such as structured web + * server characterists etc + */ + public java.util.Map<java.lang.CharSequence, java.nio.ByteBuffer> getMetadata() { return metadata; } /** - * Sets the value of the 'metadata' field. - * A multivalued metadata container used for storing a wide variety of host metadata such as structured web server characterists etc * @param value the value to set. + * Sets the value of the 'metadata' field. A multivalued metadata container + * used for storing a wide variety of host metadata such as structured web + * server characterists etc * @param value the value to set. */ - public void setMetadata(java.util.Map<java.lang.CharSequence,java.nio.ByteBuffer> value) { - this.metadata = (value instanceof org.apache.gora.persistency.Dirtyable) ? value : new org.apache.gora.persistency.impl.DirtyMapWrapper(value); + public void setMetadata( + java.util.Map<java.lang.CharSequence, java.nio.ByteBuffer> value) { + this.metadata = (value instanceof org.apache.gora.persistency.Dirtyable) ? value + : new org.apache.gora.persistency.impl.DirtyMapWrapper(value); setDirty(0); } - + /** - * Checks the dirty status of the 'metadata' field. A field is dirty if it represents a change that has not yet been written to the database. - * A multivalued metadata container used for storing a wide variety of host metadata such as structured web server characterists etc * @param value the value to set. + * Checks the dirty status of the 'metadata' field. A field is dirty if it + * represents a change that has not yet been written to the database. A + * multivalued metadata container used for storing a wide variety of host + * metadata such as structured web server characterists etc * @param value the + * value to set. */ - public boolean isMetadataDirty(java.util.Map<java.lang.CharSequence,java.nio.ByteBuffer> value) { + public boolean isMetadataDirty( + java.util.Map<java.lang.CharSequence, java.nio.ByteBuffer> value) { return isDirty(0); } /** - * Gets the value of the 'outlinks' field. - * Hyperlinks which direct outside of the current host domain these can used in a histogram style manner to generate host statistics */ - public java.util.Map<java.lang.CharSequence,java.lang.CharSequence> getOutlinks() { + * Gets the value of the 'outlinks' field. Hyperlinks which direct outside of + * the current host domain these can used in a histogram style manner to + * generate host statistics + */ + public java.util.Map<java.lang.CharSequence, java.lang.CharSequence> getOutlinks() { return outlinks; } /** - * Sets the value of the 'outlinks' field. - * Hyperlinks which direct outside of the current host domain these can used in a histogram style manner to generate host statistics * @param value the value to set. + * Sets the value of the 'outlinks' field. Hyperlinks which direct outside of + * the current host domain these can used in a histogram style manner to + * generate host statistics * @param value the value to set. */ - public void setOutlinks(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) { - this.outlinks = (value instanceof org.apache.gora.persistency.Dirtyable) ? value : new org.apache.gora.persistency.impl.DirtyMapWrapper(value); + public void setOutlinks( + java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) { + this.outlinks = (value instanceof org.apache.gora.persistency.Dirtyable) ? value + : new org.apache.gora.persistency.impl.DirtyMapWrapper(value); setDirty(1); } - + /** - * Checks the dirty status of the 'outlinks' field. A field is dirty if it represents a change that has not yet been written to the database. - * Hyperlinks which direct outside of the current host domain these can used in a histogram style manner to generate host statistics * @param value the value to set. + * Checks the dirty status of the 'outlinks' field. A field is dirty if it + * represents a change that has not yet been written to the database. + * Hyperlinks which direct outside of the current host domain these can used + * in a histogram style manner to generate host statistics * @param value the + * value to set. */ - public boolean isOutlinksDirty(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) { + public boolean isOutlinksDirty( + java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) { return isDirty(1); } /** - * Gets the value of the 'inlinks' field. - * Hyperlinks which link to pages within the current host domain these can used in a histogram style manner to generate host statistics */ - public java.util.Map<java.lang.CharSequence,java.lang.CharSequence> getInlinks() { + * Gets the value of the 'inlinks' field. Hyperlinks which link to pages + * within the current host domain these can used in a histogram style manner + * to generate host statistics + */ + public java.util.Map<java.lang.CharSequence, java.lang.CharSequence> getInlinks() { return inlinks; } /** - * Sets the value of the 'inlinks' field. - * Hyperlinks which link to pages within the current host domain these can used in a histogram style manner to generate host statistics * @param value the value to set. + * Sets the value of the 'inlinks' field. Hyperlinks which link to pages + * within the current host domain these can used in a histogram style manner + * to generate host statistics * @param value the value to set. */ - public void setInlinks(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) { - this.inlinks = (value instanceof org.apache.gora.persistency.Dirtyable) ? value : new org.apache.gora.persistency.impl.DirtyMapWrapper(value); + public void setInlinks( + java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) { + this.inlinks = (value instanceof org.apache.gora.persistency.Dirtyable) ? value + : new org.apache.gora.persistency.impl.DirtyMapWrapper(value); setDirty(2); } - + /** - * Checks the dirty status of the 'inlinks' field. A field is dirty if it represents a change that has not yet been written to the database. - * Hyperlinks which link to pages within the current host domain these can used in a histogram style manner to generate host statistics * @param value the value to set. + * Checks the dirty status of the 'inlinks' field. A field is dirty if it + * represents a change that has not yet been written to the database. + * Hyperlinks which link to pages within the current host domain these can + * used in a histogram style manner to generate host statistics * @param value + * the value to set. */ - public boolean isInlinksDirty(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) { + public boolean isInlinksDirty( + java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) { return isDirty(2); } @@ -189,17 +259,19 @@ public class Host extends org.apache.gor public static org.apache.nutch.storage.Host.Builder newBuilder() { return new org.apache.nutch.storage.Host.Builder(); } - + /** Creates a new Host RecordBuilder by copying an existing Builder */ - public static org.apache.nutch.storage.Host.Builder newBuilder(org.apache.nutch.storage.Host.Builder other) { + public static org.apache.nutch.storage.Host.Builder newBuilder( + org.apache.nutch.storage.Host.Builder other) { return new org.apache.nutch.storage.Host.Builder(other); } - + /** Creates a new Host RecordBuilder by copying an existing Host instance */ - public static org.apache.nutch.storage.Host.Builder newBuilder(org.apache.nutch.storage.Host other) { + public static org.apache.nutch.storage.Host.Builder newBuilder( + org.apache.nutch.storage.Host other) { return new org.apache.nutch.storage.Host.Builder(other); } - + private static java.nio.ByteBuffer deepCopyToReadOnlyBuffer( java.nio.ByteBuffer input) { java.nio.ByteBuffer copy = java.nio.ByteBuffer.allocate(input.capacity()); @@ -222,241 +294,294 @@ public class Host extends org.apache.gor copy.limit(limit); return copy.asReadOnlyBuffer(); } - + /** * RecordBuilder for Host instances. */ - public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<Host> - implements org.apache.avro.data.RecordBuilder<Host> { - - private java.util.Map<java.lang.CharSequence,java.nio.ByteBuffer> metadata; - private java.util.Map<java.lang.CharSequence,java.lang.CharSequence> outlinks; - private java.util.Map<java.lang.CharSequence,java.lang.CharSequence> inlinks; + public static class Builder extends + org.apache.avro.specific.SpecificRecordBuilderBase<Host> implements + org.apache.avro.data.RecordBuilder<Host> { + + private java.util.Map<java.lang.CharSequence, java.nio.ByteBuffer> metadata; + private java.util.Map<java.lang.CharSequence, java.lang.CharSequence> outlinks; + private java.util.Map<java.lang.CharSequence, java.lang.CharSequence> inlinks; /** Creates a new Builder */ private Builder() { super(org.apache.nutch.storage.Host.SCHEMA$); } - + /** Creates a Builder by copying an existing Builder */ private Builder(org.apache.nutch.storage.Host.Builder other) { super(other); } - + /** Creates a Builder by copying an existing Host instance */ private Builder(org.apache.nutch.storage.Host other) { - super(org.apache.nutch.storage.Host.SCHEMA$); + super(org.apache.nutch.storage.Host.SCHEMA$); if (isValidValue(fields()[0], other.metadata)) { - this.metadata = (java.util.Map<java.lang.CharSequence,java.nio.ByteBuffer>) data().deepCopy(fields()[0].schema(), other.metadata); + this.metadata = (java.util.Map<java.lang.CharSequence, java.nio.ByteBuffer>) data() + .deepCopy(fields()[0].schema(), other.metadata); fieldSetFlags()[0] = true; } if (isValidValue(fields()[1], other.outlinks)) { - this.outlinks = (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>) data().deepCopy(fields()[1].schema(), other.outlinks); + this.outlinks = (java.util.Map<java.lang.CharSequence, java.lang.CharSequence>) data() + .deepCopy(fields()[1].schema(), other.outlinks); fieldSetFlags()[1] = true; } if (isValidValue(fields()[2], other.inlinks)) { - this.inlinks = (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>) data().deepCopy(fields()[2].schema(), other.inlinks); + this.inlinks = (java.util.Map<java.lang.CharSequence, java.lang.CharSequence>) data() + .deepCopy(fields()[2].schema(), other.inlinks); fieldSetFlags()[2] = true; } } /** Gets the value of the 'metadata' field */ - public java.util.Map<java.lang.CharSequence,java.nio.ByteBuffer> getMetadata() { + public java.util.Map<java.lang.CharSequence, java.nio.ByteBuffer> getMetadata() { return metadata; } - + /** Sets the value of the 'metadata' field */ - public org.apache.nutch.storage.Host.Builder setMetadata(java.util.Map<java.lang.CharSequence,java.nio.ByteBuffer> value) { + public org.apache.nutch.storage.Host.Builder setMetadata( + java.util.Map<java.lang.CharSequence, java.nio.ByteBuffer> value) { validate(fields()[0], value); this.metadata = value; fieldSetFlags()[0] = true; - return this; + return this; } - + /** Checks whether the 'metadata' field has been set */ public boolean hasMetadata() { return fieldSetFlags()[0]; } - + /** Clears the value of the 'metadata' field */ public org.apache.nutch.storage.Host.Builder clearMetadata() { metadata = null; fieldSetFlags()[0] = false; return this; } - + /** Gets the value of the 'outlinks' field */ - public java.util.Map<java.lang.CharSequence,java.lang.CharSequence> getOutlinks() { + public java.util.Map<java.lang.CharSequence, java.lang.CharSequence> getOutlinks() { return outlinks; } - + /** Sets the value of the 'outlinks' field */ - public org.apache.nutch.storage.Host.Builder setOutlinks(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) { + public org.apache.nutch.storage.Host.Builder setOutlinks( + java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) { validate(fields()[1], value); this.outlinks = value; fieldSetFlags()[1] = true; - return this; + return this; } - + /** Checks whether the 'outlinks' field has been set */ public boolean hasOutlinks() { return fieldSetFlags()[1]; } - + /** Clears the value of the 'outlinks' field */ public org.apache.nutch.storage.Host.Builder clearOutlinks() { outlinks = null; fieldSetFlags()[1] = false; return this; } - + /** Gets the value of the 'inlinks' field */ - public java.util.Map<java.lang.CharSequence,java.lang.CharSequence> getInlinks() { + public java.util.Map<java.lang.CharSequence, java.lang.CharSequence> getInlinks() { return inlinks; } - + /** Sets the value of the 'inlinks' field */ - public org.apache.nutch.storage.Host.Builder setInlinks(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) { + public org.apache.nutch.storage.Host.Builder setInlinks( + java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) { validate(fields()[2], value); this.inlinks = value; fieldSetFlags()[2] = true; - return this; + return this; } - + /** Checks whether the 'inlinks' field has been set */ public boolean hasInlinks() { return fieldSetFlags()[2]; } - + /** Clears the value of the 'inlinks' field */ public org.apache.nutch.storage.Host.Builder clearInlinks() { inlinks = null; fieldSetFlags()[2] = false; return this; } - + @Override public Host build() { try { Host record = new Host(); - record.metadata = fieldSetFlags()[0] ? this.metadata : (java.util.Map<java.lang.CharSequence,java.nio.ByteBuffer>) new org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)defaultValue(fields()[0])); - record.outlinks = fieldSetFlags()[1] ? this.outlinks : (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>) new org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)defaultValue(fields()[1])); - record.inlinks = fieldSetFlags()[2] ? this.inlinks : (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>) new org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)defaultValue(fields()[2])); + record.metadata = fieldSetFlags()[0] ? this.metadata + : (java.util.Map<java.lang.CharSequence, java.nio.ByteBuffer>) new org.apache.gora.persistency.impl.DirtyMapWrapper( + (java.util.Map) defaultValue(fields()[0])); + record.outlinks = fieldSetFlags()[1] ? this.outlinks + : (java.util.Map<java.lang.CharSequence, java.lang.CharSequence>) new org.apache.gora.persistency.impl.DirtyMapWrapper( + (java.util.Map) defaultValue(fields()[1])); + record.inlinks = fieldSetFlags()[2] ? this.inlinks + : (java.util.Map<java.lang.CharSequence, java.lang.CharSequence>) new org.apache.gora.persistency.impl.DirtyMapWrapper( + (java.util.Map) defaultValue(fields()[2])); return record; } catch (Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } } - - public Host.Tombstone getTombstone(){ - return TOMBSTONE; + + public Host.Tombstone getTombstone() { + return TOMBSTONE; } - public Host newInstance(){ + public Host newInstance() { return newBuilder().build(); } - // TODO NUTCH-1709 Generated classes o.a.n.storage.Host and o.a.n.storage.ProtocolStatus contain methods not defined in source .avsc + // TODO NUTCH-1709 Generated classes o.a.n.storage.Host and + // o.a.n.storage.ProtocolStatus contain methods not defined in source .avsc public boolean contains(String key) { return metadata.containsKey(new Utf8(key)); } - - // TODO NUTCH-1709 Generated classes o.a.n.storage.Host and o.a.n.storage.ProtocolStatus contain methods not defined in source .avsc + + // TODO NUTCH-1709 Generated classes o.a.n.storage.Host and + // o.a.n.storage.ProtocolStatus contain methods not defined in source .avsc public String getValue(String key, String defaultValue) { - if (!contains(key)) return defaultValue; + if (!contains(key)) + return defaultValue; return Bytes.toString(metadata.get(new Utf8(key))); } - - // TODO NUTCH-1709 Generated classes o.a.n.storage.Host and o.a.n.storage.ProtocolStatus contain methods not defined in source .avsc + + // TODO NUTCH-1709 Generated classes o.a.n.storage.Host and + // o.a.n.storage.ProtocolStatus contain methods not defined in source .avsc public int getInt(String key, int defaultValue) { - if (!contains(key)) return defaultValue; - return Integer.parseInt(getValue(key,null)); + if (!contains(key)) + return defaultValue; + return Integer.parseInt(getValue(key, null)); } - // TODO NUTCH-1709 Generated classes o.a.n.storage.Host and o.a.n.storage.ProtocolStatus contain methods not defined in source .avsc + // TODO NUTCH-1709 Generated classes o.a.n.storage.Host and + // o.a.n.storage.ProtocolStatus contain methods not defined in source .avsc public long getLong(String key, long defaultValue) { - if (!contains(key)) return defaultValue; - return Long.parseLong(getValue(key,null)); + if (!contains(key)) + return defaultValue; + return Long.parseLong(getValue(key, null)); } private static final Tombstone TOMBSTONE = new Tombstone(); - - public static final class Tombstone extends Host implements org.apache.gora.persistency.Tombstone { - - private Tombstone() { } - - /** - * Gets the value of the 'metadata' field. - * A multivalued metadata container used for storing a wide variety of host metadata such as structured web server characterists etc */ - public java.util.Map<java.lang.CharSequence,java.nio.ByteBuffer> getMetadata() { - throw new java.lang.UnsupportedOperationException("Get is not supported on tombstones"); - } - - /** - * Sets the value of the 'metadata' field. - * A multivalued metadata container used for storing a wide variety of host metadata such as structured web server characterists etc * @param value the value to set. - */ - public void setMetadata(java.util.Map<java.lang.CharSequence,java.nio.ByteBuffer> value) { - throw new java.lang.UnsupportedOperationException("Set is not supported on tombstones"); - } - - /** - * Checks the dirty status of the 'metadata' field. A field is dirty if it represents a change that has not yet been written to the database. - * A multivalued metadata container used for storing a wide variety of host metadata such as structured web server characterists etc * @param value the value to set. - */ - public boolean isMetadataDirty(java.util.Map<java.lang.CharSequence,java.nio.ByteBuffer> value) { - throw new java.lang.UnsupportedOperationException("IsDirty is not supported on tombstones"); - } - - /** - * Gets the value of the 'outlinks' field. - * Hyperlinks which direct outside of the current host domain these can used in a histogram style manner to generate host statistics */ - public java.util.Map<java.lang.CharSequence,java.lang.CharSequence> getOutlinks() { - throw new java.lang.UnsupportedOperationException("Get is not supported on tombstones"); - } - - /** - * Sets the value of the 'outlinks' field. - * Hyperlinks which direct outside of the current host domain these can used in a histogram style manner to generate host statistics * @param value the value to set. - */ - public void setOutlinks(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) { - throw new java.lang.UnsupportedOperationException("Set is not supported on tombstones"); - } - - /** - * Checks the dirty status of the 'outlinks' field. A field is dirty if it represents a change that has not yet been written to the database. - * Hyperlinks which direct outside of the current host domain these can used in a histogram style manner to generate host statistics * @param value the value to set. - */ - public boolean isOutlinksDirty(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) { - throw new java.lang.UnsupportedOperationException("IsDirty is not supported on tombstones"); - } - - /** - * Gets the value of the 'inlinks' field. - * Hyperlinks which link to pages within the current host domain these can used in a histogram style manner to generate host statistics */ - public java.util.Map<java.lang.CharSequence,java.lang.CharSequence> getInlinks() { - throw new java.lang.UnsupportedOperationException("Get is not supported on tombstones"); - } - - /** - * Sets the value of the 'inlinks' field. - * Hyperlinks which link to pages within the current host domain these can used in a histogram style manner to generate host statistics * @param value the value to set. - */ - public void setInlinks(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) { - throw new java.lang.UnsupportedOperationException("Set is not supported on tombstones"); - } - - /** - * Checks the dirty status of the 'inlinks' field. A field is dirty if it represents a change that has not yet been written to the database. - * Hyperlinks which link to pages within the current host domain these can used in a histogram style manner to generate host statistics * @param value the value to set. - */ - public boolean isInlinksDirty(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) { - throw new java.lang.UnsupportedOperationException("IsDirty is not supported on tombstones"); - } - - + + public static final class Tombstone extends Host implements + org.apache.gora.persistency.Tombstone { + + private Tombstone() { + } + + /** + * Gets the value of the 'metadata' field. A multivalued metadata container + * used for storing a wide variety of host metadata such as structured web + * server characterists etc + */ + public java.util.Map<java.lang.CharSequence, java.nio.ByteBuffer> getMetadata() { + throw new java.lang.UnsupportedOperationException( + "Get is not supported on tombstones"); + } + + /** + * Sets the value of the 'metadata' field. A multivalued metadata container + * used for storing a wide variety of host metadata such as structured web + * server characterists etc * @param value the value to set. + */ + public void setMetadata( + java.util.Map<java.lang.CharSequence, java.nio.ByteBuffer> value) { + throw new java.lang.UnsupportedOperationException( + "Set is not supported on tombstones"); + } + + /** + * Checks the dirty status of the 'metadata' field. A field is dirty if it + * represents a change that has not yet been written to the database. A + * multivalued metadata container used for storing a wide variety of host + * metadata such as structured web server characterists etc * @param value + * the value to set. + */ + public boolean isMetadataDirty( + java.util.Map<java.lang.CharSequence, java.nio.ByteBuffer> value) { + throw new java.lang.UnsupportedOperationException( + "IsDirty is not supported on tombstones"); + } + + /** + * Gets the value of the 'outlinks' field. Hyperlinks which direct outside + * of the current host domain these can used in a histogram style manner to + * generate host statistics + */ + public java.util.Map<java.lang.CharSequence, java.lang.CharSequence> getOutlinks() { + throw new java.lang.UnsupportedOperationException( + "Get is not supported on tombstones"); + } + + /** + * Sets the value of the 'outlinks' field. Hyperlinks which direct outside + * of the current host domain these can used in a histogram style manner to + * generate host statistics * @param value the value to set. + */ + public void setOutlinks( + java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) { + throw new java.lang.UnsupportedOperationException( + "Set is not supported on tombstones"); + } + + /** + * Checks the dirty status of the 'outlinks' field. A field is dirty if it + * represents a change that has not yet been written to the database. + * Hyperlinks which direct outside of the current host domain these can used + * in a histogram style manner to generate host statistics * @param value + * the value to set. + */ + public boolean isOutlinksDirty( + java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) { + throw new java.lang.UnsupportedOperationException( + "IsDirty is not supported on tombstones"); + } + + /** + * Gets the value of the 'inlinks' field. Hyperlinks which link to pages + * within the current host domain these can used in a histogram style manner + * to generate host statistics + */ + public java.util.Map<java.lang.CharSequence, java.lang.CharSequence> getInlinks() { + throw new java.lang.UnsupportedOperationException( + "Get is not supported on tombstones"); + } + + /** + * Sets the value of the 'inlinks' field. Hyperlinks which link to pages + * within the current host domain these can used in a histogram style manner + * to generate host statistics * @param value the value to set. + */ + public void setInlinks( + java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) { + throw new java.lang.UnsupportedOperationException( + "Set is not supported on tombstones"); + } + + /** + * Checks the dirty status of the 'inlinks' field. A field is dirty if it + * represents a change that has not yet been written to the database. + * Hyperlinks which link to pages within the current host domain these can + * used in a histogram style manner to generate host statistics * @param + * value the value to set. + */ + public boolean isInlinksDirty( + java.util.Map<java.lang.CharSequence, java.lang.CharSequence> value) { + throw new java.lang.UnsupportedOperationException( + "IsDirty is not supported on tombstones"); + } + } - -} +} Modified: nutch/branches/2.x/src/java/org/apache/nutch/storage/Mark.java URL: http://svn.apache.org/viewvc/nutch/branches/2.x/src/java/org/apache/nutch/storage/Mark.java?rev=1650447&r1=1650446&r2=1650447&view=diff ============================================================================== --- nutch/branches/2.x/src/java/org/apache/nutch/storage/Mark.java (original) +++ nutch/branches/2.x/src/java/org/apache/nutch/storage/Mark.java Fri Jan 9 06:34:33 2015 @@ -19,8 +19,8 @@ package org.apache.nutch.storage; import org.apache.avro.util.Utf8; public enum Mark { - INJECT_MARK("_injmrk_"), GENERATE_MARK("_gnmrk_"), FETCH_MARK("_ftcmrk_"), - PARSE_MARK("__prsmrk__"), UPDATEDB_MARK("_updmrk_"), INDEX_MARK("_idxmrk_"); + INJECT_MARK("_injmrk_"), GENERATE_MARK("_gnmrk_"), FETCH_MARK("_ftcmrk_"), PARSE_MARK( + "__prsmrk__"), UPDATEDB_MARK("_updmrk_"), INDEX_MARK("_idxmrk_"); private Utf8 name; @@ -29,7 +29,7 @@ public enum Mark { } public void putMark(WebPage page, Utf8 markValue) { - page.getMarkers().put(name, markValue); + page.getMarkers().put(name, markValue); } public void putMark(WebPage page, String markValue) { @@ -46,7 +46,9 @@ public enum Mark { /** * Remove the mark only if the mark is present on the page. - * @param page The page to remove the mark from. + * + * @param page + * The page to remove the mark from. * @return If the mark was present. */ public Utf8 removeMarkIfExist(WebPage page) { @@ -55,8 +57,8 @@ public enum Mark { } return null; } - + public Utf8 getName() { - return name; + return name; } }