|
Project Wonder 2.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object er.extensions.ERXFrameworkPrincipal er.javamail.ERJavaMail
ERJavaMail
is the prinicpal class for the ERJavaMail framework.
Field Summary | |
protected String |
_adminEmail
email address used when centralizeMails == true Needed when debugging application so that mails are always sent to only one destination. |
protected boolean |
_centralize
Used to send mail to adminEmail only. |
protected boolean |
_debugEnabled
This property specify wether JavaMail is debug enabled or not. |
protected javax.mail.Session |
_defaultSession
This is the deafult JavaMail Session. |
protected String |
_defaultXMailerHeader
This property sets the default header for the X-Mailer property |
protected org.apache.oro.text.regex.Perl5Matcher |
_matcher
The Jakarta ORO regexp matcher. |
protected int |
_milliSecondsWaitIfSenderOverflowed
Wait n milliseconds (by default this value is 6000) if the mail sender is overflowed |
protected org.apache.oro.text.regex.Pattern |
_pattern
The compiled form of the EMAIL_VALIDATION_PATTERN
pattern. |
protected int |
_senderQueueSize
Number of messages that the sender queue can hold at a time; default to 50 messages and can be configured by er.javamail.senderQueue.size system property. |
protected EOOrQualifier |
blackListQualifier
holds the black list qualifier |
protected NSArray |
blakListEmailAddressPatterns
holds the array of black list email addresses |
protected static String |
EMAIL_VALIDATION_PATTERN
EMAIL_VALIDATION_PATTERN is a regexp pattern that
is used to validate emails. |
protected static ERJavaMail |
sharedInstance
ERJavaMail class singleton. |
protected NSArray |
whiteListEmailAddressPatterns
holds the array of white list email addresses |
protected EOOrQualifier |
whiteListQualifier
holds the white list qualifier |
Constructor Summary | |
ERJavaMail()
|
Method Summary | |
String |
adminEmail()
admin email accessor. |
NSArray |
blackListEmailAddressPatterns()
Gets the array of black list email address patterns. |
EOOrQualifier |
blackListQualifier()
Gets the Or qualifier to match any of the patterns in the black list. |
boolean |
centralize()
Centralize is used to send all the outbound email to a single address which is useful when debugging. |
boolean |
debugEnabled()
Returns true if JavaMail is debug enabled. |
javax.mail.Session |
defaultSession()
This is the deafult JavaMail Session accessor. |
String |
defaultXMailerHeader()
Gets the default X-Mailer header to use for sending mails. |
NSArray |
filterEmailAddresses(NSArray emailAddresses)
Filters an array of email addresses by the black and white lists. |
void |
finishInitialization()
Specialized implementation of the method from ERXPrincipalClass. |
boolean |
hasBlackList()
Determines if a black list has been specified |
boolean |
hasWhiteList()
Determines if a white list has been specified |
void |
initializeFrameworkFromSystemProperties()
This method is used to initialize ERJavaMail from System properties. |
boolean |
isValidEmail(String email)
Predicate used to validate email well-formness. |
int |
milliSecondsWaitIfSenderOverflowed()
This method return the time spent waiting if the mail queue if overflowed. |
javax.mail.Session |
newSession()
Returns a newly allocated Session object from the System Properties |
javax.mail.Session |
newSession(Properties props)
Returns a newly allocated Session object from the given Properties |
protected EOOrQualifier |
qualifierArrayForEmailPatterns(NSArray emailPatterns)
Constructs an Or qualifier for filtering an array of strings that might have the * wildcard character. |
int |
senderQueueSize()
|
void |
setAdminEmail(String adminEmail)
Sets the admin email to another value. |
void |
setCentralize(boolean centralize)
Sets the value of the er.javamail.centralize
Property. |
void |
setDebugEnabled(boolean debug)
Sets the debug mode of JavaMail. |
void |
setDefaultSession(javax.mail.Session session)
Sets the default JavaMail session to a particular value. |
void |
setDefaultXMailerHeader(String header)
Sets the default value of the XMailer header used when sending mails. |
void |
setMilliSecondsWaitIfSenderOverflowed(int value)
Sets the value of the er.javamail.milliSecondsWaitIfSenderOverflowed
Property. |
void |
setSenderQueueSize(int value)
|
protected void |
setupSmtpHostSafely()
Helper method to init the smtpHost property. |
static ERJavaMail |
sharedInstance()
Accessor to the ERJavaMail singleton. |
String |
validateEmail(EOEnterpriseObject object,
String key,
String email)
Validates an enterprise object's email attribute (accessed via key). |
NSArray |
whiteListEmailAddressPatterns()
Gets the array of white list email address patterns. |
EOOrQualifier |
whiteListQualifier()
Whilte list Or qualifier to match any of the patterns in the white list. |
Methods inherited from class er.extensions.ERXFrameworkPrincipal |
finishInitialization, log, setUpFrameworkPrincipalClass, sharedInstance |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static ERJavaMail sharedInstance
protected static final String EMAIL_VALIDATION_PATTERN
EMAIL_VALIDATION_PATTERN
is a regexp pattern that
is used to validate emails.
protected org.apache.oro.text.regex.Perl5Matcher _matcher
protected org.apache.oro.text.regex.Pattern _pattern
EMAIL_VALIDATION_PATTERN
pattern.
protected javax.mail.Session _defaultSession
protected String _adminEmail
protected boolean _debugEnabled
protected String _defaultXMailerHeader
protected boolean _centralize
protected int _senderQueueSize
er.javamail.senderQueue.size
system property.
protected int _milliSecondsWaitIfSenderOverflowed
protected NSArray whiteListEmailAddressPatterns
protected NSArray blakListEmailAddressPatterns
protected EOOrQualifier whiteListQualifier
protected EOOrQualifier blackListQualifier
Constructor Detail |
public ERJavaMail()
Method Detail |
public static ERJavaMail sharedInstance()
ERJavaMail
instancepublic void finishInitialization()
finishInitialization
in class ERXFrameworkPrincipal
public void initializeFrameworkFromSystemProperties()
protected void setupSmtpHostSafely()
er.javamail.smtpHost
is set. If
it is not set, then it looks for mail.smtp.host
(standard JavaMail property) and finally the WOSMTPHost
property.
When a correct property is
found, then it sets both properties to the found value. If no
properties are found, a RuntimeException is thrown.
RuntimeException
- if neither one of
er.javamail.smtpHost
, mail.smtp.host
or WOSMTPHost
is set.public void setDefaultSession(javax.mail.Session session)
session
- the default javax.mail.Session
public javax.mail.Session defaultSession()
javax.mail.Session
instancepublic javax.mail.Session newSession(Properties props)
props
- a Properties
value
javax.mail.Session
value initialized
from the given propertiespublic javax.mail.Session newSession()
javax.mail.Session
valuepublic String adminEmail()
String
valuepublic void setAdminEmail(String adminEmail)
er.javamail.adminEmail
Property.
adminEmail
- a String
valuepublic boolean debugEnabled()
true
if JavaMail is debug enabled.
boolean
valuepublic void setDebugEnabled(boolean debug)
debug
- a boolean
value sets JavaMail in
debug modepublic String defaultXMailerHeader()
public void setDefaultXMailerHeader(String header)
header
- a String
valuepublic boolean centralize()
boolean
valuepublic void setCentralize(boolean centralize)
er.javamail.centralize
Property.
centralize
- if the boolean value is true, then all the
outbound mails will be sent to adminEmail
email
address.public int senderQueueSize()
public void setSenderQueueSize(int value)
public int milliSecondsWaitIfSenderOverflowed()
int
valuepublic void setMilliSecondsWaitIfSenderOverflowed(int value)
er.javamail.milliSecondsWaitIfSenderOverflowed
Property.
value
- an int
value in milli-seconds.public String validateEmail(EOEnterpriseObject object, String key, String email)
object
- the object to be validatedkey
- the attribute's nameemail
- the email value
public boolean isValidEmail(String email)
email
- the email String value to validate
public boolean hasWhiteList()
public boolean hasBlackList()
public NSArray whiteListEmailAddressPatterns()
public NSArray blackListEmailAddressPatterns()
public EOOrQualifier whiteListQualifier()
public EOOrQualifier blackListQualifier()
protected EOOrQualifier qualifierArrayForEmailPatterns(NSArray emailPatterns)
emailPatterns
- array of email patterns
public NSArray filterEmailAddresses(NSArray emailAddresses)
emailAddresses
- array of email addresses to be filtered
|
Last updated: Do, Dez 9, 2004 12:46 PM CET | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |