Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.gateway
Class NewsgroupExporter

java.lang.Object
  extended by com.jivesoftware.forum.gateway.NewsgroupExporter
All Implemented Interfaces:
GatewayExporter

public class NewsgroupExporter
extends java.lang.Object
implements GatewayExporter

A gateway for the export of messages to a newsgroup.


Field Summary
static java.lang.String GATEWAY_APPROVE
          Used to flag forums that are read only and which should force NNTP messages through with the 'Approve' header.
static java.lang.String GATEWAY_MESSAGE_ID
          Used to flag messages in the forum with a message id specific to this gateway.
static java.lang.String GATEWAY_PARENT_ID
          Used to flag messages in the forum with a parent id specific to this gateway.
protected  javax.mail.Session session
           
 
Constructor Summary
NewsgroupExporter(ForumFactory factory, Forum forum, GatewaySettings gatewaySettings)
          Create an instance.
 
Method Summary
 void exportData(ForumMessage forumMessage)
          Export a forum message to a newsgroup.
 void exportData(ForumMessage[] forumMessages)
          Export an array of forum messages to a newsgroup.
 void exportMessage(ForumMessage forumMessage)
           
 java.lang.String getDefaultFromAddress()
          From email address to send mail from for export.
 java.lang.String getHost()
          Returns the NNTP host (eg news.example.com).
 java.util.Date getLastExport()
          Last date this exporter completed
 int getLastMessageNumberSeen()
          Used by the gateway to keep track of the last message seen.
 java.lang.String getNewsgroup()
          Retrieves the newsgroup that the gateway is going to use.
 java.lang.String getOrganization()
          Retrieves the Organization header for outbound NNTP messages.
 java.lang.String getPassword()
          Retrieves the password to be used in connecting to the NNTP server.
 int getPort()
          Returns the port number that will be used when connecting to the NNTP server.
 java.lang.String getUsername()
          Retrieves the username set for this gateway.
 boolean isAllowExportAgain()
          Return whether this gateway will allow reexporting of messages or not.
 boolean isAttachmentsEnabled()
          By default attachments are disallowed by this gateway.
 boolean isDebugEnabled()
          Returns true if debugging is turned on for the NNTP transport layer.
 boolean isEmailPrefEnabled()
          True if a user's privacy setting on their email address should be obeyed when doing an export.
 boolean isUpdateMessageIDOnExport()
          Retrieve whether the gateway will update the messageID message property stored in Jive upon export of a message.
 void setAllowExportAgain(boolean allowExportAgain)
          By default this gateway refuses to re-export a message which has previously been exported or imported or which was automatically created for threading purposes by an import gateway.
 void setAttachmentsEnabled(boolean attachmentsEnabled)
          Sets whether this gateway allows the export of attachments or not.
 void setDebugEnabled(boolean debugEnabled)
          Toggles NNTP transport layer debugging on or off.
 void setDefaultFromAddress(java.lang.String address)
          Set the from email address for message export to be used in the case of anonymous users and users who hide their information.
 void setEmailPrefEnabled(boolean enabled)
          Sets whether the user's privacy setting on their email address should be obeyed when doing an export.
 void setHost(java.lang.String host)
          Sets the NNTP host (eg news.example.com).
 void setLastMessageNumberSeen(int messageNumber)
          Used by the gateway to keep track of the last message seen.
 void setNewsgroup(java.lang.String newsgroup)
          Sets the newsgroup that this gateway is going to use.
 void setOrganization(java.lang.String organization)
          Sets the Organization header for outbound NNTP messages.
 void setPassword(java.lang.String password)
          Sets the password to be used in connecting to the NNTP server.
 void setPort(int port)
          Set the port to use when connecting to the NNTP server.
 void setUpdateMessageIDOnExport(boolean updateMessageID)
          Sets whether the gateway will update the messageID message property stored in Jive upon export of a message.
 void setUsername(java.lang.String username)
          Sets the username to be used in connecting to the NNTP server.
 void stop()
          Stop a running export.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

protected javax.mail.Session session

GATEWAY_MESSAGE_ID

public static final java.lang.String GATEWAY_MESSAGE_ID
Used to flag messages in the forum with a message id specific to this gateway.

