org.apache.geronimo.mail
Class MailGBean

java.lang.Object
  extended by org.apache.geronimo.mail.MailGBean
All Implemented Interfaces:
GBeanLifecycle, J2EEManagedObject, J2EEResource, JavaMailResource

public class MailGBean
extends Object
implements GBeanLifecycle, JavaMailResource

GBean that provides access to JavaMail Sessions.

This GBean is used to generate JavaMail Sessions. JavaMail properties that are common to all JavaMail Sessions are provided via member variables of this class.

See Also:
ProtocolGBean, SMTPTransportGBean, POP3StoreGBean, IMAPStoreGBean

Field Summary
static GBeanInfo GBEAN_INFO
           
 
Constructor Summary
MailGBean(String objectName, Collection protocols, Boolean useDefault, Properties properties, Authenticator authenticator, String storeProtocol, String transportProtocol, String host, String user, Boolean debug, String jndiName)
          Construct an instance of MailGBean

Values that are set in the individual member variables will override any of the corresponding values that have been set in the properties set.

 
Method Summary
 Object $getResource()
           
 void doFail()
          Fails the GBean.
 void doStart()
          Starts the GBean.
 void doStop()
          Stops the target.
 Authenticator getAuthenticator()
          Returns the authenticator object.
 Boolean getDebug()
          Returns the debug setting for Sessions created from this GBean.
static GBeanInfo getGBeanInfo()
           
 String getHost()
          Returns the default Mail server.
 String getJndiName()
          Gets the JNDI name to which the mail Session should be bound
 String getObjectName()
          Returns the GBean name of this Mail GBean
 Properties getProperties()
          Returns the set of default properties for the protocols.
 Collection getProtocols()
          Returns the set of protocol GBeans that contain protocol specific configurations.
 String getStoreProtocol()
          Returns the store protocol that Sessions created from this GBean will return.
 String getTransportProtocol()
          Returns the transport protocol that Sessions created from this GBean will return.
 Boolean getUseDefault()
          Returns whether this GBean will return default Sessions or not.
 String getUser()
          Returns the username to provide when connecting to a Mail server.
 boolean isEventProvider()
          Determines if this object implemnts the event provider type defined in the J2EE Management specification.
 boolean isStateManageable()
          Determines if this object implements the state manageable type defined in the J2EE Management specification.
 boolean isStatisticsProvider()
          Determines if this object implemnts the statistics provider type defined in the J2EE Management specification.
 void setAuthenticator(Authenticator authenticator)
          Sets the authenticator object.
 void setDebug(Boolean debug)
          Sets the debug setting for Sessions created from this GBean.
 void setHost(String host)
          Sets the default Mail server.
 void setJndiName(String jndiName)
          Sets the JNDI name to which the mail Session should be bound
 void setProperties(Properties properties)
          Sets the set of default properties for the protocols.
 void setStoreProtocol(String storeProtocol)
          Sets the store protocol that Sessions created from this GBean will return.
 void setTransportProtocol(String transportProtocol)
          Sets the transport protocol that Sessions created from this GBean will return.
 void setUseDefault(Boolean useDefault)
          Sets whether this GBean will return default Sessions or not,
 void setUser(String user)
          Sets the username to provide when connecting to a Mail server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GBEAN_INFO

public static final GBeanInfo GBEAN_INFO
Constructor Detail

MailGBean

public MailGBean(String objectName,
                 Collection protocols,
                 Boolean useDefault,
                 Properties properties,
                 Authenticator authenticator,
                 String storeProtocol,
                 String transportProtocol,
                 String host,
                 String user,
                 Boolean debug,
                 String jndiName)
Construct an instance of MailGBean

Values that are set in the individual member variables will override any of the corresponding values that have been set in the properties set.

Parameters:
protocols - the set of protocol GBeans that contain protocol specific configurations
useDefault - whether this GBean will return default Sessions or not
properties - the set of default properties for the protocols
authenticator - the authenticator object
storeProtocol - the store protocol that Sessions created from this GBean will return
transportProtocol - the transport protocol that Sessions created from this GBean will return
host - the default Mail server
user - the username to provide when connecting to a Mail server
debug - the debug setting for Sessions created from this GBean
jndiName - the JNDI name to which the mail Session should be bound
Method Detail

getProtocols

public Collection getProtocols()
Returns the set of protocol GBeans that contain protocol specific configurations.


getUseDefault

public Boolean getUseDefault()
Returns whether this GBean will return default Sessions or not.


setUseDefault

public void setUseDefault(Boolean useDefault)
Sets whether this GBean will return default Sessions or not,

Parameters:
useDefault - whether this GBean will return default Sessions or not

getProperties

public Properties getProperties()
Returns the set of default properties for the protocols.

Note: Proerties that are set here will override the properties that are set in the protocol GBeans.


setProperties

public void setProperties(Properties properties)
Sets the set of default properties for the protocols.

Note: Proerties that are set here will override the properties that are set in the protocol GBeans.

Parameters:
properties - the set of default properties for the protocols

getAuthenticator

public Authenticator getAuthenticator()
Returns the authenticator object.

Used only if a new Session object is created. Otherwise, it must match the Authenticator used to create the Session.


setAuthenticator

public void setAuthenticator(Authenticator authenticator)
Sets the authenticator object.

