Skip to content

Commit bbd7326

Browse files
Merge pull request #6727 from ORCID/UseOnlyOnePropertyConfigurer
Use only one property configurer
2 parents 65a8dff + 01d23dd commit bbd7326

10 files changed

Lines changed: 40 additions & 58 deletions

File tree

orcid-api-web/src/main/resources/orcid-api-web-context.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
88
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd">
99

10-
<context:property-placeholder location="\${org.orcid.config.file}" ignore-resource-not-found="true" ignore-unresolvable="true" />
11-
1210
<import resource="classpath*:orcid-core-context.xml"/>
1311
<import resource="classpath*:orcid-api-security-context.xml"/>
1412

orcid-core/src/main/resources/orcid-core-context.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
1111
http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-4.3.xsd">
1212

13-
<context:property-placeholder location="\${org.orcid.config.file}" ignore-resource-not-found="true" ignore-unresolvable="true" />
14-
1513
<import resource="classpath*:orcid-persistence-context.xml" />
1614

1715
<bean id="httpRequestUtils" class="org.orcid.core.utils.http.HttpRequestUtils" />

orcid-internal-api/src/main/resources/orcid-internal-api-context.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
88
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd">
99

10-
<context:property-placeholder location="\${org.orcid.config.file}" ignore-resource-not-found="true" ignore-unresolvable="true" />
11-
1210
<import resource="classpath*:orcid-core-context.xml"/>
1311
<import resource="classpath*:orcid-internal-api-security-context.xml"/>
1412

orcid-pub-web/src/main/resources/orcid-t1-web-context.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
1010
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.3.xsd">
1111

12-
<context:property-placeholder location="\${org.orcid.config.file}" ignore-resource-not-found="true" ignore-unresolvable="true" />
13-
1412
<import resource="classpath*:orcid-core-context.xml"/>
1513
<import resource="classpath*:orcid-t1-security-context.xml"/>
1614

orcid-scheduler-web/src/main/java/org/orcid/scheduler/validation/PublicProfileValidator.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.orcid.scheduler.validation;
22

33
import java.io.IOException;
4-
import java.net.URISyntaxException;
54
import java.util.Calendar;
65
import java.util.List;
76

