Apache Tomcat 7.0.28

org.apache.naming.factory
Class MailSessionFactory

java.lang.Object
  extended by org.apache.naming.factory.MailSessionFactory
All Implemented Interfaces:
ObjectFactory

public class MailSessionFactory
extends Object
implements ObjectFactory

Factory class that creates a JNDI named JavaMail Session factory, which can be used for managing inbound and outbound electronic mail messages via JavaMail APIs. All messaging environment properties described in the JavaMail Specification may be passed to the Session factory; however the following properties are the most commonly used:

This factory can be configured in a <Context> element in your conf/server.xml configuration file. An example of factory configuration is:

 <Resource name="mail/smtp" auth="CONTAINER"
           type="javax.mail.Session"/>
 <ResourceParams name="mail/smtp">
   <parameter>
     <name>factory</name>
     <value>org.apache.naming.factory.MailSessionFactory</value>
   </parameter>
   <parameter>
     <name>mail.smtp.host</name>
     <value>mail.mycompany.com</value>
   </parameter>
 </ResourceParams>
 

Version:
$Id: MailSessionFactory.java 1056946 2011-01-09 14:48:08Z markt $
Author:
Craig R. McClanahan

Field Summary
protected static String factoryType
          The Java type for which this factory knows how to create objects.
 
Constructor Summary
MailSessionFactory()
           
 
Method Summary
 Object getObjectInstance(Object refObj, Name name, Context context, Hashtable<?,?> env)
          Create and return an object instance based on the specified characteristics.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factoryType

protected static final String factoryType
The Java type for which this factory knows how to create objects.

See Also:
Constant Field Values
Constructor Detail

MailSessionFactory

public MailSessionFactory()
Method Detail

getObjectInstance

public Object getObjectInstance(Object refObj,
                                Name name,
                                Context context,
                                Hashtable<?,?> env)
                         throws Exception
Create and return an object instance based on the specified characteristics.

Specified by:
getObjectInstance in interface ObjectFactory
Parameters:
refObj - Reference information containing our parameters, or null if there are no parameters
name - The name of this object, relative to context, or null if there is no name
context - The context to which name is relative, or null if name is relative to the default initial context
env - Environment variables, or null if there are none
Throws:
Exception - if an error occurs during object creation

Apache Tomcat 7.0.28

Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.