Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.gateway
Class Pop3Importer

java.lang.Object
  extended by com.jivesoftware.forum.gateway.Pop3Importer
All Implemented Interfaces:
GatewayImporter

public class Pop3Importer
extends java.lang.Object
implements GatewayImporter

A gateway to import to a forum with the contents of an email account or a mailing list. For example, say you want to import the mailing list mail-list@example.com. To accomplish this you'd create and use a POP3 account that was subscribed to the list, for example mail-list-robot@example.com.

The following properties must be set with valid values before importing can work:

All other properties start with reasonable default values, but can be changed as necessary.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.jivesoftware.forum.gateway.GatewayImporter
GatewayImporter.Stats
 
Field Summary
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
 
Constructor Summary
Pop3Importer(ForumFactory factory, Forum forum, GatewaySettings settings)
          Create a new Pop3Importer instance.
 
Method Summary
 java.lang.String getDefaultCharacterSet()
          Returns the character set that will be used to decode inbound messages that have no explicit character set defined.
 java.lang.String getEmptySubject()
          Returns the string to be used in place of an empty subject.
 java.lang.String getHost()
          Returns the POP3 host (eg mail.example.com).
 java.util.Date getLastImport()
          Returns the Last date this importer completed
 java.lang.String getPassword()
          Returns the password that will be used when connection to the POP3 server.
 int getPort()
          Returns the port number that will be used when connecting to the POP3 server.
 java.lang.String getReplyPrefixes()
          Returns a comma seperated of prefixes that will be stripped from messages when attempting to find a parent message via subject line matching.
 GatewayImporter.Stats getStats()
           
 java.lang.String getTemporaryParentBody()
          Returns the body that will be used when creating temporary parent messages.
 java.lang.String getUsername()
          Returns the username that will be used when connection to the POP3 server.
 void importData(java.util.Date afterDate)
          Import data from the data source into the specified forum.
 boolean isAttachmentsEnabled()
          Returns true if attachments are allowed for the email transport layers.
 boolean isDebugEnabled()
          Returns true if debugging is turned on for the email transport layers.
 boolean isDeleteEnabled()
          Returns true if the POP3 delete flag is set.
 boolean isEmailToUserMappingEnabled()
          True if email address -> user mapping is enabled, false otherwise.
 boolean isImportHtmlEnabled()
          True if if the importation of html email is enabled, false otherwise.
 boolean isImporting()
           
 boolean isSSLEnabled()
          Returns true if this gateway is configured to connect to the POP3 server using an SSL encrypted connection.
 boolean isSubjectParentageCheckEnabled()
          Returns whether parentage checks will be done using subject line matching or not.
 void setAttachmentsEnabled(boolean attachmentEnabled)
          Toggles attachments on or off.
 void setDebugEnabled(boolean debugEnabled)
          Toggles SMTP transport layer debugging on or off.
 void setDefaultCharacterSet(java.lang.String defaultCharacterSet)
          Sets the character set that will be used to decode inbound messages that have no explicit character set defined.
 void setDeleteEnabled(boolean POP3DeleteEnabled)
          Toggles the POP3 delete flag.
 void setEmailToUserMappingEnabled(boolean emailToUserMappingEnabled)
          Sets whether email address -> user mapping is enabled, false otherwise.
 void setEmptySubject(java.lang.String emptySubject)
          Sets the string to be used in place of an empty subject.
 void setHost(java.lang.String host)
          Sets the POP3 host (eg mail.example.com).
 void setImportHtmlEnabled(boolean importHtmlEnabled)
          Sets whether the importation of html email is enabled.
 void setImporting(boolean importing)
           
 void setPassword(java.lang.String password)
          Sets the password that will be used when connecting to the POP3 server.
 void setPort(int port)
          Sets the port number that will be used when connecting to the POP3 server.
 void setReplyPrefixes(java.lang.String replyPrefixes)
          Sets the possible prefixes that will be stripped from messages when attempting to find a parent message via subject line matching.
 void setSSLEnabled(boolean enabled)
          Toggles SSL connections to the POP3 server on or off.
 void setSubjectParentageCheckEnabled(boolean subjectParentageCheckEnabled)
          Sets whether parentage checks will be done using subject line matching or not.
 void setTemporaryParentBody(java.lang.String temporaryParentBody)
          Sets the body that will be used when creating temporary parent messages.
 void setUsername(java.lang.String username)
          Sets the username that will be used when connecting to the POP3 server.
 void stop()
          Stop a running import.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

