|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.objectledge.mail.MailSystem
public class MailSystem
Mail system component.
| Nested Class Summary | |
|---|---|
private class |
MailSystem.DeliverMailTask
Deaemon task responsible for sending enqueued e-mail messages. |
static class |
MailSystem.LedgeAuthenticator
The authenticator . |
| Field Summary | |
|---|---|
private String |
debugAddress
system mail logger |
static String |
DEFAULT_SESSION
The default session name (default). |
private String |
defaultSession
default provider |
static String |
EMAIL_ADDRESS_PATTERN
The regex email address patter. |
private Pattern |
emailAddressPattern
email address validator pattern |
private FileSystem |
fileSystem
file service |
private org.jcontainer.dna.Logger |
logger
logger |
private LinkedList<LedgeMessage> |
mailQueue
mail queue |
private javax.activation.MimetypesFileTypeMap |
mimeMap
map with mime types |
private Map<String,javax.mail.Session> |
sessionsMap
server list - not implemented |
private String |
systemAddress
system address |
private Templating |
templating
templating |
private ThreadPool |
threadPool
thread pool |
| Constructor Summary | |
|---|---|
protected |
MailSystem()
No-arg ctor for mocking. |
|
MailSystem(org.jcontainer.dna.Configuration config,
org.jcontainer.dna.Logger logger,
FileSystem fileSystem,
Templating templating,
ThreadPool threadPool)
Initializes the component. |
| Method Summary | |
|---|---|
String |
getContentType(String filename)
Guess MIME type from file name extension. |
javax.activation.DataSource |
getDataSource(String name)
Returns a DataSource backed by the FileSystem. |
javax.mail.Session |
getSession()
Returns the default mail session. |
javax.mail.Session |
getSession(String name)
Returns a mail session declared in the service configuration. |
String |
getSystemAddress()
Get the system address. |
boolean |
isValidEmailAddress(String address)
Checks if given address is valid. |
LedgeMessage |
newMessage()
Create a new message based on default session. |
LedgeMessage |
newMessage(javax.mail.Message message)
Create a new message based on a pre-existing JavaMali message object and the default session. |
LedgeMessage |
newMessage(String sessionName)
Create a new message based on session defined in the configuration file. |
LedgeMessage |
newMessage(String sessionName,
javax.mail.Message message)
Create a new message based on a pre-existing JavaMali message object. |
void |
send(LedgeMessage message,
boolean wait)
Send the message. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_SESSION
public static final String EMAIL_ADDRESS_PATTERN
private org.jcontainer.dna.Logger logger
private ThreadPool threadPool
private FileSystem fileSystem
private Templating templating
private javax.activation.MimetypesFileTypeMap mimeMap
private LinkedList<LedgeMessage> mailQueue
private Map<String,javax.mail.Session> sessionsMap
private String defaultSession
private String debugAddress
private String systemAddress
private Pattern emailAddressPattern
| Constructor Detail |
|---|
protected MailSystem()
public MailSystem(org.jcontainer.dna.Configuration config,
org.jcontainer.dna.Logger logger,
FileSystem fileSystem,
Templating templating,
ThreadPool threadPool)
config - the configuration.logger - the logger.fileSystem - the file system.templating - the templating.threadPool - the threadPool.| Method Detail |
|---|
public javax.mail.Session getSession()
public javax.mail.Session getSession(String name)
name - the name of the server.
public javax.activation.DataSource getDataSource(String name)
DataSource backed by the FileSystem.
name - the pathname of the file.
public LedgeMessage newMessage()
public LedgeMessage newMessage(String sessionName)
sessionName - the name of the server.
public LedgeMessage newMessage(javax.mail.Message message)
message - the JavaMail message.
public LedgeMessage newMessage(String sessionName,
javax.mail.Message message)
sessionName - the name of the session.message - the JavaMail message.
public void send(LedgeMessage message,
boolean wait)
throws javax.mail.MessagingException
If the wait parameter is false, the sending process will
proceed asynchronosly, and the method will return immediately,
otherwise the method will return only after the sending process is
complete.
message - the ledge mail message wrapper.wait - true to wait for operation completion.
javax.mail.MessagingException - thrown if message cannot be send.public String getContentType(String filename)
If the extension is missing or unknown
application/octet-stream type will be returned.
filename - the filename with extension.
public boolean isValidEmailAddress(String address)
address - the address
true if address is valid.public String getSystemAddress()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||