Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.nntp.spi
Class ArticlePointerImpl

java.lang.Object
  extended by com.jivesoftware.forum.nntp.spi.ArticlePointerImpl
All Implemented Interfaces:
ArticlePointer

public class ArticlePointerImpl
extends java.lang.Object
implements ArticlePointer

Simple article pointer that uses a ForumSession to access the message store.


Constructor Summary
ArticlePointerImpl(ForumSession session)
          Create an article pointer using the given adapter.
 
Method Summary
 Article getArticle(int articleNumber)
          Obtain an article by it's article number.
 Article getArticle(java.lang.String messageID)
          Obtain an article based on it's Message-ID.
 java.util.Iterator getArticles(ArticleFilter filter)
          Obtain all articles in the current group that match the article filter criteria.
 Article getCurrentArticle()
          Obtain the Article this pointer is currently pointing to.
 int getCurrentArticleNumber()
          Obtain the number of the article currently being pointed to.
 NewsGroup getGroup()
          Obtain the group currently assigned to the pointer on null if none has been set.
 Article last()
          Moves the article pointer to the previous article in the current group.
 Article next()
          Moves the article pointer to the next article in the current group.
 NewsGroup setGroup(java.lang.String name)
          Sets the article pointer to use the given group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArticlePointerImpl

public ArticlePointerImpl(ForumSession session)
Create an article pointer using the given adapter.

Parameters:
session - The NNTP session.
Method Detail

setGroup

public NewsGroup setGroup(java.lang.String name)
                   throws NoPermissionException,
                          NewsGroupNotFoundException
Description copied from interface: ArticlePointer

Sets the article pointer to use the given group.

The successful selection response will return 220 GROUP_SELECTED otherwise 411 ENO_SUCH_GROUP is returned. Successful responses are accompanied by the article numbers of the first and last articles in the group, and an estimate of the number of articles on file in the group. It is not necessary that the estimate be correct, although that is helpful; it must only be equal to or larger than the actual number of articles on file. (Some implementations will actually count the number of articles on file. Others will just subtract first article number from last to get an estimate.)

When a valid group is selected by means of this command, the internally maintained "current article pointer" is set to the first article in the group. If an invalid group is specified, the previously selected group and article remain selected. If an empty newsgroup is selected, the "current article pointer" is in an indeterminate state and should not be used.

Note that the name of the newsgroup is not case-dependent. It must otherwise match a newsgroup obtained from the LIST command or an error will result.

Specified by:
setGroup in interface ArticlePointer
Parameters:
name - The name of the group to select
Returns:
The group that has been set
Throws:
NoPermissionException - If the caller does not have permission to get the list
NewsGroupNotFoundException - If no group matches the given name

getArticle

public Article getArticle(int articleNumber)
                   throws NoGroupSelectedException,
                          ArticleNotFoundException,
                          NoPermissionException
Description copied from interface: ArticlePointer
Obtain an article by it's article number. Successful retrieval sets the 'current article' pointer to the retrieved article.

Specified by:
getArticle in interface ArticlePointer
Parameters:
articleNumber - the article number to use in selecting the article.
Returns:
the article found.
Throws:
NoGroupSelectedException - if no group was selected before making this call.
ArticleNotFoundException - if no acticle for that number could be found.
NoPermissionException - if the caller didn't have permission to retrieve the article.

getArticle

public Article getArticle(java.lang.String messageID)
                   throws ArticleNotFoundException,
                          NoPermissionException
Description copied from interface: ArticlePointer
Obtain an article based on it's Message-ID. Successful matches does not affect the pointer.

Specified by:
getArticle in interface ArticlePointer
Parameters:
messageID - The Message-ID of the article to match.
Returns:
The article with given Message-ID.
Throws:
ArticleNotFoundException - If no article was found that has a matching message ID.
NoPermissionException - If the caller does not have permission to retrieve the article.

getCurrentArticle