Pop3Importer

public Pop3Importer(ForumFactory factory,
                    Forum forum,
                    GatewaySettings settings)
Create a new Pop3Importer instance.

Method Detail

importData

public void importData(java.util.Date afterDate)
                throws GatewayException
Description copied from interface: GatewayImporter
Import data from the data source into the specified forum. For example, a concrete implementation of this interface might poll a newsgroup and add new messages to the forum.

Specified by:
importData in interface GatewayImporter
Parameters:
afterDate - the oldest cutoff date for data to import.
Throws:
GatewayException

stop

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

Specified by:
stop in interface GatewayImporter
Throws:
GatewayException

getStats

public GatewayImporter.Stats getStats()
Specified by:
getStats in interface GatewayImporter

getHost

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

Returns:
the POP3 host.

setHost

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

Parameters:
host - the POP3 host.

getPort

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

Returns:
the POP3 port number.

setPort

public void setPort(int port)
Sets the port number that will be used when connecting to the POP3 server. The default is 110, the standard POP3 port number.

Parameters:
port - the POP3 port number.

getUsername

public java.lang.String getUsername()
Returns the username that will be used when connection to the POP3 server. By default the value is null, which means that no username will be used.

Returns:
the POP3 username.

setUsername

public void setUsername(java.lang.String username)
Sets the username that will be used when connecting to the POP3 server. By default the value is null, which means that no username will be used.

Parameters:
username - the POP3 username.

getPassword

public java.lang.String getPassword()
Returns the password that will be used when connection to the POP3 server. By default the value is null, which means that no password will be used.

Returns:
the POP3 password.

setPassword

public void setPassword(java.lang.String password)
Sets the password that will be used when connecting to the POP3 server. By default the value is null, which means that no password will be used.

Parameters:
password - the POP3 password.

isDeleteEnabled

public boolean isDeleteEnabled()
Returns true if the POP3 delete flag is set. When true, messages will be deleted from the server after being downloaded. The default value is false.

Returns:
true if messages will be deleted from the POP3 server after being downloaded.

setDeleteEnabled

public void setDeleteEnabled(boolean POP3DeleteEnabled)
Toggles the POP3 delete flag. When true, messages will be deleted from the server after being downloaded. The default value is false.

Parameters:
POP3DeleteEnabled - true if messages should be deleted from the POP3 server after being downloaded.

isDebugEnabled

public boolean isDebugEnabled()
Returns true if debugging is turned on for the email transport layers. Debug information is written to System.out by the underlying JavaMail provider.

Returns:
true if debugging is turned on.

setDebugEnabled

public void setDebugEnabled(boolean debugEnabled)
Toggles SMTP transport layer debugging on or off. Debug information is written to System.out by the underlying JavaMail provider.

Parameters:
debugEnabled - true if SMTP debugging should be enabled.

isAttachmentsEnabled

public boolean isAttachmentsEnabled()
Returns true if attachments are allowed for the email transport layers.

Returns:
true if attachments are allowed.

setAttachmentsEnabled

public void setAttachmentsEnabled(boolean attachmentEnabled)
Toggles attachments on or off.

Parameters:
attachmentEnabled - true if attachments should be enabled.

isEmailToUserMappingEnabled

public boolean isEmailToUserMappingEnabled()
True if email address -> user mapping is enabled, false otherwise.

Returns:
True if email address -> user mapping is enabled, false otherwise.

setEmailToUserMappingEnabled

public void setEmailToUserMappingEnabled(boolean emailToUserMappingEnabled)
Sets whether email address -> user mapping is enabled, false otherwise.

Parameters:
emailToUserMappingEnabled - True if email address -> user mapping is enabled, false otherwise.

isImportHtmlEnabled

public boolean isImportHtmlEnabled()
True if if the importation of html email is enabled, false otherwise.

Returns:
True if if the importation of html email is enabled, false otherwise.

setImportHtmlEnabled

public void setImportHtmlEnabled(boolean importHtmlEnabled)
Sets whether the importation of html email is enabled. If it is, html email will be imported as the message body, otherwise it will be imported as an attachment.

Parameters:
importHtmlEnabled - True if the importation of html email is enabled, false otherwise.

getDefaultCharacterSet

