org.apache.naming.factory
Class SendMailFactory

java.lang.Object
  extended by org.apache.naming.factory.SendMailFactory
All Implemented Interfaces:
javax.naming.spi.ObjectFactory

public class SendMailFactory
extends java.lang.Object
implements javax.naming.spi.ObjectFactory

Factory class that creates a JNDI named javamail MimePartDataSource object which can be used for sending email using SMTP.

Can be configured using the XmlConfigurator.

Example:

 <resource name="mail/send" auth="CONTAINER"
           type="javax.mail.internet.MimePartDataSource">
   <parameter>
     <name>factory</name>
     <value>org.apache.naming.factory.SendMailFactory</value>
   </parameter>
   <parameter>
     <name>mail.smtp.host</name>
     <value>your.smtp.host</value>
   </parameter>
   <parameter>
     <name>mail.smtp.user</name>
     <value>someuser</value>
   </parameter>
   <parameter>
     <name>mail.from</name>
     <value>someuser@some.host</value>
   </parameter>
   <parameter>
     <name>mail.smtp.sendpartial</name>
     <value>true</value>
   </parameter>
   <parameter>
     <name>mail.smtp.dsn.notify</name>
     <value>FAILURE</value>
   </parameter>
   <parameter>
     <name>mail.smtp.dsn.ret</name>
     <value>FULL</value>
   </parameter>
 </resource>
 

Author:
Glenn Nielsen, Rich Catlett

Field Summary
protected  java.lang.String DataSourceClassName
           
 
Constructor Summary
SendMailFactory()
           
 
Method Summary
 java.lang.Object getObjectInstance(java.lang.Object refObj, javax.naming.Name nm, javax.naming.Context ctx, java.util.Hashtable env)
          Create a new MimePartDataSource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DataSourceClassName

protected final java.lang.String DataSourceClassName
See Also:
Constant Field Values
Constructor Detail

SendMailFactory

public SendMailFactory()
Method Detail

getObjectInstance

public java.lang.Object getObjectInstance(java.lang.Object refObj,
                                          javax.naming.Name nm,
                                          javax.naming.Context ctx,
                                          java.util.Hashtable env)
                                   throws java.lang.Exception
Create a new MimePartDataSource.

Specified by:
getObjectInstance in interface javax.naming.spi.ObjectFactory
Parameters:
refObj - The reference object describing the ResourceLink
nm - The name of this object relative to nameCtx, or null if no name is specified.
ctx - The context relative to which the name parameter is specified, or null if name is relative to the default initial context.
env - The possibly null environment that is used in creating the object.
Returns:
The object created; null if an instance cannot be created.
Throws:
java.lang.Exception