@@ -41,30 +40,26 @@ public class PublicProfileValidator {
4140
@Resource
4241
protected ValidatedPublicProfileDao validatedPublicProfileDao;
4342

43+
@Value("${org.orcid.scheduler.api.profile.validation.baseUrl:https://localhost:8443/orcid-pub-web/v3.0/}")
4444
private String baseUri;
4545

4646
private Schema schema;
4747

48+
@Value("${org.orcid.scheduler.api.profile.validation.developmentMode:false}")
4849
private boolean developmentMode;
4950

5051
@Value("${org.orcid.scheduler.api.profile.validation.maxAgeInDays:90}")
5152
private int validationMaxAgeInDays;
5253

5354
@Value("${org.orcid.scheduler.api.profile.validation.batchSize:100}")
54-
private int batchSize;
55-
56-
@SuppressWarnings("resource")
57-
public PublicProfileValidator(String baseUri, boolean developmentMode) throws URISyntaxException {
58-
this.baseUri = baseUri;
59-
this.developmentMode = developmentMode;
60-
}
55+
private int batchSize;
6156

6257
public void processValidationCycle() {
6358
init();
6459
removeOldRecords();
6560
validateRecords();
6661
}
67-
62+
6863
private void init() {
6964
Source source = new StreamSource(getClass().getResourceAsStream("/record_3.0/record-3.0.xsd"));
7065
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);

orcid-scheduler-web/src/main/resources/orcid-scheduler-context.xml

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,31 @@
1010
http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-4.3.xsd
1111
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.3.xsd">
1212

13-
<context:property-placeholder location="\${org.orcid.config.file}" ignore-resource-not-found="true" ignore-unresolvable="true" />
14-
1513
<import resource="classpath*:orcid-core-context.xml"/>
1614

1715
<context:component-scan
1816
base-package="org.orcid.scheduler.loader" />
1917

2018
<task:scheduled-tasks scheduler="scheduler">
21-
<task:scheduled ref="webhookManager" method="processWebhooks" cron="${org.orcid.scheduler.web.processWebhooks:25 25 0-2 * * *}"/>
22-
<task:scheduled ref="statisticsManager" method="generateStatistics" cron="${org.orcid.scheduler.web.generateStats:0 0 0 * * FRI}"/>
23-
<task:scheduled ref="orgDisambiguatedManager" method="processOrgsWithIncorrectPopularity" cron="${org.orcid.scheduler.web.processOrgsWithIncorrectPopularity:45 45 0-2 * * *}"/>
24-
<task:scheduled ref="orgDisambiguatedManager" method="processOrgsForIndexing" cron="${org.orcid.scheduler.web.processOrgsForIndexing:55 55 0-2 * * *}"/>
25-
<task:scheduled ref="cleanOldClientKeysCronJob" method="cleanOldClientKeys" cron="${org.orcid.scheduler.web.cleanOldClientKeys:0 0 0/1 * * ?}" />
26-
<task:scheduled ref="emailMessageSender" method="sendEmailMessages" cron="${org.orcid.scheduler.web.sendEmailMessages:35 */5 * * * *}" />
27-
<task:scheduled ref="emailMessageSender" method="processUnverifiedEmails2Days" cron="${org.orcid.scheduler.web.processUnverifiedEmails2Days:0 10 * * * *}"/>
28-
<task:scheduled ref="identityProviderLoader" method="loadIdentityProviders" cron="${org.orcid.scheduler.web.loadIdentityProviders:05 05 0-2 * * *}"/>
29-
<task:scheduled ref="notificationManager" method="processOldNotificationsToAutoArchive" cron="${org.orcid.scheduler.web.processOldNotificationsToAutoArchive:06 06 1 * * *}"/>
30-
<task:scheduled ref="notificationManager" method="processOldNotificationsToAutoDelete" cron="${org.orcid.scheduler.web.processOldNotificationsToAutoDelete:07 07 2 * * *}"/>
31-
<task:scheduled ref="notificationManagerV3" method="archiveOffsetNotifications" cron="${org.orcid.scheduler.web.archiveOffsetNotifications:08 08 3 * * *}"/>
32-
<task:scheduled ref="notificationManagerV3" method="deleteOffsetNotifications" cron="${org.orcid.scheduler.web.deleteOffsetNotifications:09 09 4 * * *}"/>
33-
<task:scheduled ref="orcidRecordIndexer" method="processProfilesWithPendingFlagAndAddToMessageQueue" fixed-delay="${org.orcid.scheduler.web.processProfilesPendingIndexingDelaySeconds:60}000"/>
34-
<task:scheduled ref="orcidRecordIndexer" method="processProfilesWithReindexFlagAndAddToMessageQueue" fixed-delay="${org.orcid.scheduler.web.processProfilesReindexIndexingDelaySeconds:90}000"/>
35-
<task:scheduled ref="orcidRecordIndexer" method="reindexRecordsOnSolr" fixed-delay="${org.orcid.scheduler.web.solrUpdateDelaySeconds:900}000"/>
36-
<task:scheduled ref="orcidRecordIndexer" method="reindexRecordsOnS3" fixed-delay="${org.orcid.scheduler.web.s3UpdateDelaySeconds:900}000"/>
37-
<task:scheduled ref="publicProfileValidator" method="processValidationCycle" cron="${org.orcid.scheduler.api.profile.validation.cronConfig:0 */10 * * * *}"/>
38-
<task:scheduled ref="orgLoadManager" method="loadOrgs" cron="${org.orcid.scheduler.web.orgImportsCronConfig}" />
39-
</task:scheduled-tasks>
19+
<task:scheduled ref="webhookManager" method="processWebhooks" cron="${org.orcid.scheduler.web.processWebhooks:25 25 0-2 * * *}"/>
20+
<task:scheduled ref="statisticsManager" method="generateStatistics" cron="${org.orcid.scheduler.web.generateStats:0 0 0 * * FRI}"/>
21+
<task:scheduled ref="orgDisambiguatedManager" method="processOrgsWithIncorrectPopularity" cron="${org.orcid.scheduler.web.processOrgsWithIncorrectPopularity:45 45 0-2 * * *}"/>
22+
<task:scheduled ref="orgDisambiguatedManager" method="processOrgsForIndexing" cron="${org.orcid.scheduler.web.processOrgsForIndexing:55 55 0-2 * * *}"/>
23+
<task:scheduled ref="cleanOldClientKeysCronJob" method="cleanOldClientKeys" cron="${org.orcid.scheduler.web.cleanOldClientKeys:0 0 0/1 * * ?}" />
24+
<task:scheduled ref="emailMessageSender" method="sendEmailMessages" cron="${org.orcid.scheduler.web.sendEmailMessages:35 */5 * * * *}" />
25+
<task:scheduled ref="emailMessageSender" method="processUnverifiedEmails2Days" cron="${org.orcid.scheduler.web.processUnverifiedEmails2Days:0 10 * * * *}"/>
26+
<task:scheduled ref="identityProviderLoader" method="loadIdentityProviders" cron="${org.orcid.scheduler.web.loadIdentityProviders:05 05 0-2 * * *}"/>
27+
<task:scheduled ref="notificationManager" method="processOldNotificationsToAutoArchive" cron="${org.orcid.scheduler.web.processOldNotificationsToAutoArchive:06 06 1 * * *}"/>
28+
<task:scheduled ref="notificationManager" method="processOldNotificationsToAutoDelete" cron="${org.orcid.scheduler.web.processOldNotificationsToAutoDelete:07 07 2 * * *}"/>
29+
<task:scheduled ref="notificationManagerV3" method="archiveOffsetNotifications" cron="${org.orcid.scheduler.web.archiveOffsetNotifications:08 08 3 * * *}"/>
30+
<task:scheduled ref="notificationManagerV3" method="deleteOffsetNotifications" cron="${org.orcid.scheduler.web.deleteOffsetNotifications:09 09 4 * * *}"/>
31+
<task:scheduled ref="orcidRecordIndexer" method="processProfilesWithPendingFlagAndAddToMessageQueue" fixed-delay="${org.orcid.scheduler.web.processProfilesPendingIndexingDelaySeconds:60}000"/>
32+
<task:scheduled ref="orcidRecordIndexer" method="processProfilesWithReindexFlagAndAddToMessageQueue" fixed-delay="${org.orcid.scheduler.web.processProfilesReindexIndexingDelaySeconds:90}000"/>
33+
<task:scheduled ref="orcidRecordIndexer" method="reindexRecordsOnSolr" fixed-delay="${org.orcid.scheduler.web.solrUpdateDelaySeconds:900}000"/>
34+
<task:scheduled ref="orcidRecordIndexer" method="reindexRecordsOnS3" fixed-delay="${org.orcid.scheduler.web.s3UpdateDelaySeconds:900}000"/>
35+
<task:scheduled ref="publicProfileValidator" method="processValidationCycle" cron="${org.orcid.scheduler.api.profile.validation.cronConfig:0 */10 * * * *}"/>
36+
<task:scheduled ref="orgLoadManager" method="loadOrgs" cron="${org.orcid.scheduler.web.orgImportsCronConfig}" />
37+
</task:scheduled-tasks>
4038

4139
<task:scheduler id="scheduler" pool-size="${org.orcid.scheduler.tasks.pool_size:20}"/>
4240

@@ -64,10 +62,7 @@
6462
<bean id="orcidRecordIndexer" class="org.orcid.scheduler.indexer.impl.OrcidRecordIndexerImpl" />
6563

6664
<!-- PUBLIC API VALIDATION - the following beans can be removed once we have validated (and fixed) all profiles against public api v3 -->
67-
<bean id="publicProfileValidator" class="org.orcid.scheduler.validation.PublicProfileValidator">
68-
<constructor-arg value="${org.orcid.scheduler.api.profile.validation.baseUrl:https://localhost:8443/orcid-pub-web/v3.0/}" />
69-
<constructor-arg value="${org.orcid.scheduler.api.profile.validation.developmentMode:false}" />
70-
</bean>
65+
<bean id="publicProfileValidator" class="org.orcid.scheduler.validation.PublicProfileValidator" />
7166

7267
<bean id="emailQueueListener" class="org.orcid.scheduler.email.trickle.listener.EmailQueueListener" >
7368
<property name="trickleManager" ref="trickleManager" />
@@ -77,9 +72,7 @@
7772

7873
<bean id="trickleManager" class="org.orcid.scheduler.email.trickle.manager.impl.TrickleManagerImpl" />
7974

80-
<bean id="mailGunManager" class="org.orcid.utils.email.MailGunManager">
81-
<constructor-arg value="${com.mailgun.apiKey:XXXX}"/>
82-
</bean>
75+
<bean id="mailGunManager" class="org.orcid.utils.email.MailGunManager" />
8376

8477
<bean id="emailMessageSender" class="org.orcid.scheduler.email.cli.manager.EmailMessageSenderImpl" />
8578

@@ -96,7 +89,7 @@
9689
<bean id="ringgoldOrgDataSource" class="org.orcid.scheduler.loader.source.ringgold.RinggoldOrgLoadSource" />
9790

9891
<bean id="jerseyClientHelper" class="org.orcid.utils.jersey.JerseyClientHelper">
99-
<constructor-arg value="${org.orcid.message-listener.development_mode:false}"/>
92+
<constructor-arg value="${org.orcid.utils.jersey.development_mode:false}"/>
10093
</bean>
10194

10295
<bean id="jerseyClientHelperDevelopmentMode" class="org.orcid.utils.jersey.JerseyClientHelper">

orcid-scheduler-web/src/test/resources/test-orcid-scheduler-context.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
<import resource="classpath*:orcid-scheduler-context.xml"/>
1717

18-
<bean id="mailGunManager" class="org.orcid.utils.email.MailGunManager">
19-
<constructor-arg value="${com.mailgun.apiKey:XXXX}"/>
20-
</bean>
18+
<bean id="mailGunManager" class="org.orcid.utils.email.MailGunManager" />
2119

2220
</beans>

orcid-utils/src/main/java/org/orcid/utils/email/MailGunManager.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import java.util.AbstractMap.SimpleEntry;
44

5+
import javax.annotation.PostConstruct;
6+
57
import org.orcid.utils.jersey.JerseyClientHelper;
68
import org.orcid.utils.jersey.JerseyClientResponse;
79
import org.slf4j.Logger;
@@ -41,19 +43,23 @@ public class MailGunManager {
4143

4244
@Value("${com.mailgun.testmode:yes}")
4345
private String testmode;
46+
47+
@Value("${com.mailgun.apiKey}")
48+
private String apiKey;
4449

4550
@Value("${com.mailgun.regexFilter:.*(orcid\\.org|mailinator\\.com)$}")
4651
private String filter;
4752

48-
private final JerseyClientHelper jerseyClientHelper;
53+
private JerseyClientHelper jerseyClientHelper;
4954

5055
private static final Logger LOGGER = LoggerFactory.getLogger(MailGunManager.class);
5156

52-
public MailGunManager(String apiKey) {
57+
@PostConstruct
58+
public void initJerseyClientHelper() {
5359
// Mailgun username and password
5460
SimpleEntry<String, String> auth = new SimpleEntry<String, String>("api", apiKey);
5561
// Setup our own jersey helper with the mailgun credentials
56-
jerseyClientHelper = new JerseyClientHelper(auth);
62+
jerseyClientHelper = new JerseyClientHelper(auth);
5763
}
5864

5965
public boolean sendMarketingEmail(String from, String to, String subject, String text, String html) {

orcid-web/src/main/resources/orcid-frontend-web-servlet.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
1616
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.3.xsd
1717
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd">
18-
19-
<context:property-placeholder location="\${org.orcid.config.file}" ignore-resource-not-found="true" ignore-unresolvable="true" />
2018

2119
<import resource="classpath*:orcid-core-context.xml" />
2220
<import resource="classpath*:orcid-frontend-security.xml" />
@@ -99,14 +97,12 @@
9997

10098
<bean id="thirdPartyLinkManager" class="org.orcid.frontend.web.util.ThirdPartyLinkManager" />
10199

102-
<bean id="mailGunManager" class="org.orcid.utils.email.MailGunManager">
103-
<constructor-arg value="${com.mailgun.apiKey:XXXX}"/>
104-
</bean>
100+
<bean id="mailGunManager" class="org.orcid.utils.email.MailGunManager" />
105101

106102
<bean id="recordEmailSender" class="org.orcid.frontend.email.RecordEmailSender" />
107103

108104
<bean id="jerseyClientHelper" class="org.orcid.utils.jersey.JerseyClientHelper">
109-
<constructor-arg value="${org.orcid.message-listener.development_mode:false}"/>
105+
<constructor-arg value="${org.orcid.utils.jersey.development_mode:false}"/>
110106
</bean>
111107

112108
<bean id="slackManager" class="org.orcid.utils.alerting.impl.SlackManagerImpl" />

properties/development.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ org.orcid.persistence.togglz.db.username=orcid
5656
################
5757
# CORE #
5858
################
59+
# Jersey development mode
60+
org.orcid.utils.jersey.development_mode=true
5961

6062
# ORCID URI's, no trailing slashes, please
6163
org.orcid.core.aboutUri=https://info.orcid.org

0 commit comments

Comments
 (0)