See Also:
Constant Field Values

GATEWAY_PARENT_ID

public static final java.lang.String GATEWAY_PARENT_ID
Used to flag messages in the forum with a parent id specific to this gateway.

See Also:
Constant Field Values

GATEWAY_APPROVE

public static final java.lang.String GATEWAY_APPROVE
Used to flag forums that are read only and which should force NNTP messages through with the 'Approve' header.

See Also:
Constant Field Values
Constructor Detail

NewsgroupExporter

public NewsgroupExporter(ForumFactory factory,
                         Forum forum,
                         GatewaySettings gatewaySettings)
                  throws java.lang.IllegalStateException
Create an instance.

Throws:
java.lang.IllegalStateException
Method Detail

exportData

public void exportData(ForumMessage forumMessage)
                throws GatewayException
Export a forum message to a newsgroup.

NOTE: It is imperative that parent messages get exported prior to children messages so that the proper message headers can be set. Failure to do this will result in messages that may not be threaded properly when viewed using a newsreader.

Specified by:
exportData in interface GatewayExporter
Parameters:
forumMessage - message to export.
Throws:
GatewayException - if a connection was unable to be established.

exportData

public void exportData(ForumMessage[] forumMessages)
                throws GatewayException
Export an array of forum messages to a newsgroup.

NOTE: It is imperative that parent messages get exported prior to children messages so that the proper message headers can be set. Failure to do this will result in messages that may not be threaded properly when viewed using a newsreader. Therefore, parent messages should be first in the list.

Specified by:
exportData in interface GatewayExporter
Parameters:
forumMessages - array of messages to export, sorted parents first.
Throws:
GatewayException - if a connection was unable to be established.

exportMessage

public void exportMessage(ForumMessage forumMessage)
                   throws javax.mail.MessagingException,
                          GatewayException,
                          UnauthorizedException
Throws:
javax.mail.MessagingException
GatewayException
UnauthorizedException

stop

public void stop()
          throws GatewayException
Description copied from interface: GatewayExporter
Stop a running export.

Specified by:
stop in interface GatewayExporter
Throws:
GatewayException

getUsername

public java.lang.String getUsername()
Retrieves the username set for this gateway. Default is null.

Returns:
username the username to be used in connecting to the NNTP server.

setUsername

public void setUsername(java.lang.String username)
Sets the username to be used in connecting to the NNTP server.

Parameters:
username - the username to be used in connecting to the NNTP server.

getPassword

public java.lang.String getPassword()
Retrieves the password to be used in connecting to the NNTP server. Default is null.

Returns:
the password to be used in connecting to the NNTP server.

setPassword

public void setPassword(java.lang.String password)
Sets the password to be used in connecting to the NNTP server.

Parameters:
password - the password to use be used in connecting to the NNTP server.

getPort

public int getPort()
Returns the port number that will be used when connecting to the NNTP server. The default is 119, the standard NNTP port number.

Returns:
the port number that will be used when connecting to the NNTP server.

setPort

public void setPort(int port)
Set the port to use when connecting to the NNTP server. The default is port 119; for ssl the normal port to use is 993.

Parameters:
port - the port to use when connecting to the NNTP server. The default is port 119.

getHost

public java.lang.String getHost()
Returns the NNTP host (eg news.example.com). The host is null by default, but must be set before gateway exports can execute.

Returns:
the NNTP host (eg news.example.com).

setHost

public void setHost(java.lang.String host)
Sets the NNTP host (eg news.example.com). The host is null by default, but must be set before gateway exports can execute.

Parameters:
host - the NNTP host (eg news.example.com) to use.

getNewsgroup

public java.lang.String getNewsgroup()
Retrieves the newsgroup that the gateway is going to use.

Returns:
the newsgroup that the gateway will use.

setNewsgroup

public void setNewsgroup(java.lang.String newsgroup)
Sets the newsgroup that this gateway is going to use.

Parameters:
newsgroup - the newsgroup the gateway is going to use.

isDebugEnabled

public boolean isDebugEnabled()
Returns true if debugging is turned on for the NNTP transport layer. Debug information is written to System.out.err.

Returns:
true if NNTP debugging is turned on, false otherwise.

setDebugEnabled

