public void configurationUpdated ( Object emailConfig ) { EmailConfiguration config = ( EmailConfiguration ) emailConfig ; if ( config != null && ( this . config == null || ! config . equals ( this . config ) ) ) { log . info ( "Updating configuration for email." ) ; this . config = config ; //Set the captcha validator up. if ( ! StringUtils . isEmptyOrNull ( config . getCaptchaPrivateKey ( ) ) ) { log . info ( "Setting up captcha validation: " + config . getCaptchaPrivateKey ( ) ) ; captchaValidator = new CaptchaValidator ( config . getCaptchaPrivateKey ( ) ) ; } else { log . info ( "Unsetting captcha validation." ) ; captchaValidator = null ; } // Need to get the Session Strategy and Transform class names out of the // Dictionary, and then use reflection to use them Dictionary < String , Object > props = new Hashtable < String , Object > ( ) ; if ( ! StringUtils . isEmptyOrNull ( config . getJndiName ( ) ) ) { props . put ( "com.meltmedia.email.jndi" , config . getJndiName ( ) ) ; log . debug ( "Using jndiName: " + config . getJndiName ( ) ) ; } log . debug ( "Using {} as the default from address." , config . getDefaultFromAddress ( ) ) ; if ( StringUtils . isEmptyOrNull ( config . getSessionStrategy ( ) ) ) { config . setSessionStrategy ( null ) ; } log . debug ( "Using mail session strategy: " + config . getSessionStrategy ( ) ) ; if ( StringUtils . isEmptyOrNull ( config . getMessageTransformer ( ) ) ) { config . setMessageTransformer ( DEFAULT_MESSAGE_TRANSFORMER ) ; } log . debug ( "Using message transformer: " + config . getMessageTransformer ( ) ) ; EmailSetup newSetup = new EmailSetup ( ) ; SessionStrategy strategy = null ; MessageTransformer transformer = null ; try { if ( config . getSessionStrategy ( ) != null ) { strategy = setSessionStrategy ( config , props , newSetup ) ; } } catch ( Exception e ) { log . error ( "Error Registering Mail Session Strategy " + config . getSessionStrategy ( ) , e ) ; config . setSessionStrategy ( null ) ; } try { transformer = setMessageTransformer ( config , newSetup ) ; } catch ( Exception e ) { log . error ( "Error Registering Mail Session Strategy " + config . getSessionStrategy ( ) , e ) ; config . setMessageTransformer ( DEFAULT_MESSAGE_TRANSFORMER ) ; try { transformer = setMessageTransformer ( config , newSetup ) ; } catch ( Exception e1 ) { log . error ( "Failed to fall back to default message transformer." , e1 ) ; } } this . setup = newSetup ; log . debug ( "Using new config jndi {}, strategy {}, transformer {}" , new Object [ ] { config . getJndiName ( ) , strategy , transformer } ) ; } }
Updates the Email Service component configuration .