|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
ejel.SenderEngine
public class SenderEngine
The EMMR Java Emailer Library Sender Engine Class
| Nested Class Summary | |
|---|---|
static class |
SenderEngine.RecipientsType
Define the recipients type of the emails to send |
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
static long |
SLEEP_TIME
Sleep time in millis while waiting for an event |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
SenderEngine(Email emailMsg,
int rcptPerEmail,
int maxCon)
SenderEngine objects constructor |
|
| Method Summary | |
|---|---|
boolean |
abortEngine()
Raises the EventID.EID_ABORTED and abort the mass mailing operation |
void |
addAttachment(java.lang.String fileName)
Adds a new attachment file to the main list for the mass mailing operation |
int |
addAttachments(Attachment[] atchmnts)
Adds new Attachment objects into the main attachments list |
void |
addEmailAccount(EmailAccount account)
Adds a new EmailAccount object in the main list for the mass mailing operation |
int |
addEmailAccounts(EmailAccount[] accounts)
Adds new EmailAccount objects to the email accounts mail list |
void |
addExtraHeader(java.lang.String header)
Adds an extra header to be included in each sent email |
int |
addExtraHeaders(java.lang.String[] headers)
Adds new headers to the main email headers list |
void |
addRecipient(Recipient recipient)
Add a new Recipient object to the Recipients list |
int |
addRecipients(Recipient[] rcpts)
Adds one or more Recipient objects in the main list |
int |
getActiveConnectionsCount()
Gets the number of current active connections/send operations |
Attachment |
getAttachmentAt(int index)
Gets the Attachment object at the specified index param |
EmailAccount |
getEmailAccountAt(int index)
Gets the EmailAccount at the specified index param |
int |
getEmailsSentCount()
Gets the number of sent emails during the mass mailing operation |
int |
getErrorsCount()
Gets the number of errors/exceptions occured since the start of the mass mailing operation |
int |
getMaxConnections()
Gets the maximum number of simultanous connections/sender threads/send operations |
Recipient |
getRecipientAt(int index)
Gets the Recipient object at the specified index param |
int |
getRecipientsPerEmail()
Gets the number of recipients per one email send |
SenderEngine.RecipientsType |
getRecipientsType()
Gets the recipients type of the emails to be sent |
boolean |
isAborted()
Gets if the mass mailing operation is aborted |
boolean |
isFinished()
Gets if the mass mailing operation is totally finished |
boolean |
isFinishing()
Gets if the mass mainling operation is currently finishing |
boolean |
isModifiable()
Gets wheter or not external code can modify/alter Sender engine data. |
boolean |
isPaused()
Gets if the mass mailing operation is currently paused |
boolean |
isPausing()
Gets true if external code ordered the Sender engine to pause and this one is waiting for SenderThreads to terminate their current send operations and switch to ready mode. |
boolean |
isRunning()
Gets if the mass mailing operation is currently running |
boolean |
isStarted()
Gets if the mass mailing operation is started |
boolean |
pauseEngine()
Raises the EventID.EID_PAUSING event and if it's not cancelled, the Sender engine is paused and the EventID.EID_PAUSED event is raised when all SenderThreads terminate their send operations and switch to ready mode. |
void |
registerEventListener(EventManager.EventID evId,
EventListener listener)
Register an object listener for a specified event |
boolean |
resumeEngine()
Raises the EventID.EID_RESUMING event and if it's not cancelled, the Sender engine is resumed and the EventID.EID_RESUMED event is raised. |
void |
run()
The overriden Thread.run() which contains the Sender engine internal loop |
void |
setRecipientsType(SenderEngine.RecipientsType rcptsType)
Sets the recipients type of the emails to be sent |
boolean |
startEngine()
Starts the Sender engine and raises the EventID.EID_STARTED |
void |
unregisterEventListener(EventManager.EventID evId,
EventListener listener)
Unregister an object listener from the event manager for the event ID |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final long SLEEP_TIME
| Constructor Detail |
|---|
public SenderEngine(Email emailMsg,
int rcptPerEmail,
int maxCon)
throws java.lang.IllegalArgumentException
emailMsg - Email object representing the email to send to recipientsrcptPerEmail - Number of recipients per emailmaxCon - Number of simultanous connections/threads/send operations
java.lang.IllegalArgumentException| Method Detail |
|---|
public boolean isPausing()
public int getActiveConnectionsCount()
public int getEmailsSentCount()
public boolean isModifiable()
public void addRecipient(Recipient recipient)
throws java.lang.UnsupportedOperationException
recipient - A Recipient object representing a recipient email address
java.lang.UnsupportedOperationException
public void addEmailAccount(EmailAccount account)
throws java.lang.UnsupportedOperationException
account - EmailAccount object representing an email account used to send emails to recipients
java.lang.UnsupportedOperationException
public void addAttachment(java.lang.String fileName)
throws java.lang.UnsupportedOperationException
fileName - File name of the new attached file
java.lang.UnsupportedOperationException
public Recipient getRecipientAt(int index)
throws java.lang.IndexOutOfBoundsException
index - Index of the Recipient to be retrieved
java.lang.IndexOutOfBoundsException
public EmailAccount getEmailAccountAt(int index)
throws java.lang.IndexOutOfBoundsException
index - Index of the EmailAccount to be retrieved
java.lang.IndexOutOfBoundsException
public Attachment getAttachmentAt(int index)
throws java.lang.IndexOutOfBoundsException
index - Index of the Attachment object to be retrieved
java.lang.IndexOutOfBoundsException
public boolean startEngine()
throws java.lang.IllegalStateException
java.lang.IllegalStateExceptionpublic boolean pauseEngine()
public boolean resumeEngine()
public boolean abortEngine()
public void registerEventListener(EventManager.EventID evId,
EventListener listener)
throws java.lang.IllegalArgumentException,
java.lang.UnsupportedOperationException
evId - ID of the event associated with the object listenerlistener - The object listener associated with the event ID
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException
public void unregisterEventListener(EventManager.EventID evId,
EventListener listener)
throws java.lang.IllegalArgumentException,
java.lang.UnsupportedOperationException
evId - ID of the event to unregister the listener's objectlistener - The listener's object to unregister from the event manager
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationExceptionpublic void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic boolean isAborted()
public boolean isPaused()
public boolean isRunning()
public boolean isFinishing()
public boolean isFinished()
public boolean isStarted()
public int getRecipientsPerEmail()
public int getMaxConnections()
public int getErrorsCount()
public void addExtraHeader(java.lang.String header)
throws java.lang.IllegalArgumentException,
java.lang.UnsupportedOperationException
header - Email header to be added in the headers list
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException
public int addRecipients(Recipient[] rcpts)
throws java.lang.IllegalArgumentException,
java.lang.UnsupportedOperationException
rcpts - An array of Recipient objects to add in the main recipients list
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException
public int addEmailAccounts(EmailAccount[] accounts)
throws java.lang.IllegalArgumentException,
java.lang.UnsupportedOperationException
accounts - An array of EmailAccount objects to add into the mail list
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException
public int addAttachments(Attachment[] atchmnts)
throws java.lang.IllegalArgumentException,
java.lang.UnsupportedOperationException
atchmnts - An array of Attachment objects to add in the main list
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException
public int addExtraHeaders(java.lang.String[] headers)
throws java.lang.IllegalArgumentException,
java.lang.UnsupportedOperationException
headers - An array of Strings objects representing the extra headers to add to the main list
java.lang.IllegalArgumentException
java.lang.UnsupportedOperationException
public void setRecipientsType(SenderEngine.RecipientsType rcptsType)
throws java.lang.UnsupportedOperationException
rcptsType - Type of the recipients TO, CC or BCC
java.lang.UnsupportedOperationExceptionpublic SenderEngine.RecipientsType getRecipientsType()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||