com.emarsys.ecommon.mail
Class JMailSessionFactory

java.lang.Object
  extended by com.emarsys.ecommon.mail.JMailSessionFactory

public final class JMailSessionFactory
extends java.lang.Object

Factory for JavaMail(tm) Session instances with support for ecommon mock Providers.

If the System property "com.emarsys.ecommon.mail.session.mocking.enabled" is set to "true" the eCommon mock providers will be used instead of the ones configured in javamail(.default).providers. file.

Author:
Michael "kULO" Kulovits

Field Summary
static java.lang.String SYS_PROP_USE_MOCK_SESSION
           
static java.lang.String VENDOR
           
static java.lang.String VERSION
           
 
Constructor Summary
JMailSessionFactory()
           
 
Method Summary
static boolean enableMocking()
           
static javax.mail.Session getInstance(java.util.Properties props)
           Factory method for Sessions that might use ecommon mock Providers instead of the ones configured in javamail(.default).providers!
static javax.mail.Session getMockInstance()
          Factory method for Sessions that use ecommon mock Providers instead of the ones configured in javamail(.default).providers in any case!
static javax.mail.Session getMockInstance(java.util.Properties props)
          Factory method for Sessions that use ecommon mock Providers instead of the ones configured in javamail(.default).providers in any case!
static boolean isMockingEnabled()
          Indicates whether Sessions build by JMailSessionFactory should use the eCommon mock Providers or not.
protected static void setMockProviders(javax.mail.Session session)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYS_PROP_USE_MOCK_SESSION

public static final java.lang.String SYS_PROP_USE_MOCK_SESSION
See Also:
Constant Field Values

VENDOR

public static final java.lang.String VENDOR
See Also:
Constant Field Values

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values
Constructor Detail

JMailSessionFactory

public JMailSessionFactory()
Method Detail

isMockingEnabled

public static boolean isMockingEnabled()
Indicates whether Sessions build by JMailSessionFactory should use the eCommon mock Providers or not.

Returns:
true if the System property "com.emarsys.ecommon.mail.session.mocking.enabled" is set to "true", false otherwise.

enableMocking

public static boolean enableMocking()
Returns:

getMockInstance

public static javax.mail.Session getMockInstance(java.util.Properties props)
Factory method for Sessions that use ecommon mock Providers instead of the ones configured in javamail(.default).providers in any case!

Parameters:
props -
Returns:

getMockInstance

public static javax.mail.Session getMockInstance()
Factory method for Sessions that use ecommon mock Providers instead of the ones configured in javamail(.default).providers in any case!

Returns:

getInstance

public static javax.mail.Session getInstance(java.util.Properties props)

Factory method for Sessions that might use ecommon mock Providers instead of the ones configured in javamail(.default).providers!

If the System property "com.emarsys.ecommon.mail.session.mocking.enabled" is set to "true" the eCommon mock providers will be used instead of the ones configured in javamail(.default).providers.

Parameters:
props -
Returns:

setMockProviders

protected static void setMockProviders(javax.mail.Session session)


Copyright © 2010 emarsys AG. All Rights Reserved.