001package votorola.a.diff.harvest.kick;// Copyright 2012. Christian Weilbach.  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Votorola Software"), to deal in the Votorola Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Votorola Software, and to permit persons to whom the Votorola Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Votorola Software. THE VOTOROLA SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE VOTOROLA SOFTWARE OR THE USE OR OTHER DEALINGS IN THE VOTOROLA SOFTWARE.
002
003import votorola.a.diff.harvest.HarvestReporter;
004
005/**
006 * Raised when one of the detectors finds a difference-url. Contains some
007 * contextual information about the message triggering this kick.
008 * 
009 */
010public final class UpdateKick implements Kick {
011
012    private final String archiveDesign;
013    private final String archiveUrl;
014    private final HarvestReporter reporter;
015    
016    public static UpdateKick create(final String design, final String url, final HarvestReporter reporter) {
017        return new UpdateKick(design, url, reporter);
018    }
019
020    private UpdateKick(final String design, final String url, final HarvestReporter reporter) {
021        this.archiveDesign = design;
022        this.archiveUrl = url;
023        this.reporter = reporter;
024    }
025    
026    public String archiveUrl() {
027        return archiveUrl;
028    }
029    
030    public String archiveDesign() {
031        return archiveDesign;
032    }
033    
034    public HarvestReporter reporter() {
035        return reporter;
036    }
037    
038    @Override
039    public boolean equals(Object o) {
040        return o instanceof UpdateKick
041                && ((UpdateKick)o).archiveUrl.equals(archiveUrl)
042                && ((UpdateKick)o).archiveDesign.equals(archiveDesign);
043    }
044    
045    @Override
046    public int hashCode() {
047        return archiveDesign.hashCode()*37 + archiveUrl.hashCode();
048    }
049
050}