Top Description Fields Constructors Methods
org.apache.naming.factory

public Class MailSessionFactory

extends Object
implements ObjectFactory
Class Inheritance
All Implemented Interfaces
javax.naming.spi.ObjectFactory
Imports
java.security.AccessController, .PrivilegedAction, java.util.Enumeration, .Hashtable, .Properties, javax.naming.Context, .Name, .RefAddr, .Reference, javax.naming.spi.ObjectFactory, jakarta.mail.Authenticator, .PasswordAuthentication, .Session

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="jakarta.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>
Author
Craig R. McClanahan

Field Summary

Modifier and TypeField and Description
protected static final String
factoryType

The Java type for which this factory knows how to create objects.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
getObjectInstance(Object
Reference information containing our parameters, or null if there are no parameters
refObj
,
Name
The name of this object, relative to context, or null if there is no name
name
,
Context
The context to which name is relative, or null if name is relative to the default initial context
context
,
Hashtable<?, ?>
Environment variables, or null if there are none
env
)

Implements javax.naming.spi.ObjectFactory.getObjectInstance.

Create and return an object instance based on the specified characteristics.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

factoryTypeback to summary
protected static final String factoryType

The Java type for which this factory knows how to create objects.

Constructor Detail

MailSessionFactoryback to summary
public MailSessionFactory()

Method Detail

getObjectInstanceback to summary
public Object getObjectInstance(Object refObj, Name name, Context context, Hashtable<?, ?> env) throws Exception

Implements javax.naming.spi.ObjectFactory.getObjectInstance.

Create and return an object instance based on the specified characteristics.

Parameters
refObj:Object

Reference information containing our parameters, or null if there are no parameters

name:Name

The name of this object, relative to context, or null if there is no name

context:Context

The context to which name is relative, or null if name is relative to the default initial context

env:Hashtable<?, ?>

Environment variables, or null if there are none

Returns:Object

Doc from javax.naming.spi.ObjectFactory.getObjectInstance.

The object created; null if an object cannot be created.

Annotations
@Override
Exceptions
Exception:
if an error occurs during object creation