org.apache.geronimo.javamail.util
Class ProtocolProperties

java.lang.Object
  extended by org.apache.geronimo.javamail.util.ProtocolProperties

public class ProtocolProperties
extends Object

Interface for providing access to protocol specific properties to utility classes.


Field Summary
protected  int defaultPort
           
protected  String protocol
           
protected  String protocolPrefix
           
protected  Session session
           
protected  boolean sslConnection
           
 
Constructor Summary
ProtocolProperties(Session session, String protocol, boolean sslConnection, int defaultPort)
           
 
Method Summary
 boolean getBooleanProperty(String name, boolean defaultValue)
          Get a property associated with this mail session as an boolean value.
 boolean getBooleanSessionProperty(String name, boolean defaultValue)
          Get a property associated with this mail session as an boolean value.
 int getDefaultPort()
          Return the default port to use with this connection.
 int getIntProperty(String name, int defaultValue)
          Get a property associated with this mail session as an integer value.
 int getIntSessionProperty(String name, int defaultValue)
          Get a property associated with this mail session as an integer value.
 Properties getProperties()
          Get the complete set of properties associated with this Session.
 String getProperty(String name)
          Get a property associated with this mail protocol.
 String getProperty(String name, String defaultValue)
          Get a property associated with this mail session.
 String getProtocol()
          Retrieve the name of the protocol used to access properties.
 Session getSession()
          Retrieve the Session associated with this property bundle instance.
 String getSessionProperty(String name)
          Get a property associated with this mail session.
 String getSessionProperty(String name, String defaultValue)
          Get a property associated with this mail session.
 boolean getSSLConnection()
          Retrieve the SSL Connection flag for this protocol;
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

protocol

protected String protocol

protocolPrefix

protected String protocolPrefix

session

protected Session session

sslConnection

protected boolean sslConnection

defaultPort

protected int defaultPort
Constructor Detail

ProtocolProperties

public ProtocolProperties(Session session,
                          String protocol,
                          boolean sslConnection,
                          int defaultPort)
Method Detail

getSession

public Session getSession()
Retrieve the Session associated with this property bundle instance.

Returns:
A Session object that's the source of the accessed properties.

getProtocol

public String getProtocol()
Retrieve the name of the protocol used to access properties.

Returns:
The protocol String name.

getSSLConnection

public boolean getSSLConnection()
Retrieve the SSL Connection flag for this protocol;

Returns:
true if an SSL connection is required, false otherwise.

getDefaultPort

public int getDefaultPort()
Return the default port to use with this connection.

Returns:
The default port value.

getProperty

public String getProperty(String name)
Get a property associated with this mail protocol.

Parameters:
name - The name of the property.
Returns:
The property value (returns null if the property has not been set).

getProperty

public String getProperty(String name,
                          String defaultValue)
Get a property associated with this mail session. Returns the provided default if it doesn't exist.

Parameters:
name - The name of the property.
defaultValue - The default value to return if the property doesn't exist.
Returns:
The property value (returns defaultValue if the property has not been set).

getIntProperty

public int getIntProperty(String name,
                          int defaultValue)
Get a property associated with this mail session as an integer value. Returns the default value if the property doesn't exist or it doesn't have a valid int value.

Parameters:
name - The name of the property.
defaultValue - The default value to return if the property doesn't exist.
Returns:
The property value converted to an int.

getBooleanProperty

public boolean getBooleanProperty(String name,
                                  boolean defaultValue)
Get a property associated with this mail session as an boolean value. Returns the default value if the property doesn't exist or it doesn't have a valid int value.

Parameters:
name - The name of the property.
defaultValue - The default value to return if the property doesn't exist.
Returns:
The property value converted to a boolean

getSessionProperty

public String getSessionProperty(String name)
Get a property associated with this mail session. Session properties all begin with "mail."

Parameters:
name - The name of the property.
Returns:
The property value (returns null if the property has not been set).

getSessionProperty

public String getSessionProperty(String name,
                                 String defaultValue)
Get a property associated with this mail session. Returns the provided default if it doesn't exist.

Parameters:
name - The name of the property.
defaultValue - The default value to return if the property doesn't exist.
Returns:
The property value (returns defaultValue if the property has not been set).

getIntSessionProperty

public int getIntSessionProperty(String name,
                                 int defaultValue)
Get a property associated with this mail session as an integer value. Returns the default value if the property doesn't exist or it doesn't have a valid int value.

Parameters:
name - The name of the property.
defaultValue - The default value to return if the property doesn't exist.
Returns:
The property value converted to an int.

getBooleanSessionProperty

public boolean getBooleanSessionProperty(String name,
                                         boolean defaultValue)
Get a property associated with this mail session as an boolean value. Returns the default value if the property doesn't exist or it doesn't have a valid int value.

Parameters:
name - The name of the property.
defaultValue - The default value to return if the property doesn't exist.
Returns:
The property value converted to a boolean

getProperties

public Properties getProperties()
Get the complete set of properties associated with this Session.

Returns:
The Session properties bundle.


Copyright © 2003-2009 The Apache Software Foundation. All Rights Reserved.