Fields Summary |
---|
private org.apache.avalon.framework.logger.Logger | fieldLoggerThe logger. |
private String | fieldJavaMailFolderNameThe name of the folder to fetch from the javamail provider |
private String | fieldJavaMailProviderNameThe name of the javamail provider we want to user (pop3,imap,nntp,etc...) |
private boolean | fieldFetchAllFetch both old (seen) and new messages from the mailserver. The default
is to fetch only messages the server are not marked as seen. |
private String | fieldFetchTaskNameThe unique, identifying name for this task |
private String | fieldHostThe server host name for this fetch task |
private boolean | fieldLeaveKeep retrieved messages on the remote mailserver. Normally, messages
are deleted from the folder on the mailserver after they have been retrieved |
private boolean | fieldLeaveBlacklistedKeep blacklisted messages on the remote mailserver. Normally, messages
are kept in the folder on the mailserver if they have been rejected |
private boolean | fieldLeaveRemoteRecipientKeep messages for remote recipients on the remote mailserver. Normally,
messages are kept in the folder on the mailserver if they have been
rejected. |
private boolean | fieldLeaveUserUndefinedKeep messages for undefined users on the remote mailserver. Normally,
messages are kept in the folder on the mailserver if they have been
rejected. |
private boolean | fieldLeaveUndeliverableKeep undeliverable messages on the remote mailserver. Normally,
messages are kept in the folder on the mailserver if they cannot
be delivered. |
private boolean | fieldMarkSeenMark retrieved messages on the remote mailserver as seen. Normally,
messages are marked as seen after they have been retrieved |
private boolean | fieldMarkBlacklistedSeenMark blacklisted messages on the remote mailserver as seen. Normally,
messages are not marked as seen if they have been rejected |
private boolean | fieldMarkRemoteRecipientSeenMark remote recipient messages on the remote mailserver as seen. Normally,
messages are not marked as seen if they have been rejected |
private boolean | fieldMarkUserUndefinedSeenMark messages for undefined users on the remote mail server as seen.
Normally, messages are not marked as seen if they have been rejected. |
private boolean | fieldMarkUndeliverableSeenMark undeliverable messages on the remote mail server as seen.
Normally, messages are not marked as seen if they are undeliverable. |
private boolean | fieldDeferRecipientNotFoundDefer processing of messages for which the intended recipient cannot
be determined to the next pass. |
private boolean | fieldRecurseRecurse folders if available? |
private org.apache.james.services.MailServer | fieldServerThe MailServer service |
private String | fieldDefaultDomainNameThe domain part to use to complete partial addresses |
private boolean | fieldRejectUserUndefinedOnly accept mail for defined recipients.
All other mail is rejected. |
private int | fieldRemoteReceivedHeaderIndexThe index of the received header to use to compute the remote address
and remote host name for a message. This is 0 based and defaults to -1. |
private boolean | fieldLeaveRemoteReceivedHeaderInvalidKeep messages with an invalid received header on the remote mailserver.
Normally, messages are kept in the folder on the mailserver if they have been
rejected |
private boolean | fieldMarkRemoteReceivedHeaderInvalidSeenMark messages with an invalid received header on the remote mailserver as
seen. Normally, messages are not marked as seen if they have been rejected. |
private boolean | fieldRejectRemoteReceivedHeaderInvalidReject messages with an invalid received header. |
private boolean | fieldRejectRecipientNotFoundReject messages for which a recipient could not be determined. |
private boolean | fieldLeaveRecipientNotFoundLeave messages on the server for which a recipient could not be
determined. |
private boolean | fieldMarkRecipientNotFoundSeenMark as seen messages on the server for which a recipient could not be
determined. |
private boolean | fieldRejectBlacklistedReject mail for blacklisted users |
private boolean | fieldRejectRemoteRecipientOnly accept mail for local recipients.
All other mail is rejected. |
private Set | fieldBlacklistThe Set of MailAddresses for whom mail should be rejected |
private int | fieldMaxMessageSizeLimitThe maximum message size limit
0 means no limit. |
private boolean | fieldRejectMaxMessageSizeExceededReject mail exceeding the maximum message size limit |
private boolean | fieldLeaveMaxMessageSizeExceededLeave messages on the server that exceed the maximum message size limit. |
private boolean | fieldMarkMaxMessageSizeExceededSeenMark as seen messages on the server that exceed the maximum message size
limit. |
private org.apache.james.services.UsersRepository | fieldLocalUsersThe Local Users repository |
Methods Summary |
---|
protected java.lang.String | computeDefaultDomainName()Computes the defaultDomainName.
String hostName = null;
try
{
// These shenanigans are required to get the fully qualified
// hostname prior to JDK 1.4 in which get getCanonicalHostName()
// does the job for us
InetAddress addr1 = java.net.InetAddress.getLocalHost();
InetAddress addr2 = addr1.getByName(addr1.getHostAddress());
hostName = addr2.getHostName();
}
catch (UnknownHostException ue)
{
hostName = "localhost";
}
return hostName;
|
protected void | configure(org.apache.avalon.framework.configuration.Configuration conf)
setHost(conf.getChild("host").getValue());
setFetchTaskName(conf.getAttribute("name"));
setJavaMailProviderName(
conf.getChild("javaMailProviderName").getValue());
setJavaMailFolderName(conf.getChild("javaMailFolderName").getValue());
setRecurse(conf.getChild("recursesubfolders").getValueAsBoolean());
Configuration recipientNotFound = conf.getChild("recipientnotfound");
setDeferRecipientNotFound(
recipientNotFound.getAttributeAsBoolean("defer"));
setRejectRecipientNotFound(
recipientNotFound.getAttributeAsBoolean("reject"));
setLeaveRecipientNotFound(
recipientNotFound.getAttributeAsBoolean("leaveonserver"));
setMarkRecipientNotFoundSeen(
recipientNotFound.getAttributeAsBoolean("markseen"));
Configuration defaultDomainName = conf.getChild("defaultdomain", false);
if (null != defaultDomainName)
setDefaultDomainName(defaultDomainName.getValue());
setFetchAll(conf.getChild("fetchall").getValueAsBoolean());
Configuration fetched = conf.getChild("fetched");
setLeave(fetched.getAttributeAsBoolean("leaveonserver"));
setMarkSeen(fetched.getAttributeAsBoolean("markseen"));
Configuration remoterecipient = conf.getChild("remoterecipient");
setRejectRemoteRecipient(
remoterecipient.getAttributeAsBoolean("reject"));
setLeaveRemoteRecipient(
remoterecipient.getAttributeAsBoolean("leaveonserver"));
setMarkRemoteRecipientSeen(
remoterecipient.getAttributeAsBoolean("markseen"));
Configuration blacklist = conf.getChild("blacklist");
setBlacklist(blacklist.getValue(""));
setRejectBlacklisted(blacklist.getAttributeAsBoolean("reject"));
setLeaveBlacklisted(blacklist.getAttributeAsBoolean("leaveonserver"));
setMarkBlacklistedSeen(blacklist.getAttributeAsBoolean("markseen"));
Configuration userundefined = conf.getChild("userundefined");
setRejectUserUndefined(userundefined.getAttributeAsBoolean("reject"));
setLeaveUserUndefined(
userundefined.getAttributeAsBoolean("leaveonserver"));
setMarkUserUndefinedSeen(
userundefined.getAttributeAsBoolean("markseen"));
Configuration undeliverable = conf.getChild("undeliverable");
setLeaveUndeliverable(
undeliverable.getAttributeAsBoolean("leaveonserver"));
setMarkUndeliverableSeen(
undeliverable.getAttributeAsBoolean("markseen"));
Configuration remotereceivedheader = conf.getChild("remotereceivedheader", false);
if (null != remotereceivedheader)
{
setRemoteReceivedHeaderIndex(
remotereceivedheader.getAttributeAsInteger("index"));
setRejectRemoteReceivedHeaderInvalid(
remotereceivedheader.getAttributeAsBoolean("reject"));
setLeaveRemoteReceivedHeaderInvalid(
remotereceivedheader.getAttributeAsBoolean("leaveonserver"));
setMarkRemoteReceivedHeaderInvalidSeen(
remotereceivedheader.getAttributeAsBoolean("markseen"));
}
Configuration maxmessagesize = conf.getChild("maxmessagesize", false);
if (null != maxmessagesize)
{
setMaxMessageSizeLimit(
maxmessagesize.getAttributeAsInteger("limit") * 1024);
setRejectMaxMessageSizeExceeded(
maxmessagesize.getAttributeAsBoolean("reject"));
setLeaveMaxMessageSizeExceeded(
maxmessagesize.getAttributeAsBoolean("leaveonserver"));
setMarkMaxMessageSizeExceededSeen(
maxmessagesize.getAttributeAsBoolean("markseen"));
}
if (getLogger().isDebugEnabled())
{
getLogger().info(
"Configured FetchMail fetch task " + getFetchTaskName());
}
|
public java.util.Set | getBlacklist()Returns the blacklist.
return fieldBlacklist;
|
public java.lang.String | getDefaultDomainName()Returns the defaultDomainName. Lazy initializes if required.
String defaultDomainName = null;
if (null == (defaultDomainName = getDefaultDomainNameBasic()))
{
updateDefaultDomainName();
return getDefaultDomainName();
}
return defaultDomainName;
|
private java.lang.String | getDefaultDomainNameBasic()Returns the defaultDomainName.
return fieldDefaultDomainName;
|
public java.lang.String | getFetchTaskName()Returns the fetchTaskName.
return fieldFetchTaskName;
|
public java.lang.String | getHost()Returns the host.
return fieldHost;
|
public java.lang.String | getJavaMailFolderName()Returns the javaMailFolderName.
return fieldJavaMailFolderName;
|
public java.lang.String | getJavaMailProviderName()Returns the javaMailProviderName.
return fieldJavaMailProviderName;
|
public org.apache.james.services.UsersRepository | getLocalUsers()Returns the localUsers.
return fieldLocalUsers;
|
public org.apache.avalon.framework.logger.Logger | getLogger()Returns the logger.
return fieldLogger;
|
public int | getMaxMessageSizeLimit()Returns the maxMessageSizeLimit.
return fieldMaxMessageSizeLimit;
|
public int | getRemoteReceivedHeaderIndex()Returns the remoteReceivedHeaderIndex.
return fieldRemoteReceivedHeaderIndex;
|
public org.apache.james.services.MailServer | getServer()Returns the server.
return fieldServer;
|
public boolean | isDeferRecipientNotFound()Returns the deferRecipientNotFound.
return fieldDeferRecipientNotFound;
|
public boolean | isFetchAll()Returns the fetchAll.
return fieldFetchAll;
|
public boolean | isLeave()Returns the keep.
return fieldLeave;
|
public boolean | isLeaveBlacklisted()Returns the keepRejected.
return fieldLeaveBlacklisted;
|
public boolean | isLeaveMaxMessageSizeExceeded()Returns the leaveMaxMessageSize.
return fieldLeaveMaxMessageSizeExceeded;
|
public boolean | isLeaveRecipientNotFound()Returns the leaveRecipientNotFound.
return fieldLeaveRecipientNotFound;
|
public boolean | isLeaveRemoteReceivedHeaderInvalid()Returns the leaveRemoteReceivedHeaderInvalid.
return fieldLeaveRemoteReceivedHeaderInvalid;
|
public boolean | isLeaveRemoteRecipient()Returns the leaveRemoteRecipient.
return fieldLeaveRemoteRecipient;
|
public boolean | isLeaveUndeliverable()Returns the leaveUndeliverable.
return fieldLeaveUndeliverable;
|
public boolean | isLeaveUserUndefined()Returns the leaveExternal.
return fieldLeaveUserUndefined;
|
public boolean | isMarkBlacklistedSeen()Returns the markRejectedSeen.
return fieldMarkBlacklistedSeen;
|
public boolean | isMarkMaxMessageSizeExceededSeen()Returns the markMaxMessageSizeSeen.
return fieldMarkMaxMessageSizeExceededSeen;
|
public boolean | isMarkRecipientNotFoundSeen()Returns the markRecipientNotFoundSeen.
return fieldMarkRecipientNotFoundSeen;
|
public boolean | isMarkRemoteReceivedHeaderInvalidSeen()Returns the markRemoteReceivedHeaderInvalidSeen.
return fieldMarkRemoteReceivedHeaderInvalidSeen;
|
public boolean | isMarkRemoteRecipientSeen()Returns the markRemoteRecipientSeen.
return fieldMarkRemoteRecipientSeen;
|
public boolean | isMarkSeen()Returns the markSeen.
return fieldMarkSeen;
|
public boolean | isMarkUndeliverableSeen()Returns the markUndeliverableSeen.
return fieldMarkUndeliverableSeen;
|
public boolean | isMarkUserUndefinedSeen()Returns the markExternalSeen.
return fieldMarkUserUndefinedSeen;
|
protected boolean | isOpenReadOnly()Answers true if the folder should be opened read only.
For this to be true the configuration options must not require
folder updates.
return isLeave()
&& !isMarkSeen()
&& isLeaveBlacklisted()
&& !isMarkBlacklistedSeen()
&& isLeaveRemoteRecipient()
&& !isMarkRemoteRecipientSeen()
&& isLeaveUserUndefined()
&& !isMarkUserUndefinedSeen()
&& isLeaveUndeliverable()
&& !isMarkUndeliverableSeen()
&& isLeaveMaxMessageSizeExceeded()
&& !isMarkMaxMessageSizeExceededSeen()
&& isLeaveRemoteReceivedHeaderInvalid()
&& !isMarkRemoteReceivedHeaderInvalidSeen()
;
|
public boolean | isRecurse()Returns the recurse.
return fieldRecurse;
|
public boolean | isRejectBlacklisted()Returns the rejectBlacklisted.
return fieldRejectBlacklisted;
|
public boolean | isRejectMaxMessageSizeExceeded()Returns the rejectMaxMessageSize.
return fieldRejectMaxMessageSizeExceeded;
|
public boolean | isRejectRecipientNotFound()Returns the rejectRecipientNotFound.
return fieldRejectRecipientNotFound;
|
public boolean | isRejectRemoteReceivedHeaderInvalid()Returns the rejectRemoteReceivedHeaderInvalid.
return fieldRejectRemoteReceivedHeaderInvalid;
|
public boolean | isRejectRemoteRecipient()Returns the rejectRemoteRecipient.
return fieldRejectRemoteRecipient;
|
public boolean | isRejectUserUndefined()Returns the localRecipientsOnly.
return fieldRejectUserUndefined;
|
protected void | setBlacklist(java.util.Set blacklist)Sets the blacklist.
fieldBlacklist = blacklist;
|
protected void | setBlacklist(java.lang.String blacklistValue)Sets the blacklist.
StringTokenizer st = new StringTokenizer(blacklistValue, ", \t", false);
Set blacklist = new HashSet();
String token = null;
while (st.hasMoreTokens())
{
try
{
token = st.nextToken();
blacklist.add(new MailAddress(token));
}
catch (ParseException pe)
{
throw new ConfigurationException(
"Invalid blacklist mail address specified: " + token);
}
}
setBlacklist(blacklist);
|
protected void | setDefaultDomainName(java.lang.String defaultDomainName)Validates and sets the defaultDomainName.
validateDefaultDomainName(defaultDomainName);
setDefaultDomainNameBasic(defaultDomainName);
|
private void | setDefaultDomainNameBasic(java.lang.String defaultDomainName)Sets the defaultDomainName.
fieldDefaultDomainName = defaultDomainName;
|
protected void | setDeferRecipientNotFound(boolean deferRecipientNotFound)Sets the deferRecipientNotFound.
fieldDeferRecipientNotFound = deferRecipientNotFound;
|
protected void | setFetchAll(boolean fetchAll)Sets the fetchAll.
fieldFetchAll = fetchAll;
|
protected void | setFetchTaskName(java.lang.String fetchTaskName)Sets the fetchTaskName.
fieldFetchTaskName = fetchTaskName;
|
protected void | setHost(java.lang.String host)Sets the host.
fieldHost = host;
|
protected void | setJavaMailFolderName(java.lang.String javaMailFolderName)Sets the javaMailFolderName.
fieldJavaMailFolderName = javaMailFolderName;
|
protected void | setJavaMailProviderName(java.lang.String javaMailProviderName)Sets the javaMailProviderName.
fieldJavaMailProviderName = javaMailProviderName;
|
protected void | setLeave(boolean keep)Sets the keep.
fieldLeave = keep;
|
protected void | setLeaveBlacklisted(boolean keepRejected)Sets the keepRejected.
fieldLeaveBlacklisted = keepRejected;
|
protected void | setLeaveMaxMessageSizeExceeded(boolean leaveMaxMessageSize)Sets the leaveMaxMessageSize.
fieldLeaveMaxMessageSizeExceeded = leaveMaxMessageSize;
|
protected void | setLeaveRecipientNotFound(boolean leaveRecipientNotFound)Sets the leaveRecipientNotFound.
fieldLeaveRecipientNotFound = leaveRecipientNotFound;
|
protected void | setLeaveRemoteReceivedHeaderInvalid(boolean leaveRemoteReceivedHeaderInvalid)Sets the leaveRemoteReceivedHeaderInvalid.
fieldLeaveRemoteReceivedHeaderInvalid =
leaveRemoteReceivedHeaderInvalid;
|
protected void | setLeaveRemoteRecipient(boolean leaveRemoteRecipient)Sets the leaveRemoteRecipient.
fieldLeaveRemoteRecipient = leaveRemoteRecipient;
|
protected void | setLeaveUndeliverable(boolean leaveUndeliverable)Sets the leaveUndeliverable.
fieldLeaveUndeliverable = leaveUndeliverable;
|
protected void | setLeaveUserUndefined(boolean leaveExternal)Sets the leaveExternal.
fieldLeaveUserUndefined = leaveExternal;
|
protected void | setLocalUsers(org.apache.james.services.UsersRepository localUsers)Sets the localUsers.
fieldLocalUsers = localUsers;
|
protected void | setLogger(org.apache.avalon.framework.logger.Logger logger)Sets the logger.
fieldLogger = logger;
|
protected void | setMarkBlacklistedSeen(boolean markRejectedSeen)Sets the markRejectedSeen.
fieldMarkBlacklistedSeen = markRejectedSeen;
|
protected void | setMarkMaxMessageSizeExceededSeen(boolean markMaxMessageSizeSeen)Sets the markMaxMessageSizeSeen.
fieldMarkMaxMessageSizeExceededSeen = markMaxMessageSizeSeen;
|
protected void | setMarkRecipientNotFoundSeen(boolean markRecipientNotFoundSeen)Sets the markRecipientNotFoundSeen.
fieldMarkRecipientNotFoundSeen = markRecipientNotFoundSeen;
|
protected void | setMarkRemoteReceivedHeaderInvalidSeen(boolean markRemoteReceivedHeaderInvalidSeen)Sets the markRemoteReceivedHeaderInvalidSeen.
fieldMarkRemoteReceivedHeaderInvalidSeen =
markRemoteReceivedHeaderInvalidSeen;
|
protected void | setMarkRemoteRecipientSeen(boolean markRemoteRecipientSeen)Sets the markRemoteRecipientSeen.
fieldMarkRemoteRecipientSeen = markRemoteRecipientSeen;
|
protected void | setMarkSeen(boolean markSeen)Sets the markSeen.
fieldMarkSeen = markSeen;
|
protected void | setMarkUndeliverableSeen(boolean markUndeliverableSeen)Sets the markUndeliverableSeen.
fieldMarkUndeliverableSeen = markUndeliverableSeen;
|
protected void | setMarkUserUndefinedSeen(boolean markExternalSeen)Sets the markExternalSeen.
fieldMarkUserUndefinedSeen = markExternalSeen;
|
protected void | setMaxMessageSizeLimit(int maxMessageSizeLimit)Sets the maxMessageSizeLimit.
fieldMaxMessageSizeLimit = maxMessageSizeLimit;
|
protected void | setRecurse(boolean recurse)Sets the recurse.
fieldRecurse = recurse;
|
protected void | setRejectBlacklisted(boolean rejectBlacklisted)Sets the rejectBlacklisted.
fieldRejectBlacklisted = rejectBlacklisted;
|
protected void | setRejectMaxMessageSizeExceeded(boolean rejectMaxMessageSize)Sets the rejectMaxMessageSize.
fieldRejectMaxMessageSizeExceeded = rejectMaxMessageSize;
|
protected void | setRejectRecipientNotFound(boolean rejectRecipientNotFound)Sets the rejectRecipientNotFound.
fieldRejectRecipientNotFound = rejectRecipientNotFound;
|
protected void | setRejectRemoteReceivedHeaderInvalid(boolean rejectRemoteReceivedHeaderInvalid)Sets the rejectRemoteReceivedHeaderInvalid.
fieldRejectRemoteReceivedHeaderInvalid =
rejectRemoteReceivedHeaderInvalid;
|
protected void | setRejectRemoteRecipient(boolean rejectRemoteRecipient)Sets the rejectRemoteRecipient.
fieldRejectRemoteRecipient = rejectRemoteRecipient;
|
protected void | setRejectUserUndefined(boolean localRecipientsOnly)Sets the localRecipientsOnly.
fieldRejectUserUndefined = localRecipientsOnly;
|
protected void | setRemoteReceivedHeaderIndex(int remoteReceivedHeaderIndex)Sets the remoteReceivedHeaderIndex.
fieldRemoteReceivedHeaderIndex = remoteReceivedHeaderIndex;
|
protected void | setServer(org.apache.james.services.MailServer server)Sets the server.
fieldServer = server;
|
protected void | updateDefaultDomainName()Updates the defaultDomainName.
setDefaultDomainNameBasic(computeDefaultDomainName());
|
protected void | validateDefaultDomainName(java.lang.String defaultDomainName)Validates the defaultDomainName.
if (!getServer().isLocalServer(defaultDomainName))
{
throw new ConfigurationException(
"Default domain name is not a local server: "
+ defaultDomainName);
}
|