From 063284837c8c366e5502b1b0264b8eb807b61732 Mon Sep 17 00:00:00 2001 From: Joe Robinson Date: Wed, 27 Oct 2010 14:21:09 +0100 Subject: Basic upload functionality to predifined location, with basic file browser --- org/apache/commons/net/nntp/NewsgroupInfo.java | 155 +++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 org/apache/commons/net/nntp/NewsgroupInfo.java (limited to 'org/apache/commons/net/nntp/NewsgroupInfo.java') diff --git a/org/apache/commons/net/nntp/NewsgroupInfo.java b/org/apache/commons/net/nntp/NewsgroupInfo.java new file mode 100644 index 0000000..aa48d16 --- /dev/null +++ b/org/apache/commons/net/nntp/NewsgroupInfo.java @@ -0,0 +1,155 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.net.nntp; + +/*** + * NewsgroupInfo stores information pertaining to a newsgroup returned by + * the NNTP GROUP, LIST, and NEWGROUPS commands, implemented by + * {@link org.apache.commons.net.nntp.NNTPClient#selectNewsgroup selectNewsgroup } + * , + * {@link org.apache.commons.net.nntp.NNTPClient#listNewsgroups listNewsgroups } + * , and + * {@link org.apache.commons.net.nntp.NNTPClient#listNewNewsgroups listNewNewsgroups } + * respectively. + *

+ *

+ * @author Daniel F. Savarese + * @see NNTPClient + ***/ + +public final class NewsgroupInfo +{ + /*** + * A constant indicating that the posting permission of a newsgroup is + * unknown. For example, the NNTP GROUP command does not return posting + * information, so NewsgroupInfo instances obtained from that command + * willhave an UNKNOWN_POSTING_PERMISSION. + ***/ + public static final int UNKNOWN_POSTING_PERMISSION = 0; + + /*** A constant indicating that a newsgroup is moderated. ***/ + public static final int MODERATED_POSTING_PERMISSION = 1; + + /*** A constant indicating that a newsgroup is public and unmoderated. ***/ + public static final int PERMITTED_POSTING_PERMISSION = 2; + + /*** + * A constant indicating that a newsgroup is closed for general posting. + ***/ + public static final int PROHIBITED_POSTING_PERMISSION = 3; + + private String __newsgroup; + private int __estimatedArticleCount; + private int __firstArticle, __lastArticle; + private int __postingPermission; + + void _setNewsgroup(String newsgroup) + { + __newsgroup = newsgroup; + } + + void _setArticleCount(int count) + { + __estimatedArticleCount = count; + } + + void _setFirstArticle(int first) + { + __firstArticle = first; + } + + void _setLastArticle(int last) + { + __lastArticle = last; + } + + void _setPostingPermission(int permission) + { + __postingPermission = permission; + } + + /*** + * Get the newsgroup name. + *

+ * @return The name of the newsgroup. + ***/ + public String getNewsgroup() + { + return __newsgroup; + } + + /*** + * Get the estimated number of articles in the newsgroup. The + * accuracy of this value will depend on the server implementation. + *

+ * @return The estimated number of articles in the newsgroup. + ***/ + public int getArticleCount() + { + return __estimatedArticleCount; + } + + /*** + * Get the number of the first article in the newsgroup. + *

+ * @return The number of the first article in the newsgroup. + ***/ + public int getFirstArticle() + { + return __firstArticle; + } + + /*** + * Get the number of the last article in the newsgroup. + *

+ * @return The number of the last article in the newsgroup. + ***/ + public int getLastArticle() + { + return __lastArticle; + } + + /*** + * Get the posting permission of the newsgroup. This will be one of + * the POSTING_PERMISSION constants. + *

+ * @return The posting permission status of the newsgroup. + ***/ + public int getPostingPermission() + { + return __postingPermission; + } + + /* + public String toString() { + StringBuffer buffer = new StringBuffer(); + buffer.append(__newsgroup); + buffer.append(' '); + buffer.append(__lastArticle); + buffer.append(' '); + buffer.append(__firstArticle); + buffer.append(' '); + switch(__postingPermission) { + case 1: buffer.append('m'); break; + case 2: buffer.append('y'); break; + case 3: buffer.append('n'); break; + } + return buffer.toString(); +} + */ +} -- cgit v1.2.3