1 /* 2 * Copyright (c) 2004-2007 Creative Sphere Limited. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * 10 * Creative Sphere - initial API and implementation 11 * 12 */ 13 package org.abstracthorizon.mercury.imap.cmd; 14 15 import java.io.IOException; 16 17 import javax.mail.MessagingException; 18 import javax.mail.internet.MimeMessage; 19 20 import org.abstracthorizon.mercury.imap.IMAPSession; 21 import org.abstracthorizon.mercury.imap.util.MessageProcessor; 22 23 /** 24 * A super class for all commands that can be invoked by UID prefix 25 * (Copy, Fetch, Search and Store) 26 * 27 * @author Daniel Sendula 28 */ 29 30 public abstract class UIDCommand extends IMAPCommand implements MessageProcessor { 31 32 /** Run as UID command */ 33 protected boolean asuid = false; 34 35 /** 36 * Constructor 37 * @param mnemonic mnemonic 38 */ 39 public UIDCommand(String mnemonic) { 40 super(mnemonic); 41 } 42 43 /** 44 * Marks to run command as UID command 45 */ 46 public void setAsUID() { 47 asuid = true; 48 } 49 50 /** 51 * Template method to be implementd to process each individial message 52 * @param session session 53 * @param m message 54 * @throws IOException 55 * @throws MessagingException 56 */ 57 public abstract void process(IMAPSession session, MimeMessage m) throws IOException, MessagingException; 58 59 }