Used only if a new Session object is created. Otherwise, it must match the Authenticator used to create the Session.

Parameters:
authenticator - the authenticator object

getStoreProtocol

public String getStoreProtocol()
Returns the store protocol that Sessions created from this GBean will return.

Specifies the default Message Access Protocol. The Session.getStore() method returns a Store object that implements this protocol. The client can override this property and explicitly specify the protocol with the Session.getStore(String protocol) method.


setStoreProtocol

public void setStoreProtocol(String storeProtocol)
Sets the store protocol that Sessions created from this GBean will return.

Specifies the default Message Access Protocol. The Session.getStore() method returns a Store object that implements this protocol. The client can override this property and explicitly specify the protocol with the Session.getStore(String protocol) method.

Values that are set here will override any of the corresponding value that has been set in the properties.

Parameters:
storeProtocol - the store protocol that Sessions created from this GBean will return

getTransportProtocol

public String getTransportProtocol()
Returns the transport protocol that Sessions created from this GBean will return.

Specifies the default Transport Protocol. The Session.getTransport() method returns a Transport object that implements this protocol. The client can override this property and explicitly specify the protocol by using Session.getTransport(String protocol) method.


setTransportProtocol

public void setTransportProtocol(String transportProtocol)
Sets the transport protocol that Sessions created from this GBean will return.

Specifies the default Transport Protocol. The Session.getTransport() method returns a Transport object that implements this protocol. The client can override this property and explicitly specify the protocol by using Session.getTransport(String protocol) method.

Values that are set here will override any of the corresponding value that has been set in the properties.

Parameters:
transportProtocol - the transport protocol that Sessions created from this GBean will return

getHost

public String getHost()
Returns the default Mail server.

Specifies the default Mail server. The Store and Transport object’s connect methods use this property, if the protocolspecific host property is absent, to locate the target host.


setHost

public void setHost(String host)
Sets the default Mail server.

Specifies the default Mail server. The Store and Transport object’s connect methods use this property, if the protocolspecific host property is absent, to locate the target host.

Values that are set here will override any of the corresponding value that has been set in the properties.

Parameters:
host - the default Mail server

getUser

public String getUser()
Returns the username to provide when connecting to a Mail server.

Specifies the username to provide when connecting to a Mail server. The Store and Transport object’s connect methods use this property, if the protocolspecific username property is absent, to obtain the username.


setUser

public void setUser(String user)
Sets the username to provide when connecting to a Mail server.

Specifies the username to provide when connecting to a Mail server. The Store and Transport object’s connect methods use this property, if the protocolspecific username property is absent, to obtain the username.

Values that are set here will override any of the corresponding value that has been set in the properties.

Parameters:
user - the username to provide when connecting to a Mail server

getDebug

public Boolean getDebug()
Returns the debug setting for Sessions created from this GBean.


setDebug

public void setDebug(Boolean debug)
Sets the debug setting for Sessions created from this GBean.

Values that are set here will override any of the corresponding value that has been set in the properties.

Parameters:
debug - the debug setting for Sessions created from this GBean

getJndiName

public String getJndiName()
Gets the JNDI name to which the mail Session should be bound

Returns:
the JNDI name to which the mail Session should be bound

setJndiName

public void setJndiName(String jndiName)
Sets the JNDI name to which the mail Session should be bound

Parameters:
jndiName - the JNDI name to which the mail Session should be bound

$getResource

public Object $getResource()

doStart

public void doStart()
             throws Exception
Description copied from interface: GBeanLifecycle
Starts the GBean. This informs the GBean that it is about to transition to the running state.

Specified by:
doStart in interface GBeanLifecycle
Throws:
Exception - if the target failed to start; this will cause a transition to the failed state

doStop

public void doStop()
            throws Exception
Description copied from interface: GBeanLifecycle
Stops the target. This informs the GBean that it is about to transition to the stopped state.

Specified by:
doStop in interface GBeanLifecycle
Throws:
Exception - if the target failed to stop; this will cause a transition to the failed state

doFail

public void doFail()
Description copied from interface: GBeanLifecycle
Fails the GBean. This informs the GBean that it is about to transition to the failed state.

Specified by:
doFail in interface GBeanLifecycle

getObjectName

public String getObjectName()
Returns the GBean name of this Mail GBean

Specified by:
getObjectName in interface J2EEManagedObject
Returns:
the unique name of this object within the server

isStateManageable

public boolean isStateManageable()
Description copied from interface: J2EEManagedObject
Determines if this object implements the state manageable type defined in the J2EE Management specification.

Specified by:
isStateManageable in interface J2EEManagedObject
Returns:
true if this class also implements the state manageable type; false otherwise

isStatisticsProvider

public boolean isStatisticsProvider()
Description copied from interface: J2EEManagedObject
Determines if this object implemnts the statistics provider type defined in the J2EE Management specification.

Specified by:
isStatisticsProvider in interface J2EEManagedObject
Returns:
true if this class also implements the statistics provider type; false otherwise

isEventProvider

public boolean isEventProvider()
Description copied from interface: J2EEManagedObject
Determines if this object implemnts the event provider type defined in the J2EE Management specification.

Specified by:
isEventProvider in interface J2EEManagedObject
Returns:
true if this class also implements the event manageable type; false otherwise

getGBeanInfo

public static GBeanInfo getGBeanInfo()


Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.