dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #43723
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22163: SchedulingManager, using application listener for init
------------------------------------------------------------
revno: 22163
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2016-03-07 19:04:27 +0100
message:
SchedulingManager, using application listener for init
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/JCloudsFileResourceContentStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultSchemaService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/DefaultSmsConfigurationManager.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/DefaultSchedulingManager.java
dhis-2/dhis-services/dhis-service-reporting/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/fileresource/JCloudsFileResourceContentStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/JCloudsFileResourceContentStore.java 2016-02-16 21:30:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/JCloudsFileResourceContentStore.java 2016-03-07 18:04:27 +0000
@@ -63,6 +63,9 @@
import java.util.Properties;
import java.util.regex.Pattern;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
/**
* @author Halvdan Hoem Grelland
*/
@@ -111,6 +114,7 @@
// Life cycle management
// -------------------------------------------------------------------------
+ @PostConstruct
public void init()
{
String provider = configurationProvider.getProperty( ConfigurationKey.FILESTORE_PROVIDER );
@@ -183,6 +187,7 @@
}
}
+ @PreDestroy
public void cleanUp()
{
blobStoreContext.close();
@@ -361,7 +366,7 @@
if ( provider.equals( JCLOUDS_PROVIDER_KEY_FILESYSTEM ) && !locationManager.externalDirectorySet() )
{
- log.warn( "File system file store provider could not be configured; external directory is not set. " +
+ log.info( "File system file store provider could not be configured; external directory is not set. " +
"Falling back to in-memory provider." );
provider = JCLOUDS_PROVIDER_KEY_TRANSIENT;
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultSchemaService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultSchemaService.java 2016-03-07 16:43:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultSchemaService.java 2016-03-07 18:04:27 +0000
@@ -74,6 +74,7 @@
@Autowired
private TranslationService translationService;
+ @Override
public void onApplicationEvent( ContextRefreshedEvent contextRefreshedEvent )
{
for ( SchemaDescriptor descriptor : descriptors )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/DefaultSmsConfigurationManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/DefaultSmsConfigurationManager.java 2016-03-07 14:25:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/DefaultSmsConfigurationManager.java 2016-03-07 18:04:27 +0000
@@ -58,6 +58,7 @@
@Autowired( required = false )
private List<SmsConfigurable> smsConfigurables;
+ @Override
public void onApplicationEvent( ContextRefreshedEvent contextRefreshedEvent )
{
initializeSmsConfigurables();
=== 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 2016-03-07 13:15:24 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2016-03-07 18:04:27 +0000
@@ -624,8 +624,7 @@
<property name="sessionFactory" ref="sessionFactory" />
</bean>
- <bean id="org.hisp.dhis.fileresource.FileResourceContentStore" class="org.hisp.dhis.fileresource.JCloudsFileResourceContentStore"
- init-method="init" destroy-method="cleanUp">
+ <bean id="org.hisp.dhis.fileresource.FileResourceContentStore" class="org.hisp.dhis.fileresource.JCloudsFileResourceContentStore">
<property name="configurationProvider" ref="dhisConfigurationProvider" />
<property name="locationManager" ref="locationManager" />
</bean>
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/DefaultSchedulingManager.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/DefaultSchedulingManager.java 2016-02-19 14:24:05 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/scheduling/DefaultSchedulingManager.java 2016-03-07 18:04:27 +0000
@@ -38,6 +38,8 @@
import org.hisp.dhis.setting.SystemSettingManager;
import org.hisp.dhis.system.scheduling.ScheduledTaskStatus;
import org.hisp.dhis.system.scheduling.Scheduler;
+import org.springframework.context.ApplicationListener;
+import org.springframework.context.event.ContextRefreshedEvent;
/**
* Cron refers to the cron expression used for scheduling. Key refers to the key
@@ -46,7 +48,7 @@
* @author Lars Helge Overland
*/
public class DefaultSchedulingManager
- implements SchedulingManager
+ implements ApplicationListener<ContextRefreshedEvent>, SchedulingManager
{
// -------------------------------------------------------------------------
// Dependencies
@@ -80,6 +82,12 @@
// -------------------------------------------------------------------------
@Override
+ public void onApplicationEvent( ContextRefreshedEvent contextRefreshedEvent )
+ {
+ scheduleTasks();
+ }
+
+ @Override
public void scheduleTasks()
{
ListMap<String, String> cronKeyMap = getCronKeyMap();
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2016-02-19 14:24:05 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2016-03-07 18:04:27 +0000
@@ -167,8 +167,7 @@
<!-- Scheduling -->
- <bean id="org.hisp.dhis.scheduling.SchedulingManager" class="org.hisp.dhis.scheduling.DefaultSchedulingManager"
- init-method="scheduleTasks">
+ <bean id="org.hisp.dhis.scheduling.SchedulingManager" class="org.hisp.dhis.scheduling.DefaultSchedulingManager">
<property name="systemSettingManager" ref="org.hisp.dhis.setting.SystemSettingManager" />
<property name="scheduler" ref="scheduler" />
<property name="tasks">