1 /****************************************************************
2 * Licensed to the Apache Software Foundation (ASF) under one *
3 * or more contributor license agreements. See the NOTICE file *
4 * distributed with this work for additional information *
5 * regarding copyright ownership. The ASF licenses this file *
6 * to you under the Apache License, Version 2.0 (the *
7 * "License"); you may not use this file except in compliance *
8 * with the License. You may obtain a copy of the License at *
9 * *
10 * http://www.apache.org/licenses/LICENSE-2.0 *
11 * *
12 * Unless required by applicable law or agreed to in writing, *
13 * software distributed under the License is distributed on an *
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
15 * KIND, either express or implied. See the License for the *
16 * specific language governing permissions and limitations *
17 * under the License. *
18 ****************************************************************/
19
20 package org.apache.james.mailrepository.javamail;
21
22 import javax.mail.Flags;
23 import javax.mail.Folder;
24 import javax.mail.Message;
25 import javax.mail.MessagingException;
26
27 /**
28 * Interface to javax.mail.Folder functionality to be able to replace
29 * implementation or using Mocks when testing
30 */
31
32 public interface FolderInterface {
33
34 /**
35 * @see javax.mail.Folder#getMessages()
36 */
37 public Message[] getMessages() throws MessagingException;
38
39 /**
40 * @see javax.mail.Folder#getMessage(int)
41 */
42 public Message getMessage(int no) throws MessagingException;
43
44 /**
45 * @see javax.mail.Folder#getMessageCount()
46 */
47 public int getMessageCount() throws MessagingException;
48
49 /**
50 * @see javax.mail.Folder#appendMessages(Message[])
51 */
52 public void appendMessages(Message[] messages) throws MessagingException;
53
54 /**
55 * @see javax.mail.Folder#isOpen()
56 */
57 public boolean isOpen();
58
59 /**
60 * @see javax.mail.Folder#open(int)
61 */
62 public void open(int status) throws MessagingException;
63
64 /**
65 * @see javax.mail.Folder#close(boolean)
66 */
67 public void close(boolean b) throws MessagingException;
68
69 /**
70 * @see javax.mail.Folder#exists()
71 */
72 public boolean exists() throws MessagingException;
73
74 /**
75 * @see javax.mail.Folder#create(int)
76 */
77 public boolean create(int holds_messages) throws MessagingException;
78
79 /**
80 * @see javax.mail.Folder#getType()
81 */
82 public int getType() throws MessagingException;
83
84 /**
85 * @see javax.mail.Folder#getFullName()
86 */
87 public String getFullName();
88
89 /**
90 * @see javax.mail.Folder#expunge()
91 */
92 public Message[] expunge() throws MessagingException;
93
94 /**
95 * @see javax.mail.Folder#getUnreadMessageCount()
96 */
97 public int getUnreadMessageCount() throws MessagingException;
98
99 /**
100 * @see javax.mail.Folder#getNewMessageCount()
101 */
102 public int getNewMessageCount() throws MessagingException;
103
104 /**
105 * @see javax.mail.Folder#getPermanentFlags()
106 */
107 public Flags getPermanentFlags();
108
109 /**
110 * @see javax.mail.Folder#getName()
111 */
112 public String getName();
113
114 /**
115 * @see javax.mail.Folder#list(String)
116 */
117 public FolderInterface[] list(String string) throws MessagingException;
118
119 /**
120 * @see javax.mail.Folder#delete(boolean)
121 */
122 public boolean delete(boolean recurse) throws MessagingException;
123
124 /**
125 * @see javax.mail.Folder#renameTo(Folder)
126 */
127 public boolean renameTo(Folder destination) throws MessagingException;;
128
129 }