Skip to content

Commit 9fa2f38

Browse files
author
gm2552
committed
Updating to SpringBoot 2.1.3 and SpringCloud Greenwich.SR1
Also allowing Gateway configuration parameters to be read from staMailet.properties file.
1 parent 621c4e3 commit 9fa2f38

2 files changed

Lines changed: 27 additions & 15 deletions

File tree

pom.xml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<artifactId>gateway</artifactId>
66
<name>Direct Project Agent Gateways.</name>
7-
<version>6.1-SNAPSHOT</version>
7+
<version>6.0.2-SNAPSHOT</version>
88
<description>Direct Project security agent gateways and bridges.</description>
99
<inceptionYear>2010</inceptionYear>
1010
<url>https://github.com/DirectProjectJavaRI/gateway</url>
@@ -28,7 +28,7 @@
2828
<parent>
2929
<groupId>org.springframework.boot</groupId>
3030
<artifactId>spring-boot-dependencies</artifactId>
31-
<version>2.1.2.RELEASE</version>
31+
<version>2.1.3.RELEASE</version>
3232
</parent>
3333
<scm>
3434
<url>https://nhin-d.googlecode.com/hg/java/gateway/</url>
@@ -45,14 +45,14 @@
4545
<dependency>
4646
<groupId>org.springframework.boot</groupId>
4747
<artifactId>spring-boot-dependencies</artifactId>
48-
<version>2.1.2.RELEASE</version>
48+
<version>2.1.3.RELEASE</version>
4949
<type>pom</type>
5050
<scope>import</scope>
5151
</dependency>
5252
<dependency>
5353
<groupId>org.springframework.cloud</groupId>
5454
<artifactId>spring-cloud-starter-parent</artifactId>
55-
<version>Greenwich.RELEASE</version>
55+
<version>Greenwich.SR1</version>
5656
<type>pom</type>
5757
<scope>import</scope>
5858
</dependency>
@@ -62,32 +62,32 @@
6262
<dependency>
6363
<groupId>org.nhind</groupId>
6464
<artifactId>agent</artifactId>
65-
<version>6.0.1</version>
65+
<version>6.0.3-SNAPSHOT</version>
6666
</dependency>
6767
<dependency>
6868
<groupId>org.nhind</groupId>
6969
<artifactId>direct-common</artifactId>
70-
<version>6.0</version>
70+
<version>6.0.1-SNAPSHOT</version>
7171
</dependency>
7272
<dependency>
7373
<groupId>org.nhind</groupId>
7474
<artifactId>direct-common-audit</artifactId>
75-
<version>6.0</version>
75+
<version>6.0.1-SNAPSHOT</version>
7676
</dependency>
7777
<dependency>
7878
<groupId>org.nhind</groupId>
7979
<artifactId>config-service-client</artifactId>
80-
<version>6.0</version>
80+
<version>6.0.1-SNAPSHOT</version>
8181
</dependency>
8282
<dependency>
8383
<groupId>org.nhind</groupId>
8484
<artifactId>direct-msg-monitor-client</artifactId>
85-
<version>6.0</version>
85+
<version>6.0.1-SNAPSHOT</version>
8686
</dependency>
8787
<dependency>
8888
<groupId>org.nhind</groupId>
8989
<artifactId>xd-common</artifactId>
90-
<version>6.0</version>
90+
<version>6.0.1-SNAPSHOT</version>
9191
<exclusions>
9292
<exclusion>
9393
<groupId>org.springframework.boot</groupId>
@@ -103,7 +103,7 @@
103103
<dependency>
104104
<groupId>org.nhind</groupId>
105105
<artifactId>agent</artifactId>
106-
<version>6.0</version>
106+
<version>6.0.3-SNAPSHOT</version>
107107
<type>test-jar</type>
108108
<scope>test</scope>
109109
</dependency>
@@ -156,7 +156,7 @@
156156
<dependency>
157157
<groupId>org.nhind</groupId>
158158
<artifactId>config-service-jar</artifactId>
159-
<version>6.0</version>
159+
<version>6.0.2-SNAPSHOT</version>
160160
<scope>test</scope>
161161
</dependency>
162162
<dependency>

src/main/java/org/nhindirect/gateway/GatewayConfiguration.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2424
import org.apache.mailet.Mailet;
2525
import org.nhindirect.common.options.OptionsManager;
2626
import org.nhindirect.common.options.OptionsParameter;
27+
import org.springframework.context.ApplicationContext;
2728
/**
2829
* Utility class for retrieving parameterized configuration options. Options for the can be configured in one of two ways:
2930
* either by setting appropriate option as an XML element in a mailet's XML configuration (optional and typically found in the config.xml file
@@ -47,10 +48,21 @@ public class GatewayConfiguration
4748
* @param mailet The mailet to search. May be null
4849
* @return If found, returns, the value of the configured value. Otherwise, the default value is returned
4950
*/
50-
public static final String getConfigurationParam(String param, Mailet mailet, String defaultValue)
51+
public static final String getConfigurationParam(String param, Mailet mailet, ApplicationContext ctx, String defaultValue)
5152
{
5253
// get from the mailet init parameter first
5354
String paramValue = (mailet == null) ? null : mailet.getMailetConfig().getInitParameter(param);
55+
56+
if (paramValue == null || paramValue.isEmpty() && ctx != null)
57+
{
58+
// try the application context
59+
try
60+
{
61+
paramValue = ctx.getEnvironment().getProperty(param);
62+
}
63+
catch (Exception e) {/* no-op */}
64+
}
65+
5466
if (paramValue == null || paramValue.isEmpty())
5567
{
5668
// if not in the mailet config, then try the
@@ -69,9 +81,9 @@ public static final String getConfigurationParam(String param, Mailet mailet, St
6981
* @param mailet The mailet to search. May be null
7082
* @return If found, returns, the value of the configured value. Otherwise, the default value is returned.
7183
*/
72-
public static final boolean getConfigurationParamAsBoolean(String param, Mailet mailet, boolean defaultValue)
84+
public static final boolean getConfigurationParamAsBoolean(String param, Mailet mailet, ApplicationContext ctx, boolean defaultValue)
7385
{
74-
final String paramValue = getConfigurationParam(param, mailet, "");
86+
final String paramValue = getConfigurationParam(param, mailet, ctx, "");
7587

7688
// get from the mailet init parameter first
7789
return (paramValue.isEmpty()) ? defaultValue : Boolean.parseBoolean(paramValue);

0 commit comments

Comments
 (0)