org.shaker.dwu
Class MailEngine

java.lang.Object
  |
  +--org.shaker.dwu.MailEngine

public final class MailEngine
extends java.lang.Object

This pure static class provides methods to submit BugProfiles and to check addresses and ports.

Author:
Philipp Bartsch (codeshaker@gmx.net), GPL License

Inner Class Summary
(package private)  class MailEngine.DWUAuthenticator
          An Authenticator.
 
Field Summary
private static Settings SETTINGS
          a local reference to DWU`s properties
 
Constructor Summary
private MailEngine()
          Invisible constructor.
 
Method Summary
private static javax.mail.Message[] getMessageArray(javax.mail.Session session, BugProfile[] profs)
          Returns a Message array that encapsulates the BugProfile queue.
private static void performPOPAuth(javax.mail.Session session)
          This method performs a POP-Authentification based on the settings in dwuProps (POP server, POP port, username, password).
(package private) static java.lang.String submit(java.awt.Component parent, BugProfile[] profiles)
          Submits an array of BugProfiles and returns a success description.
private static void submitMaintenanceMessage(javax.mail.Session session)
          This method sends a maintenance mail, that contains the error.log text.
private static void submitMsgs(javax.mail.Message[] messages, BugProfile[] profiles)
          Sends an array of messages.
(package private) static boolean validateMail(java.lang.String address)
          Returns true, if the given address string is a valid mail address.
TODO Weak implementation yet, has to be improved!
(package private) static boolean validatePort(java.lang.String portString)
          Returns true, if the given address string is a port
(package private) static boolean validateServer(java.lang.String address)
          Returns true, if the given address string is a valid server address. TODO Weak implementation yet, has to be improved!
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

SETTINGS

private static final Settings SETTINGS
a local reference to DWU`s properties
Constructor Detail

MailEngine

private MailEngine()
Invisible constructor. This class is a factory, so it`s not meant to be instantiated.
Method Detail

submit

static java.lang.String submit(java.awt.Component parent,
                               BugProfile[] profiles)
Submits an array of BugProfiles and returns a success description.
Parameters:
parent - a parental Component
profiles - the array of BugProfiles
Returns:
a string, that contains an error description in case of a failed submission or nothing, if successful

performPOPAuth

private static final void performPOPAuth(javax.mail.Session session)
                                  throws javax.mail.MessagingException
This method performs a POP-Authentification based on the settings in dwuProps (POP server, POP port, username, password).
Parameters:
session - the current mailing session
Throws:
javax.mail.MessagingException - on POP-Auth connection errors

getMessageArray

private static final javax.mail.Message[] getMessageArray(javax.mail.Session session,
                                                          BugProfile[] profs)
                                                   throws javax.mail.MessagingException
Returns a Message array that encapsulates the BugProfile queue.
Parameters:
session - the current mailing session
profs - the BugProfiles queue stored in an array
Returns:
Message[] an array of messages
Throws:
javax.mail.MessagingException - thrown on message creation errors

submitMaintenanceMessage

private static final void submitMaintenanceMessage(javax.mail.Session session)
                                            throws javax.mail.MessagingException
This method sends a maintenance mail, that contains the error.log text.
Parameters:
session - the current mailing session

submitMsgs

private static final void submitMsgs(javax.mail.Message[] messages,
                                     BugProfile[] profiles)
                              throws javax.mail.MessagingException
Sends an array of messages.
Parameters:
messages - the messages
profiles - the underlying profiles
Throws:
javax.mail.MessagingException - in case of an submission error

validateMail

static boolean validateMail(java.lang.String address)
Returns true, if the given address string is a valid mail address.
TODO Weak implementation yet, has to be improved!
Parameters:
address - the address string
Returns:
boolean flag

validateServer

static boolean validateServer(java.lang.String address)
Returns true, if the given address string is a valid server address. TODO Weak implementation yet, has to be improved!
Parameters:
address - the address
Returns:
boolean flag

validatePort

static boolean validatePort(java.lang.String portString)
Returns true, if the given address string is a port
Parameters:
portString - the port
Returns:
boolean flag