    View Javadoc
    1   package org.apache.commons.net.nntp;
    2
    3   /* ====================================================================
    4    * The Apache Software License, Version 1.1
    5    *
    6    * Copyright (c) 2001 The Apache Software Foundation.  All rights
    7    * reserved.
    8    *
    9    * Redistribution and use in source and binary forms, with or without
    10   * modification, are permitted provided that the following conditions
    11   * are met:
    12   *
    13   * 1. Redistributions of source code must retain the above copyright
    14   *    notice, this list of conditions and the following disclaimer.
    15   *
    16   * 2. Redistributions in binary form must reproduce the above copyright
    17   *    notice, this list of conditions and the following disclaimer in
    18   *    the documentation and/or other materials provided with the
    19   *    distribution.
    20   *
    21   * 3. The end-user documentation included with the redistribution,
    22   *    if any, must include the following acknowledgment:
    23   *       "This product includes software developed by the
    24   *        Apache Software Foundation (http://www.apache.org/)."
    25   *    Alternately, this acknowledgment may appear in the software itself,
    26   *    if and wherever such third-party acknowledgments normally appear.
    27   *
    28   * 4. The names "Apache" and "Apache Software Foundation" and
    29   *    "Apache Commons" must not be used to endorse or promote products
    30   *    derived from this software without prior written permission. For
    31   *    written permission, please contact apache@apache.org.
    32   *
    33   * 5. Products derived from this software may not be called "Apache",
    34   *    nor may "Apache" appear in their name, without
    35   *    prior written permission of the Apache Software Foundation.
    36   *
    37   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    38   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    39   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    40   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
    41   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    42   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    43   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    44   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    45   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    46   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    47   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    48   * SUCH DAMAGE.
    49   * ====================================================================
    50   *
    51   * This software consists of voluntary contributions made by many
    52   * individuals on behalf of the Apache Software Foundation.  For more
    53   * information on the Apache Software Foundation, please see
    54   * <http://www.apache.org/>;.
    55   */
    56
    57  /****
    58   * NewsgroupInfo stores information pertaining to a newsgroup returned by
    59   * the NNTP GROUP, LIST, and NEWGROUPS commands, implemented by
    60   * <a href="org.apache.commons.net.nntp.NNTPClient.html#selectNewsgroup">
    61   * selectNewsgroup </a>,
    62   * <a href="org.apache.commons.net.nntp.NNTPClient.html#listNewsgroups">
    63   * listNewsgroups </a>, and
    64   * <a href="org.apache.commons.net.nntp.NNTPClient.html#listNewNewsgroups">
    65   * listNewNewsgroups </a> respectively.
    66   * <p>
    67   * <p>
    68   * @author Daniel F. Savarese
    69   * @see NNTPClient
    70   ***/
    71
    72  public final class NewsgroupInfo
    73  {
    74      /****
    75       * A constant indicating that the posting permission of a newsgroup is
    76       * unknown.  For example, the NNTP GROUP command does not return posting
    77       * information, so NewsgroupInfo instances obtained from that command
    78       * willhave an UNKNOWN_POSTING_PERMISSION.
    79       ***/
    80      public static final int UNKNOWN_POSTING_PERMISSION = 0;
    81
    82      /**** A constant indicating that a newsgroup is moderated. ***/
    83      public static final int MODERATED_POSTING_PERMISSION = 1;
    84
    85      /**** A constant indicating that a newsgroup is public and unmoderated. ***/
    86      public static final int PERMITTED_POSTING_PERMISSION = 2;
    87
    88      /****
    89       * A constant indicating that a newsgroup is closed for general posting.
    90       ***/
    91      public static final int PROHIBITED_POSTING_PERMISSION = 3;
    92
    93      private String __newsgroup;
    94      private int __estimatedArticleCount;
    95      private int __firstArticle, __lastArticle;
    96      private int __postingPermission;
    97
    98      void _setNewsgroup(String newsgroup)
    99      {
    100         __newsgroup = newsgroup;
    101     }
    102
    103     void _setArticleCount(int count)
    104     {
    105         __estimatedArticleCount = count;
    106     }
    107
    108     void _setFirstArticle(int first)
    109     {
    110         __firstArticle = first;
    111     }
    112
    113     void _setLastArticle(int last)
    114     {
    115         __lastArticle = last;
    116     }
    117
    118     void _setPostingPermission(int permission)
    119     {
    120         __postingPermission = permission;
    121     }
    122
    123     /****
    124      * Get the newsgroup name.
    125      * <p>
    126      * @return The name of the newsgroup.
    127      ***/
    128     public String getNewsgroup()
    129     {
    130         return __newsgroup;
    131     }
    132
    133     /****
    134      * Get the estimated number of articles in the newsgroup.  The
    135      * accuracy of this value will depend on the server implementation.
    136      * <p>
    137      * @return The estimated number of articles in the newsgroup.
    138      ***/
    139     public int getArticleCount()
    140     {
    141         return __estimatedArticleCount;
    142     }
    143
    144     /****
    145      * Get the number of the first article in the newsgroup.
    146      * <p>
    147      * @return The number of the first article in the newsgroup.
    148      ***/
    149     public int getFirstArticle()
    150     {
    151         return __firstArticle;
    152     }
    153
    154     /****
    155      * Get the number of the last article in the newsgroup.
    156      * <p>
    157      * @return The number of the last article in the newsgroup.
    158      ***/
    159     public int getLastArticle()
    160     {
    161         return __lastArticle;
    162     }
    163
    164     /****
    165      * Get the posting permission of the newsgroup.  This will be one of
    166      * the <code> POSTING_PERMISSION </code> constants.
    167      * <p>
    168      * @return The posting permission status of the newsgroup.
    169      ***/
    170     public int getPostingPermission()
    171     {
    172         return __postingPermission;
    173     }
    174
    175     /*
    176     public String toString() {
    177       StringBuffer buffer = new StringBuffer();
    178       buffer.append(__newsgroup);
    179       buffer.append(' ');
    180       buffer.append(__lastArticle);
    181       buffer.append(' ');
    182       buffer.append(__firstArticle);
    183       buffer.append(' ');
    184       switch(__postingPermission) {
    185         case 1: buffer.append('m'); break;
    186         case 2: buffer.append('y'); break;
    187         case 3: buffer.append('n'); break;
    188       }
    189       return buffer.toString();
    190 }
    191     */
    192 }

This page was automatically generated by Maven