1 /************************************************************************
2 * Copyright (c) 2000-2006 The Apache Software Foundation. *
3 * All rights reserved. *
4 * ------------------------------------------------------------------- *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you *
6 * may not use this file except in compliance with the License. You *
7 * may obtain a copy of the License at: *
8 * *
9 * http://www.apache.org/licenses/LICENSE-2.0 *
10 * *
11 * Unless required by applicable law or agreed to in writing, software *
12 * distributed under the License is distributed on an "AS IS" BASIS, *
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or *
14 * implied. See the License for the specific language governing *
15 * permissions and limitations under the License. *
16 ***********************************************************************/
17
18 package org.apache.james.nntpserver.repository;
19
20 import java.io.InputStream;
21 import java.util.Date;
22 import java.util.Iterator;
23
24 /***
25 * Abstraction of entire NNTP Repository.
26 */
27 public interface NNTPRepository {
28
29 /***
30 * Gets the group with the specified name from within the repository.
31 *
32 * @param groupName the name of the group to retrieve
33 *
34 * @return the group
35 */
36 NNTPGroup getGroup(String groupName);
37
38 /***
39 * Gets the article with the specified id from within the repository.
40 *
41 * @param id the id of the article to retrieve
42 *
43 * @return the article
44 */
45 NNTPArticle getArticleFromID(String id);
46
47 /***
48 * Creates an article in the repository from the data in the reader.
49 * TODO: Change this to be more OO and pass in a MimeMessage
50 *
51 * @param in the InputStream that serves as a source for the message data.
52 */
53 void createArticle(InputStream in);
54
55 /***
56 * Gets all groups that match the wildmat string
57 *
58 * @param wildmat the wildmat parameter
59 *
60 * @return an iterator containing the groups retrieved
61 */
62 Iterator getMatchedGroups(String wildmat);
63
64 /***
65 * Gets all groups added since the specified date
66 *
67 * @param dt the Date that serves as a lower bound
68 *
69 * @return an iterator containing the groups retrieved
70 */
71 Iterator getGroupsSince(Date dt);
72
73 /***
74 * Gets all articles posted since the specified date
75 *
76 * @param dt the Date that serves as a lower bound
77 *
78 * @return an iterator containing the articles retrieved
79 */
80 Iterator getArticlesSince(Date dt);
81
82 /***
83 * Returns whether this repository is read only.
84 *
85 * @return whether this repository is read only
86 */
87 boolean isReadOnly();
88
89 /***
90 * Returns the ordered array of header names (including the trailing colon on each)
91 * returned in overview format for articles stored in this repository.
92 */
93 String[] getOverviewFormat();
94
95 }