01: /****************************************************************
02: * Licensed to the Apache Software Foundation (ASF) under one *
03: * or more contributor license agreements. See the NOTICE file *
04: * distributed with this work for additional information *
05: * regarding copyright ownership. The ASF licenses this file *
06: * to you under the Apache License, Version 2.0 (the *
07: * "License"); you may not use this file except in compliance *
08: * with the License. You may obtain a copy of the License at *
09: * *
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: ****************************************************************/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: }
|