|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sourceforge.esw.collection.ATransducer | +--net.sourceforge.esw.collection.MailTransducer
Performs Transduction between a mail data source and an
IMetaCollection
instance.
This transduction occurs both ways; put()
takes data
from the IMetaCollection
instance to which this
ITransducer
instance is attached and places it into the data
source represented by this ITransducer
instance. The
get()
method takes data from the data source represented by this
ITransducer
instance and places it into the
IMetaCollection
instance to which this ITransducer
instance is attached.
For proper put
transduction to occur, three variables
are needed. These are:
Only get
is implemented for this MailTransducer
instance.
For this MailTransducer
instance, the INode
instance's of the containing IMetaCollection
provide the data
elements of the Mail message being sent.
Those elements are:
Mail Element | Description |
---|---|
From (net.sourceforge.esw.collection.MailTransducer.FROM ) |
The Mail Address of the user sending a message. |
To (net.sourceforge.esw.collection.MailTransducer.TO ) |
The Mail Addresses of the receipient of the message. Multiple
recipients each require their own INode instance
within the IMetaCollection instance.
|
CC (net.sourceforge.esw.collection.MailTransducer.CC ) |
The Mail Addresses of the CC of the message. Multiple recipients each
require their own INode instance
within the IMetaCollection instance.
|
BCC (net.sourceforge.esw.collection.MailTransducer.BCC ) |
The Mail Addresses of the BCC of the message. Multiple recipients
each require their own INode instance
within the IMetaCollection instance.
|
Text (net.sourceforge.esw.collection.MailTransducer.TEXT ) |
The message text. |
Subject (net.sourceforge.esw.collection.MailTransducer.SUBJECT ) |
The message subject. |
Example:
IMetaCollection meta = MetaFactory.createMetaCollection(); MailTransducer trans = new MailTransducer(); StringBuffer sb = new StringBuffer(); sb.append("Hello TEST!\n\n"); sb.append("This is a \"Hello World\" from TestMailTransducer.\n\n"); sb.append("Sincerly,\n"); sb.append("TestMailTransducer"); meta.add( NodeFactory.createNode( MailTransducer.TEXT, sb.toString() ) ); meta.add( NodeFactory.createNode( MailTransducer.SUBJECT, "This message is from your friendly TestMailTransducer!" ) ); meta.add( NodeFactory.createNode( MailTransducer.TO, "blah@abcblah.com" ) ); meta.add( NodeFactory.createNode( MailTransducer.FROM, "meblah@abcblah.com" ) ); trans.setSMTPHost( smtpHost ); meta.setTransducer( trans ); try { meta.put(); } catch ( TransducerException te ) { te.printStackTrace(); }
IMetaCollection
, Serialized FormField Summary | |
static java.lang.String |
BCC
The INode instance name for the BCC element of a Mail Message. |
static java.lang.String |
CC
The INode instance name for the CC element of a Mail Message. |
protected boolean |
debug
Sets if debugging for the Mail API should be turned on or off. |
static java.lang.String |
FROM
The INode instance name for the From element of a Mail
Message. |
protected java.lang.String |
password
The password for access to the SMTP server through which this MailTransducer instance will send its message. |
static java.lang.String |
REPLY_TO
The INode instance name for the ReplyTo element of a Mail
Message. |
protected static java.lang.String |
SMTP
The constant for the SMTP protocol type. |
protected java.lang.String |
smtpHost
The hostname of the SMTP server through which this MailTransducer instance will send it's message. |
static java.lang.String |
SUBJECT
The INode instance name for the Subject element of a Mail
Message. |
static java.lang.String |
TEXT
The INode instance name for the From element of a Mail
Message. |
static java.lang.String |
TO
The INode instance name for the To element of a Mail Message. |
protected java.lang.String |
username
The username for access to the SMTP server through which this MailTransducer instance will send its message. |
Fields inherited from class net.sourceforge.esw.collection.ATransducer |
contextFactory |
Constructor Summary | |
MailTransducer()
Creates a new MailTransducer instance. |
|
MailTransducer(java.lang.String aSMTPHost)
Creates a new MailTransducer instance with the specified SMTP
host. |
|
MailTransducer(java.lang.String aSMTPHost,
java.lang.String aUsername,
java.lang.String aPassword)
Creates a new MailTransducer instance with the specified
values. |
Method Summary | |
protected void |
checkPasswordExists()
Checks to make sure that the password has been set on this MailTransducer instance. |
protected void |
checkSMTPHostExists()
Checks to make sure that the SMTP host server name has been set on this MailTransducer instance. |
protected void |
checkToFromSubjectText(IMetaCollection aCollection)
Checks to make sure that the IMetaCollection instance contains
a TO , FROM , SUBJECT , and
TEXT INode children instances that have a
non-null value. |
protected void |
checkUsernameExists()
Checks to make sure that the username has been set on this MailTransducer instance. |
void |
get(IMetaCollection aCollection)
Gets the data source's data represented by this ITransducer
instance into the referenced IMetaCollection instance. |
protected javax.mail.internet.InternetAddress[] |
getAddresses(IMetaCollection aCollection,
java.lang.String aType)
Returns the addresses from the IMetaCollection instance based on the specified type of address (to, cc, bcc...). |
java.lang.String |
getPassword()
Returns the Password for access to the SMTP server that this MailTransducer instance will use to send the mail message. |
java.lang.String |
getSMTPHost()
Returns the SMTP hostname for this MailTransducer instance to
which to send the mail message. |
java.lang.String |
getUsername()
Returns the username for access to the SMTP server that this MailTransducer instance will use to send the mail message. |
boolean |
isDebug()
Returns if the bebug flag for the Mail API should be turned on or off. |
void |
put(IMetaCollection aCollection)
Puts the referenced IMetaCollection instance's data into the
data source represented by this ITransducer instance. |
void |
setDebug(boolean aDebug)
Sets if the bebug flag for the Mail API should be turned on or off. |
void |
setPassword(java.lang.String aPassword)
Sets the Password for access to the SMTP server that this MailTransducer instance will use to send the mail message. |
void |
setSMTPHost(java.lang.String aSMTPHost)
Sets the SMTP hostname for this MailTransducer instance to
which to send the mail message. |
void |
setUsername(java.lang.String aUsername)
Sets the username for access to the SMTP server that this MailTransducer instance will use to send the mail message. |
Methods inherited from class net.sourceforge.esw.collection.ATransducer |
getContextFactory, setContextFactory |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sourceforge.esw.collection.ITransducer |
getContextFactory, setContextFactory |
Field Detail |
protected java.lang.String smtpHost
MailTransducer
instance will send it's message.protected java.lang.String username
MailTransducer
instance will send its message.protected java.lang.String password
MailTransducer
instance will send its message.protected boolean debug
protected static final java.lang.String SMTP
public static final java.lang.String FROM
INode
instance name for the From element of a Mail
Message.public static final java.lang.String REPLY_TO
INode
instance name for the ReplyTo element of a Mail
Message.public static final java.lang.String TO
INode
instance name for the To element of a Mail Message.public static final java.lang.String CC
INode
instance name for the CC element of a Mail Message.public static final java.lang.String BCC
INode
instance name for the BCC element of a Mail Message.public static final java.lang.String SUBJECT
INode
instance name for the Subject element of a Mail
Message.public static final java.lang.String TEXT
INode
instance name for the From element of a Mail
Message.Constructor Detail |
public MailTransducer()
MailTransducer
instance.public MailTransducer(java.lang.String aSMTPHost)
MailTransducer
instance with the specified SMTP
host.
aSMTPHost
- the hostname of the SMTP server.public MailTransducer(java.lang.String aSMTPHost, java.lang.String aUsername, java.lang.String aPassword)
MailTransducer
instance with the specified
values.
aSMTPHost
- the hostname of the SMTP server.aUSername
- the username for the SMTP server.aPassword
- the password for the SMTP server.Method Detail |
public void put(IMetaCollection aCollection) throws TransducerException
IMetaCollection
instance's data into the
data source represented by this ITransducer
instance.put
in interface ITransducer
aCollection
- the IMetaCollection
instance from which to
take data.TransducerException
- if an error occurs during transduction.get( IMetaCollection )
public void get(IMetaCollection aCollection) throws TransducerException
ITransducer
instance into the referenced IMetaCollection
instance.get
in interface ITransducer
aCollection
- the IMetaCollection
instance into which to
read.TransducerException
- if an error occurs during transduction.put( IMetaCollection )
public void setSMTPHost(java.lang.String aSMTPHost)
MailTransducer
instance to
which to send the mail message.aSMTPHost
- the hostname of the SMTP server.getSMTPHost()
public java.lang.String getSMTPHost()
MailTransducer
instance to
which to send the mail message.setSMTPHost( String )
public void setUsername(java.lang.String aUsername)
MailTransducer
instance will use to send the mail message.aUsername
- the username for access to the SMTP server.getUsername()
public java.lang.String getUsername()
MailTransducer
instance will use to send the mail message.setUsername( String )
public void setPassword(java.lang.String aPassword)
MailTransducer
instance will use to send the mail message.aPassword
- the Password for access to the SMTP server.getPassword()
public java.lang.String getPassword()
MailTransducer
instance will use to send the mail message.setPassword( String )
public void setDebug(boolean aDebug)
aDebug
- the bebug flag for the Mail API.isDebug()
public boolean isDebug()
setDebug( boolean )
protected void checkSMTPHostExists() throws TransducerException
MailTransducer
instance.TransducerException
- if the SMTPHost parameters does not exist.protected void checkUsernameExists() throws TransducerException
MailTransducer
instance.TransducerException
- if the SMTPHost parameters does not exist.protected void checkPasswordExists() throws TransducerException
MailTransducer
instance.protected void checkToFromSubjectText(IMetaCollection aCollection) throws TransducerException
IMetaCollection
instance contains
a TO
, FROM
, SUBJECT
, and
TEXT
INode
children instances that have a
non-null value.aCollection
- the IMetaCollection
instance to check.TransducerException
- if any of the listed parameters do not exist.protected javax.mail.internet.InternetAddress[] getAddresses(IMetaCollection aCollection, java.lang.String aType) throws java.lang.Exception
aCollection
- the IMetaCollection instance to pull the addresses
from.aType
- the type of address to pull (to, cc, bcc...).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |