001/*
002 * #%L
003 * Netarchivesuite - archive
004 * %%
005 * Copyright (C) 2005 - 2014 The Royal Danish Library, the Danish State and University Library,
006 *             the National Library of France and the Austrian National Library.
007 * %%
008 * This program is free software: you can redistribute it and/or modify
009 * it under the terms of the GNU Lesser General Public License as
010 * published by the Free Software Foundation, either version 2.1 of the
011 * License, or (at your option) any later version.
012 * 
013 * This program is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016 * GNU General Lesser Public License for more details.
017 * 
018 * You should have received a copy of the GNU General Lesser Public
019 * License along with this program.  If not, see
020 * <http://www.gnu.org/licenses/lgpl-2.1.html>.
021 * #L%
022 */
023package dk.netarkivet.archive.distribute;
024
025import dk.netarkivet.archive.arcrepository.bitpreservation.AdminDataMessage;
026import dk.netarkivet.archive.arcrepository.distribute.StoreMessage;
027import dk.netarkivet.archive.bitarchive.distribute.BatchEndedMessage;
028import dk.netarkivet.archive.bitarchive.distribute.BatchMessage;
029import dk.netarkivet.archive.bitarchive.distribute.BatchReplyMessage;
030import dk.netarkivet.archive.bitarchive.distribute.GetFileMessage;
031import dk.netarkivet.archive.bitarchive.distribute.GetMessage;
032import dk.netarkivet.archive.bitarchive.distribute.HeartBeatMessage;
033import dk.netarkivet.archive.bitarchive.distribute.RemoveAndGetFileMessage;
034import dk.netarkivet.archive.bitarchive.distribute.UploadMessage;
035import dk.netarkivet.archive.checksum.distribute.CorrectMessage;
036import dk.netarkivet.archive.checksum.distribute.GetAllChecksumsMessage;
037import dk.netarkivet.archive.checksum.distribute.GetAllFilenamesMessage;
038import dk.netarkivet.archive.checksum.distribute.GetChecksumMessage;
039
040/**
041 * Interface for all classes which handles archive-related messages received from a JMS server. This is implemented with
042 * a visitor pattern: Upon receipt, the ArchiveMessageHandler.onMessage() method invokes the ArchiveMessage.accept()
043 * method on the message with itself as argument. The accept() method in turn invokes the ArchiveMessageVisitor.visit()
044 * method, using method overloading to invoke the visit method for the message received.
045 * <p>
046 * Thus to handle a message, you should subclass ArchiveMessageHandler and override the visit() method for that kind of
047 * message. You should not implement this interface in any other way.
048 */
049public interface ArchiveMessageVisitor {
050    /**
051     * This method should be overridden to handle the receipt of a message.
052     *
053     * @param msg A received message.
054     */
055    void visit(BatchEndedMessage msg);
056
057    /**
058     * This method should be overridden to handle the receipt of a message.
059     *
060     * @param msg A received message.
061     */
062    void visit(BatchMessage msg);
063
064    /**
065     * This method should be overridden to handle the receipt of a message.
066     *
067     * @param msg A received message.
068     */
069    void visit(BatchReplyMessage msg);
070
071    /**
072     * This method should be overridden to handle the receipt of a message.
073     *
074     * @param msg A received message.
075     */
076    void visit(GetFileMessage msg);
077
078    /**
079     * This method should be overridden to handle the receipt of a message.
080     *
081     * @param msg A received message.
082     */
083    void visit(GetMessage msg);
084
085    /**
086     * This method should be overridden to handle the receipt of a message.
087     *
088     * @param msg A received message.
089     */
090    void visit(HeartBeatMessage msg);
091
092    /**
093     * This method should be overridden to handle the receipt of a message.
094     *
095     * @param msg A received message.
096     */
097    void visit(StoreMessage msg);
098
099    /**
100     * This method should be overridden to handle the receipt of a message.
101     *
102     * @param msg A received message.
103     */
104    void visit(UploadMessage msg);
105
106    /**
107     * This method should be overridden to handle the receipt of a message.
108     *
109     * @param msg A received message.
110     */
111    void visit(AdminDataMessage msg);
112
113    /**
114     * This method should be overridden to handle the receipt of a message.
115     *
116     * @param msg A received message.
117     */
118    void visit(RemoveAndGetFileMessage msg);
119
120    /**
121     * This method should be overridden to handle the receipt of a message.
122     *
123     * @param msg A received message.
124     */
125    void visit(GetChecksumMessage msg);
126
127    /**
128     * This method should be overridden to handle the receipt of a message.
129     *
130     * @param msg A received message.
131     */
132    void visit(GetAllChecksumsMessage msg);
133
134    /**
135     * This method should be overridden to handle the receipt of a message.
136     *
137     * @param msg A received message.
138     */
139    void visit(CorrectMessage msg);
140
141    /**
142     * This method should be overridden to handle the receipt of a message.
143     *
144     * @param msg A received message.
145     */
146    void visit(GetAllFilenamesMessage msg);
147}