public java.lang.String getDefaultCharacterSet()
Returns the character set that will be used to decode inbound messages that have no explicit character set defined. Default is "ISO-8859-1".

Returns:
the character set that will be used to decode inbound messages that have no explicit character set defined.

setDefaultCharacterSet

public void setDefaultCharacterSet(java.lang.String defaultCharacterSet)
Sets the character set that will be used to decode inbound messages that have no explicit character set defined.

Parameters:
defaultCharacterSet - the character set that will be used to decode inbound messages that have no explicit character set defined.

getTemporaryParentBody

public java.lang.String getTemporaryParentBody()
Returns the body that will be used when creating temporary parent messages. It's possible with email accounts and mailing lists to get a response to a message before getting the original message. If this happens and only the child message is available at the time of the gateway import, Jive must still have a way to establish a correct parent/child relationship. Therefore, a temporary fake parent message is created using an extrapolated subject from the child, and a body with the value temporaryParentBody. By default, this value will be the empty String. However, you may wish to create a short message that explains the nature of the fake parent message to the user.

On subsequent imports when a real parent message is found, the fake data will be replaced with the correct subject and body.

Returns:
the message body that will be used for temporary fake parent messages.

setTemporaryParentBody

public void setTemporaryParentBody(java.lang.String temporaryParentBody)
Sets the body that will be used when creating temporary parent messages. It's possible with email accounts and mailing lists to get a response to a message before getting the original message. If this happens and only the child message is available at the time of the gateway import, Jive must still have a way to establish a correct parent/child relationship. Therefore, a temporary fake parent message is created using an extrapolated subject from the child, and a body with the value temporaryParentBody. By default, this value will be the empty String. However, you may wish to create a short message that explains the nature of the fake parent message to the user.

On subsequent imports when a real parent message is found, the fake data will be replaced with the correct subject and body.

Parameters:
temporaryParentBody - the message body that will be used for temporary fake parent messages.

isSSLEnabled

public boolean isSSLEnabled()
Returns true if this gateway is configured to connect to the POP3 server using an SSL encrypted connection. Currently, if an encrypted connection cannot be made an unencrypted connection will be attempted.

Returns:
true if an SSL connection to the POP3 server is enabled.

setSSLEnabled

public void setSSLEnabled(boolean enabled)
Toggles SSL connections to the POP3 server on or off.

Parameters:
enabled - true if SSL connections to the POP3 server should be enabled.

getReplyPrefixes

public java.lang.String getReplyPrefixes()
Returns a comma seperated of prefixes that will be stripped from messages when attempting to find a parent message via subject line matching. Prefixes are lowercase and the default array contains 're:' and 'aw:'

Returns:
a comma seperated list of prefixes that will be stripped from messages when attempting to find a parent message via subject line matching

setReplyPrefixes

public void setReplyPrefixes(java.lang.String replyPrefixes)
Sets the possible prefixes that will be stripped from messages when attempting to find a parent message via subject line matching. Prefixes are lowercase and the default array contains 're:' and 'aw:'

Parameters:
replyPrefixes - an comma seperated string of lowercase prefixes

isSubjectParentageCheckEnabled

public boolean isSubjectParentageCheckEnabled()
Returns whether parentage checks will be done using subject line matching or not.

Returns:
whether parentage checks will be done using subject line matching or not.

setSubjectParentageCheckEnabled

public void setSubjectParentageCheckEnabled(boolean subjectParentageCheckEnabled)
Sets whether parentage checks will be done using subject line matching or not.

Parameters:
subjectParentageCheckEnabled - true if parentage checks will be done using subject line matching, false otherwise.

getEmptySubject

public java.lang.String getEmptySubject()
Returns the string to be used in place of an empty subject. Default is [No Subject].

Returns:
the string to be used in place of an empty subject.

setEmptySubject

public void setEmptySubject(java.lang.String emptySubject)
Sets the string to be used in place of an empty subject. Default is [No Subject].

Parameters:
emptySubject - the string to be used in place of an empty subject.

getLastImport

public java.util.Date getLastImport()
Description copied from interface: GatewayImporter
Returns the Last date this importer completed

Specified by:
getLastImport in interface GatewayImporter
Returns:
the last date this importer completed

isImporting

public boolean isImporting()
Specified by:
isImporting in interface GatewayImporter

setImporting

public void setImporting(boolean importing)
Specified by:
setImporting in interface GatewayImporter

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.