001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018 package org.apache.geronimo.javamail.store.imap.connection; 019 import java.util.ArrayList; 020 import java.util.List; 021 022 import javax.mail.MessagingException; 023 024 /** 025 * Util class to represent an untagged response from a IMAP server 026 * 027 * @version $Rev: 594520 $ $Date: 2007-11-13 07:57:39 -0500 (Tue, 13 Nov 2007) $ 028 */ 029 public class IMAPUntaggedResponse extends IMAPResponse { 030 // the response key word 031 protected String keyword; 032 033 /** 034 * Create a reply object from a server response line (normally, untagged). This includes 035 * doing the parsing of the response line. 036 * 037 * @param response The response line used to create the reply object. 038 */ 039 public IMAPUntaggedResponse(String keyword, byte [] response) { 040 super(response); 041 this.keyword = keyword; 042 } 043 044 /** 045 * Return the KEYWORD that identifies the type 046 * of this untagged response. 047 * 048 * @return The identifying keyword. 049 */ 050 public String getKeyword() { 051 return keyword; 052 } 053 054 055 /** 056 * Test if an untagged response is of a given 057 * keyword type. 058 * 059 * @param keyword The test keyword. 060 * 061 * @return True if this is a type match, false for mismatches. 062 */ 063 public boolean isKeyword(String keyword) { 064 return this.keyword.equals(keyword); 065 } 066 } 067