KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > james > nntpserver > repository > NNTPGroup


1 /***********************************************************************
2  * Copyright (c) 2000-2004 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 JavaDoc;
21 import java.io.IOException JavaDoc;
22 import java.util.Date JavaDoc;
23 import java.util.Iterator JavaDoc;
24
25 /**
26  * Contract exposed by a NewsGroup
27  *
28  */

29 public interface NNTPGroup {
30
31     /**
32      * Gets the name of the newsgroup
33      *
34      * @return the newsgroup name
35      */

36     String JavaDoc getName();
37
38     /**
39      * Gets the description of the newsgroup
40      *
41      * @return the newsgroup description
42      */

43     String JavaDoc getDescription();
44
45     /**
46      * Returns whether posting is allowed to this newsgroup
47      *
48      * @return whether posting is allowed to this newsgroup
49      */

50     boolean isPostAllowed();
51
52     /**
53      * Gets the number of articles in the group.
54      *
55      * @return the number of articles in the group.
56      */

57     int getNumberOfArticles();
58
59     /**
60      * Gets the first article number in the group.
61      *
62      * @return the first article number in the group.
63      */

64     int getFirstArticleNumber();
65
66     /**
67      * Gets the last article number in the group.
68      *
69      * @return the last article number in the group.
70      */

71     int getLastArticleNumber();
72
73     /**
74      * Gets the article with the specified article number.
75      *
76      * @param number the article number
77      *
78      * @return the article
79      */

80     NNTPArticle getArticle(int number);
81
82     /**
83      * Retrieves an iterator of articles in this newsgroup that were
84      * posted on or after the specified date.
85      *
86      * @param dt the Date that acts as a lower bound for the list of
87      * articles
88      *
89      * @return the article iterator
90      */

91     Iterator JavaDoc getArticlesSince(Date JavaDoc dt);
92
93     /**
94      * Retrieves an iterator of all articles in this newsgroup
95      *
96      * @return the article iterator
97      */

98     Iterator JavaDoc getArticles();
99
100     /**
101      * Retrieves the group information in a format consistent with
102      * a LIST or LIST ACTIVE return line
103      *
104      * @return the properly formatted string
105      */

106     String JavaDoc getListFormat();
107
108     /**
109      * Retrieves the group information in a format consistent with
110      * a LIST NEWSGROUPS return line
111      *
112      * @return the properly formatted string
113      */

114     String JavaDoc getListNewsgroupsFormat();
115
116     /**
117      * Adds an article to the group based on the data in the
118      * stream.
119      *
120      * @param newsStream the InputStream containing the article data
121      *
122      * @return the newly created article
123      */

124     NNTPArticle addArticle(InputStream JavaDoc newsStream) throws IOException JavaDoc;
125 }
126
Popular Tags