View Javadoc

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.nntpserver.repository;
21  
22  import java.io.InputStream;
23  import java.util.Date;
24  import java.util.Iterator;
25  
26  /***
27   * Abstraction of entire NNTP Repository.
28   */
29  public interface NNTPRepository {
30  
31      /***
32       * Gets the group with the specified name from within the repository.
33       *
34       * @param groupName the name of the group to retrieve
35       *
36       * @return the group
37       */
38      NNTPGroup getGroup(String groupName);
39  
40      /***
41       * Gets the article with the specified id from within the repository.
42       *
43       * @param id the id of the article to retrieve
44       *
45       * @return the article
46       */
47      NNTPArticle getArticleFromID(String id);
48  
49      /***
50       * Creates an article in the repository from the data in the reader.
51       * TODO: Change this to be more OO and pass in a MimeMessage
52       *
53       * @param in the InputStream that serves as a source for the message data.
54       */
55      void createArticle(InputStream in);
56  
57      /***
58       * Gets all groups that match the wildmat string
59       *
60       * @param wildmat the wildmat parameter
61       *
62       * @return an iterator containing the groups retrieved
63       */
64      Iterator getMatchedGroups(String wildmat);
65  
66      /***
67       * Gets all groups added since the specified date
68       *
69       * @param dt the Date that serves as a lower bound
70       *
71       * @return an iterator containing the groups retrieved
72       */
73      Iterator getGroupsSince(Date dt);
74  
75      /***
76       * Gets all articles posted since the specified date
77       *
78       * @param dt the Date that serves as a lower bound
79       *
80       * @return an iterator containing the articles retrieved
81       */
82      Iterator getArticlesSince(Date dt);
83  
84      /***
85       * Returns whether this repository is read only.
86       *
87       * @return whether this repository is read only
88       */
89      boolean isReadOnly();
90  
91      /***
92       * Returns the ordered array of header names (including the trailing colon on each)
93       * returned in overview format for articles stored in this repository.
94       */
95      String[] getOverviewFormat();
96  
97  }