public void setDebugEnabled(boolean debugEnabled)
Toggles NNTP transport layer debugging on or off. Debug information is written to System.out

Parameters:
debugEnabled - true if NNTP debugging should be enabled, false otherwise.

isEmailPrefEnabled

public boolean isEmailPrefEnabled()
True if a user's privacy setting on their email address should be obeyed when doing an export.

Returns:
true if a user's privacy setting on their email address should be obeyed when doing an export.

setEmailPrefEnabled

public void setEmailPrefEnabled(boolean enabled)
Sets whether the user's privacy setting on their email address should be obeyed when doing an export.

Parameters:
enabled - true if a user's privacy setting on their email address should be obeyed when doing an export.

getDefaultFromAddress

public java.lang.String getDefaultFromAddress()
From email address to send mail from for export. Used in the case of anonymous users and users who hide their information.

Returns:
the current sender.

setDefaultFromAddress

public void setDefaultFromAddress(java.lang.String address)
Set the from email address for message export to be used in the case of anonymous users and users who hide their information.

Parameters:
address - the from email address.

getOrganization

public java.lang.String getOrganization()
Retrieves the Organization header for outbound NNTP messages. Default is null.

Returns:
the current organization header.

setOrganization

public void setOrganization(java.lang.String organization)
Sets the Organization header for outbound NNTP messages.

Parameters:
organization - the string to set the organization header to.

setLastMessageNumberSeen

public void setLastMessageNumberSeen(int messageNumber)
Used by the gateway to keep track of the last message seen. This allows for fast updates since we can ask the NNTP server for only the messages newer than the message associated with this message number.

It is *highly* recommended not to set this yourself.

Parameters:
messageNumber - the last message number seen by this gateway.

getLastMessageNumberSeen

public int getLastMessageNumberSeen()
Used by the gateway to keep track of the last message seen. This allows for fast updates since we can ask the NNTP server for only the messages newer than the message associated with this message number.

It is *highly* recommended not to set this but rather let the gateway handle it itself.

Returns:
the last message number seen by this gateway.

isUpdateMessageIDOnExport

public boolean isUpdateMessageIDOnExport()
Retrieve whether the gateway will update the messageID message property stored in Jive upon export of a message. By default, the messageID is stored in Jive so that the message won't be reexported accidentally.

Note: This setting has no effect unless accompanied by setAllowExportAgain(true).

Returns:
true if the gateway will update Jive with the messageID on export, false otherwise.

setUpdateMessageIDOnExport

public void setUpdateMessageIDOnExport(boolean updateMessageID)
Sets whether the gateway will update the messageID message property stored in Jive upon export of a message. By default, the messageID is stored in Jive so that the message won't be reexported accidentally.

Note: This setting has no effect unless accompanied by setAllowExportAgain(true).

Parameters:
updateMessageID - true if Jive should be updated with the messageID of exported messages, false otherwise.

isAllowExportAgain

public boolean isAllowExportAgain()
Return whether this gateway will allow reexporting of messages or not. Default is false.

Returns:
true if reexporting a message is allowed, false otherwise.

setAllowExportAgain

public void setAllowExportAgain(boolean allowExportAgain)
By default this gateway refuses to re-export a message which has previously been exported or imported or which was automatically created for threading purposes by an import gateway.

However this can be overridden so that messages can be re-exported again if absolutely needed. Definite care is needed if you set the property to true.

Please note however that dummy messages will *never* be exported.

Parameters:
allowExportAgain - true if messages should be allowed to be reexported, false otherwise.

isAttachmentsEnabled

public boolean isAttachmentsEnabled()
By default attachments are disallowed by this gateway.

Returns:
true if attachments are allowed, false otherwise.

setAttachmentsEnabled

public void setAttachmentsEnabled(boolean attachmentsEnabled)
Sets whether this gateway allows the export of attachments or not. If true attachments are allowed, otherwise attachments will be stripped before exporting a message.

Parameters:
attachmentsEnabled - true is attachments are allowed, false otherwise.

getLastExport

public java.util.Date getLastExport()
Description copied from interface: GatewayExporter
Last date this exporter completed

Specified by:
getLastExport in interface GatewayExporter
Returns:
the last date this exporter completed

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.