Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.nntp.spi
Class FMessageArticleAdapter

java.lang.Object
  extended by com.jivesoftware.forum.nntp.spi.FMessageArticleAdapter
All Implemented Interfaces:
Article

public class FMessageArticleAdapter
extends java.lang.Object
implements Article

A set-and-forget wrapper that adapts a forum message to an NNTP article. The passed in message will be used by the article in a per-NNTP-protocol-command basis. New NNTP commands will retrieve a fresh ForumMessage and wrap a new adapter (so don't worry about saving state, caching, or stale data for the given message). It will be common for the NNTP system to call several access methods on the message (e.g. will get the subject, author, and message-id).


Constructor Summary
FMessageArticleAdapter(DbForumMessage msg)
          Create an NNTP Article by wrapping the given forum message.
 
Method Summary
 java.lang.String getAuthor()
          Format an author field as a Header response.
 int getByteCount()
          Returns the number of bytes in the article including line terminating <CR-LF> pairs the two extra <CR-LF> pairs separating message body and article body.
 java.lang.String getDate()
          Obtain the Date the article was posted.
 java.lang.String getHead()
          Populate the header information with essential information (author, subject, groups, date, references).
 int getLineCount()
          Returns the number of lines in the article including headers and blank line between headers and body.
 java.lang.String getMessageID()
          Obtain the article's Message-ID.
 java.lang.String getNewsGroups()
          Obtain the comma separated list newsgroups this article is posted to.
 int getNumber()
          Obtain the article number of the article.
 java.lang.String getReferences()
          Adds the previous forum message ID as a reference or an empty string if no forum message proceeds this one in the thread.
 java.lang.String getSubject()
          Obtain the subject of the article.
 void sendArticle(NNTPResponseBuffer response)
          Sends the entire article.
 void sendBody(NNTPResponseBuffer response)
          Populate the body text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FMessageArticleAdapter

public FMessageArticleAdapter(DbForumMessage msg)

Create an NNTP Article by wrapping the given forum message.

Parameters:
msg - The message to wrap
Method Detail

getNumber

public int getNumber()
Description copied from interface: Article

Obtain the article number of the article. The article number is only relevant when the article was obtained from within the context of an article pointer with valid group. Accessing this method outside of that context, of after the article pointer has been moved can result in exceptions.

Specified by:
getNumber in interface Article
Returns:
the article number.

getMessageID

public java.lang.String getMessageID()
Obtain the article's Message-ID. We use the forum message's unique ID as it's message ID. The result should be a standard message ID (arbitrary but unique string inside of angle brackets).

Specified by:
getMessageID in interface Article
Returns:
the message ID for the article.

getSubject

public java.lang.String getSubject()
Description copied from interface: Article

Obtain the subject of the article.

This method MUST NOT include any tab or end of line characters. Any such character in this field must be converted to spaces.

Specified by:
getSubject in interface Article
Returns:
the message subject found in the Subject: header

getAuthor

public java.lang.String getAuthor()
Format an author field as a Header response. The poster's name followed by their email in angle brackets is used.

Specified by:
getAuthor in interface Article
Returns:
the author name formatted as a standard header response.

getDate

public java.lang.String getDate()
Description copied from interface: Article

Obtain the Date the article was posted.

Dates must be formatted as standard RFC 822 dates:

Thu Sep 26, 2003 10:43:11 US/Pacific

This method MUST NOT include any tab characters. Any tab character in this field must be converted to spaces.

Specified by:
getDate in interface Article
Returns:
the message date found in the Date: header.

getReferences

public java.lang.String getReferences()
Adds the previous forum message ID as a reference or an empty string if no forum message proceeds this one in the thread.

Specified by:
getReferences in interface Article
Returns:
the comma separated references this article follows (can be empty).

getNewsGroups

public java.lang.String getNewsGroups()
Description copied from interface: Article

Obtain the comma separated list newsgroups this article is posted to. The list should be generated from the Newsgroups: header of the article (a required header field of all NNTP articles).

This method MUST NOT include any tab characters. Any tab character in this field must be converted to spaces.

Specified by:
getNewsGroups in interface Article
Returns:
the groups the article was posted to found in the Newsgroups: header, delimited by commas.

getByteCount

public int getByteCount()
Description copied from interface: Article
Returns the number of bytes in the article including line terminating <CR-LF> pairs the two extra <CR-LF> pairs separating message body and article body.

Specified by:
getByteCount in interface Article
Returns:
the size of the message in bytes.

getLineCount

public int getLineCount()
Description copied from interface: Article
Returns the number of lines in the article including headers and blank line between headers and body.

Specified by:
getLineCount in interface Article
Returns:
the number of lines in the article.

sendArticle

public void sendArticle(NNTPResponseBuffer response)
                 throws java.io.IOException
Sends the entire article. HTML text may be nice to spruce up message presentation since forums already generates HTML although graphics would need to be attached or referenced to the web server. Currently creates a plain text message by stripping out some HTML (should be using raw text).

Specified by:
sendArticle in interface Article
Parameters:
response - the response buffer to send the article to
Throws:
java.io.IOException - if there was a failure writin the response to the underlying connection

sendBody

public void sendBody(NNTPResponseBuffer response)
              throws java.io.IOException
Populate the body text. HTML text may be nice to spruce up message presentation since forums already generates HTML although graphics would need to be attached or referenced to the web server. Currently creates a plain text message by stripping out some HTML (should be using raw text).

Specified by:
sendBody in interface Article
Parameters:
response - the response buffer to send the body of the article to
Throws:
java.io.IOException - if there was a failure writin the response to the underlying connection

getHead

public java.lang.String getHead()
Populate the header information with essential information (author, subject, groups, date, references).

Specified by:
getHead in interface Article
Returns:
The headers of the message

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.