public Article getCurrentArticle()
                          throws ArticleNotFoundException,
                                 NoPermissionException,
                                 ArticleNotSelectedException,
                                 NoGroupSelectedException
Description copied from interface: ArticlePointer
Obtain the Article this pointer is currently pointing to.

Specified by:
getCurrentArticle in interface ArticlePointer
Returns:
the article being pointed to.
Throws:
ArticleNotFoundException - if the current article has been deleted.
NoPermissionException - if the caller does not have permission to retrieve the article.
ArticleNotSelectedException - if no current article has been set.
NoGroupSelectedException - if no group has been selected.

getCurrentArticleNumber

public int getCurrentArticleNumber()
                            throws ArticleNotSelectedException
Description copied from interface: ArticlePointer
Obtain the number of the article currently being pointed to.

Specified by:
getCurrentArticleNumber in interface ArticlePointer
Returns:
the number of the article being pointed to.
Throws:
ArticleNotSelectedException - if no article has been selected.

getArticles

public java.util.Iterator getArticles(ArticleFilter filter)
                               throws NoGroupSelectedException,
                                      ArticleNotSelectedException,
                                      NoPermissionException,
                                      ArticleNotFoundException
Description copied from interface: ArticlePointer
Obtain all articles in the current group that match the article filter criteria.

Specified by:
getArticles in interface ArticlePointer
Parameters:
filter - The article filter to restrict the match results
Returns:
An iterator of Article objects that matched the filter
Throws:
NoGroupSelectedException - If no group is curently selected
ArticleNotSelectedException - If the filter is for the current article and none has been selected
NoPermissionException - If the caller does not have permission to get the list
ArticleNotFoundException - If the filter is for a specific article that could not be found

getGroup

public NewsGroup getGroup()
                   throws NoGroupSelectedException,
                          NoPermissionException
Description copied from interface: ArticlePointer

Obtain the group currently assigned to the pointer on null if none has been set.

Specified by:
getGroup in interface ArticlePointer
Returns:
The group the pointer is currently using, or null for none
Throws:
NoGroupSelectedException - If no group has been selected
NoPermissionException - If the caller does not have permission to get the group

last

public Article last()
             throws NoGroupSelectedException,
                    ArticleNotFoundException,
                    ArticleNotSelectedException,
                    NoPermissionException
Description copied from interface: ArticlePointer

Moves the article pointer to the previous article in the current group.

The internally maintained "current article pointer" is set to the previous article in the current newsgroup. If already positioned at the first article of the newsgroup, an error message is returned and the current article remains selected:

The internally-maintained "current article pointer" is set by this command.

On successful repositioning of the current article pointer a 223 STAT response indicating the current article number, and a message-id string will be returned. No text is sent in response to this command.

Specified by:
last in interface ArticlePointer
Returns:
the response generated from this command.
Throws:
NoGroupSelectedException - if no group is curently selected.
ArticleNotFoundException - if there is no previous article.
ArticleNotSelectedException - if no current article has been selected.
NoPermissionException - if the caller does not have permission to get the list.

next

public Article next()
             throws NoGroupSelectedException,
                    ArticleNotFoundException,
                    ArticleNotSelectedException,
                    NoPermissionException
Description copied from interface: ArticlePointer

Moves the article pointer to the next article in the current group.

The internally maintained "current article pointer" is set to the next article in the current newsgroup. If already positioned at the last article of the newsgroup, an error message is returned and the current article remains selected:

The internally-maintained "current article pointer" is set by this command.

On successful repositioning of the current article pointer a 223 STAT response indicating the current article number, and a message-id string will be returned. No text is sent in response to this command.

Specified by:
next in interface ArticlePointer
Returns:
the response generated from this command.
Throws:
NoGroupSelectedException - if no group is curently selected.
ArticleNotFoundException - if there is no next article.
ArticleNotSelectedException - if no current article has been selected.
NoPermissionException - if the caller does not have permission to get the list.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.