| Line 1... |
Line 1... |
| 1 |
package com.smartdukaan.cron;
|
1 |
package com.smartdukaan.cron;
|
| 2 |
|
2 |
|
| - |
|
3 |
import java.io.IOException;
|
| 3 |
import java.time.LocalDate;
|
4 |
import java.time.LocalDate;
|
| 4 |
import java.util.Arrays;
|
5 |
import java.util.Arrays;
|
| 5 |
import java.util.List;
|
6 |
import java.util.List;
|
| 6 |
import java.util.Properties;
|
7 |
import java.util.Properties;
|
| 7 |
|
8 |
|
| 8 |
import org.apache.logging.log4j.LogManager;
|
9 |
import org.apache.logging.log4j.LogManager;
|
| 9 |
import org.apache.logging.log4j.Logger;
|
10 |
import org.apache.logging.log4j.Logger;
|
| - |
|
11 |
import org.apache.velocity.app.VelocityEngine;
|
| - |
|
12 |
import org.apache.velocity.exception.VelocityException;
|
| 10 |
import org.springframework.beans.factory.annotation.Autowired;
|
13 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 11 |
import org.springframework.boot.ApplicationArguments;
|
14 |
import org.springframework.boot.ApplicationArguments;
|
| 12 |
import org.springframework.boot.ApplicationRunner;
|
15 |
import org.springframework.boot.ApplicationRunner;
|
| 13 |
import org.springframework.boot.WebApplicationType;
|
16 |
import org.springframework.boot.WebApplicationType;
|
| 14 |
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
17 |
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
| Line 20... |
Line 23... |
| 20 |
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
23 |
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
| 21 |
import org.springframework.core.io.ClassPathResource;
|
24 |
import org.springframework.core.io.ClassPathResource;
|
| 22 |
import org.springframework.mail.javamail.JavaMailSender;
|
25 |
import org.springframework.mail.javamail.JavaMailSender;
|
| 23 |
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
26 |
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
| 24 |
import org.springframework.scheduling.annotation.EnableScheduling;
|
27 |
import org.springframework.scheduling.annotation.EnableScheduling;
|
| - |
|
28 |
import org.springframework.ui.velocity.VelocityEngineFactoryBean;
|
| 25 |
|
29 |
|
| 26 |
import com.smartdukaan.cron.migrations.RunOnceTasks;
|
30 |
import com.smartdukaan.cron.migrations.RunOnceTasks;
|
| 27 |
import com.smartdukaan.cron.scheduled.InvestmentRelatedTasks;
|
31 |
import com.smartdukaan.cron.scheduled.InvestmentRelatedTasks;
|
| 28 |
import com.smartdukaan.cron.scheduled.Reconciliation;
|
32 |
import com.smartdukaan.cron.scheduled.Reconciliation;
|
| 29 |
import com.smartdukaan.cron.scheduled.ScheduledSkeleton;
|
33 |
import com.smartdukaan.cron.scheduled.ScheduledSkeleton;
|
| Line 65... |
Line 69... |
| 65 |
LOGGER.info("Called Configuration");
|
69 |
LOGGER.info("Called Configuration");
|
| 66 |
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
|
70 |
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
|
| 67 |
propertySourcesPlaceholderConfigurer.setLocation(new ClassPathResource("/META-INF/env.properties"));
|
71 |
propertySourcesPlaceholderConfigurer.setLocation(new ClassPathResource("/META-INF/env.properties"));
|
| 68 |
return propertySourcesPlaceholderConfigurer;
|
72 |
return propertySourcesPlaceholderConfigurer;
|
| 69 |
}
|
73 |
}
|
| - |
|
74 |
|
| - |
|
75 |
|
| - |
|
76 |
@Bean(name = "veloctyEngine")
|
| - |
|
77 |
public VelocityEngine velocityEngine() throws VelocityException, IOException {
|
| - |
|
78 |
VelocityEngineFactoryBean factory = new VelocityEngineFactoryBean();
|
| - |
|
79 |
// Properties props = new Properties();
|
| - |
|
80 |
// props.put("resource.loader", "file");
|
| - |
|
81 |
|
| - |
|
82 |
// props.put("file.resource.loader.description", "Velocity File Resource
|
| - |
|
83 |
// Loader");
|
| - |
|
84 |
// props.put("file.resource.loader.class",
|
| - |
|
85 |
// "org.apache.velocity.runtime.resource.loader.FileResourceLoader");
|
| - |
|
86 |
// props.put("file.resource.loader.cache", true);
|
| - |
|
87 |
// props.put("file.resource.loader.path", ".");
|
| - |
|
88 |
|
| - |
|
89 |
Properties velocityProperties = new Properties();
|
| - |
|
90 |
velocityProperties.put("resource.loader", "class");
|
| - |
|
91 |
velocityProperties.put("class.resource.loader.class",
|
| - |
|
92 |
"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
|
| - |
|
93 |
velocityProperties.put("file.resource.loader.cache", true);
|
| - |
|
94 |
velocityProperties.put("file.resource.loader.unicode", true);
|
| - |
|
95 |
velocityProperties.put("input.encoding", "UTF-8");
|
| - |
|
96 |
velocityProperties.put("output.encoding", "UTF-8");
|
| - |
|
97 |
velocityProperties.put("overrideLogging", true);
|
| - |
|
98 |
|
| - |
|
99 |
// velocityProperties.put("file.resource.loader.path", ".");
|
| - |
|
100 |
|
| - |
|
101 |
factory.setVelocityProperties(velocityProperties);
|
| - |
|
102 |
|
| - |
|
103 |
return factory.createVelocityEngine();
|
| - |
|
104 |
|
| - |
|
105 |
}
|
| 70 |
|
106 |
|
| 71 |
@Bean(name = "mailSender")
|
107 |
@Bean(name = "mailSender")
|
| 72 |
@Primary
|
108 |
@Primary
|
| 73 |
public JavaMailSender sendGridMailSender() {
|
109 |
public JavaMailSender sendGridMailSender() {
|
| 74 |
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
|
110 |
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
|
| Line 407... |
Line 443... |
| 407 |
}
|
443 |
}
|
| 408 |
|
444 |
|
| 409 |
if (args.containsOption("fixScans")) {
|
445 |
if (args.containsOption("fixScans")) {
|
| 410 |
runOnceTasks.fixScans();
|
446 |
runOnceTasks.fixScans();
|
| 411 |
}
|
447 |
}
|
| 412 |
/*
|
- |
|
| 413 |
* if (args.containsOption("reverseInvestmentSchemes")) {
|
- |
|
| 414 |
* runOnceTasks.reverseSchemes(); }
|
- |
|
| 415 |
*/
|
- |
|
| 416 |
|
- |
|
| 417 |
System.exit(0);
|
448 |
System.exit(0);
|
| 418 |
}
|
449 |
}
|
| 419 |
}
|
450 |
}
|
| 420 |
|
451 |
|
| 421 |
}
|
452 |
}
|
| 422 |
|
453 |
|