Top Description Inners Fields Constructors Methods
org.mortbay.naming.factories

public Class MailSessionReference

extends Reference
implements ObjectFactory
Class Inheritance
All Implemented Interfaces
javax.naming.spi.ObjectFactory
Imports
javax.mail.Authenticator, .PasswordAuthentication, .Session, java.util.Enumeration, .Hashtable, .Iterator, .Map, .Properties, javax.naming.Context, .Name, .NamingException, .RefAddr, .Reference, .Referenceable, .StringRefAddr, javax.naming.spi.ObjectFactory, org.mortbay.jetty.security.Password

MailSessionReference This is a subclass of javax.mail.Reference and an ObjectFactory for javax.mail.Session objects. The subclassing of Reference allows all of the setup for a javax.mail.Session to be captured without necessitating first instantiating a Session object. The reference is bound into JNDI and it is only when the reference is looked up that this object factory will create an instance of javax.mail.Session using the information captured in the Reference.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Inherited from javax.naming.Reference:
addrsclassFactoryclassFactoryLocationclassName

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object
getObjectInstance(Object
the Reference
ref
,
Name
not used
arg1
,
Context
not used
arg2
,
Hashtable<K, V>
not used
arg3
)

Implements javax.naming.spi.ObjectFactory.getObjectInstance.

Create a javax.mail.Session instance based on the information passed in the Reference
public void
setPassword(String password)

public void
public void
Inherited from javax.naming.Reference:
addaddclearcloneequalsgetgetgetAllgetClassNamegetFactoryClassLocationgetFactoryClassNamehashCoderemovesizetoString

Constructor Detail

MailSessionReferenceback to summary
public MailSessionReference()

Method Detail

getObjectInstanceback to summary
public Object getObjectInstance(Object ref, Name arg1, Context arg2, Hashtable<K, V> arg3) throws Exception

Implements javax.naming.spi.ObjectFactory.getObjectInstance.

Create a javax.mail.Session instance based on the information passed in the Reference

Parameters
ref:Object

the Reference

arg1:Name

not used

arg2:Context

not used

arg3:Hashtable<K, V>

not used

Exceptions
Exception:

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

if this object factory encountered an exception while attempting to create an object, and no other object factories are to be tried.

See Also
javax.naming.spi.ObjectFactory#getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable)
setPasswordback to summary
public void setPassword(String password)
setPropertiesback to summary
public void setProperties(Properties properties)
setUserback to summary
public void setUser(String user)
org.mortbay.naming.factories back to summary

public Class MailSessionReference.PasswordAuthenticator

extends Authenticator
Class Inheritance

Field Summary

Modifier and TypeField and Description
private String
pack-priv PasswordAuthentication
private String

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public String
public PasswordAuthentication
getPasswordAuthentication()

Overrides javax.mail.Authenticator.getPasswordAuthentication.

Called when password authentication is needed.
public String
public void
setPassword(String password)

public void
Inherited from javax.mail.Authenticator:
getDefaultUserNamegetRequestingPortgetRequestingPromptgetRequestingProtocolgetRequestingSite

Field Detail

passwordback to summary
private String password
passwordAuthenticationback to summary
pack-priv PasswordAuthentication passwordAuthentication
userback to summary
private String user

Constructor Detail

PasswordAuthenticatorback to summary
public PasswordAuthenticator()
PasswordAuthenticatorback to summary
public PasswordAuthenticator(String user, String password)

Method Detail

getPasswordback to summary
public String getPassword()
getPasswordAuthenticationback to summary
public PasswordAuthentication getPasswordAuthentication()

Overrides javax.mail.Authenticator.getPasswordAuthentication.

Doc from javax.mail.Authenticator.getPasswordAuthentication.

Called when password authentication is needed. Subclasses should override the default implementation, which returns null.

Note that if this method uses a dialog to prompt the user for this information, the dialog needs to block until the user supplies the information. This method can not simply return after showing the dialog.

Returns:PasswordAuthentication

The PasswordAuthentication collected from the user, or null if none is provided.

getUserback to summary
public String getUser()
setPasswordback to summary
public void setPassword(String password)
setUserback to summary
public void setUser(String user)