dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15106
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5324: Changed from xml config to autowiring for the list of message senders in MessageService, allows f...
------------------------------------------------------------
revno: 5324
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-12-07 15:19:06 +0100
message:
Changed from xml config to autowiring for the list of message senders in MessageService, allows for looser coupling / plugging of implementations
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java 2011-11-01 12:28:11 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/DefaultMessageService.java 2011-12-07 14:19:06 +0000
@@ -36,6 +36,7 @@
import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserGroup;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -70,6 +71,7 @@
this.configurationService = configurationService;
}
+ @Autowired
private List<MessageSender> messageSenders;
public void setMessageSenders( List<MessageSender> messageSenders )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java 2011-11-22 18:29:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/EmailMessageSender.java 2011-12-07 14:19:06 +0000
@@ -57,7 +57,7 @@
private static final int SMTP_PORT = 587;
private static final String FROM_ADDRESS = "noreply@xxxxxxxxx";
- private static final String SUBJECT_PREFX = "[DHIS2] ";
+ private static final String SUBJECT_PREFIX = "[DHIS2] ";
private static final String LB = System.getProperty( "line.separator" );
// -------------------------------------------------------------------------
@@ -84,7 +84,7 @@
@Override
public void sendMessage( String subject, String text, User sender, Set<User> users )
- {
+ {
String hostName = StringUtils.trimToNull( (String) systemSettingManager.getSystemSetting( KEY_EMAIL_HOST_NAME ) );
String username = StringUtils.trimToNull( (String) systemSettingManager.getSystemSetting( KEY_EMAIL_USERNAME ) );
String password = StringUtils.trimToNull( (String) systemSettingManager.getSystemSetting( KEY_EMAIL_PASSWORD ) );
@@ -105,7 +105,7 @@
try
{
Email email = getEmail( hostName, username, password );
- email.setSubject( SUBJECT_PREFX + subject );
+ email.setSubject( SUBJECT_PREFIX + subject );
email.setMsg( text );
boolean hasRecipients = false;
@@ -131,7 +131,7 @@
}
catch ( EmailException ex )
{
- log.warn( "Could not send email for reason: " + ex.getMessage() );
+ log.warn( "Could not send email: " + ex.getMessage() );
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2011-12-01 15:43:25 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2011-12-07 14:19:06 +0000
@@ -448,11 +448,6 @@
<property name="messageConversationStore" ref="org.hisp.dhis.message.MessageConversationStore" />
<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
<property name="configurationService" ref="org.hisp.dhis.configuration.ConfigurationService" />
- <property name="messageSenders">
- <list>
- <ref bean="emailMessageSender"/>
- </list>
- </property>
</bean>
<bean id="emailMessageSender" class="org.hisp.dhis.message.EmailMessageSender">