1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.net.nntp;
17
18 /***
19 * NewsgroupInfo stores information pertaining to a newsgroup returned by
20 * the NNTP GROUP, LIST, and NEWGROUPS commands, implemented by
21 * {@link org.apache.commons.net.nntp.NNTPClient#selectNewsgroup selectNewsgroup }
22 * ,
23 * {@link org.apache.commons.net.nntp.NNTPClient#listNewsgroups listNewsgroups }
24 * , and
25 * {@link org.apache.commons.net.nntp.NNTPClient#listNewNewsgroups listNewNewsgroups }
26 * respectively.
27 * <p>
28 * <p>
29 * @author Daniel F. Savarese
30 * @see NNTPClient
31 ***/
32
33 public final class NewsgroupInfo
34 {
35 /***
36 * A constant indicating that the posting permission of a newsgroup is
37 * unknown. For example, the NNTP GROUP command does not return posting
38 * information, so NewsgroupInfo instances obtained from that command
39 * willhave an UNKNOWN_POSTING_PERMISSION.
40 ***/
41 public static final int UNKNOWN_POSTING_PERMISSION = 0;
42
43 /*** A constant indicating that a newsgroup is moderated. ***/
44 public static final int MODERATED_POSTING_PERMISSION = 1;
45
46 /*** A constant indicating that a newsgroup is public and unmoderated. ***/
47 public static final int PERMITTED_POSTING_PERMISSION = 2;
48
49 /***
50 * A constant indicating that a newsgroup is closed for general posting.
51 ***/
52 public static final int PROHIBITED_POSTING_PERMISSION = 3;
53
54 private String __newsgroup;
55 private int __estimatedArticleCount;
56 private int __firstArticle, __lastArticle;
57 private int __postingPermission;
58
59 void _setNewsgroup(String newsgroup)
60 {
61 __newsgroup = newsgroup;
62 }
63
64 void _setArticleCount(int count)
65 {
66 __estimatedArticleCount = count;
67 }
68
69 void _setFirstArticle(int first)
70 {
71 __firstArticle = first;
72 }
73
74 void _setLastArticle(int last)
75 {
76 __lastArticle = last;
77 }
78
79 void _setPostingPermission(int permission)
80 {
81 __postingPermission = permission;
82 }
83
84 /***
85 * Get the newsgroup name.
86 * <p>
87 * @return The name of the newsgroup.
88 ***/
89 public String getNewsgroup()
90 {
91 return __newsgroup;
92 }
93
94 /***
95 * Get the estimated number of articles in the newsgroup. The
96 * accuracy of this value will depend on the server implementation.
97 * <p>
98 * @return The estimated number of articles in the newsgroup.
99 ***/
100 public int getArticleCount()
101 {
102 return __estimatedArticleCount;
103 }
104
105 /***
106 * Get the number of the first article in the newsgroup.
107 * <p>
108 * @return The number of the first article in the newsgroup.
109 ***/
110 public int getFirstArticle()
111 {
112 return __firstArticle;
113 }
114
115 /***
116 * Get the number of the last article in the newsgroup.
117 * <p>
118 * @return The number of the last article in the newsgroup.
119 ***/
120 public int getLastArticle()
121 {
122 return __lastArticle;
123 }
124
125 /***
126 * Get the posting permission of the newsgroup. This will be one of
127 * the <code> POSTING_PERMISSION </code> constants.
128 * <p>
129 * @return The posting permission status of the newsgroup.
130 ***/
131 public int getPostingPermission()
132 {
133 return __postingPermission;
134 }
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153 }