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