Skip to content

Commit ea97c7d

Browse files
author
Greg Meyer
authored
Merge pull request #16 from DirectProjectJavaRI/develop
Releasing 8.0.0
2 parents df29fb6 + 7c709ce commit ea97c7d

88 files changed

Lines changed: 2498 additions & 3270 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ hs_err_pid*
2424
/.DS_Store
2525
/.project
2626
/.classpath
27+
/target/

pom.xml

Lines changed: 26 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.nhind</groupId>
55
<artifactId>config-service-jar</artifactId>
6-
<version>7.0.2</version>
6+
<version>8.0.0</version>
77
<packaging>jar</packaging>
88
<name>NHIN Direct Java RI config service jar</name>
99
<description>NHIN Direct Java RI config service jar.</description>
@@ -13,13 +13,14 @@
1313
<connection>scm:git:https://github.com/DirectProjectJavaRI/config-service-jar.git</connection>
1414
</scm>
1515
<prerequisites>
16-
<maven>3.0.0</maven>
16+
<maven>3.5.0</maven>
1717
</prerequisites>
18-
<parent>
18+
<parent>
1919
<groupId>org.springframework.boot</groupId>
2020
<artifactId>spring-boot-dependencies</artifactId>
21-
<version>2.2.9.RELEASE</version>
22-
</parent>
21+
<version>2.5.2</version>
22+
<relativePath />
23+
</parent>
2324
<developers>
2425
<developer>
2526
<name>Pat Pyette</name>
@@ -43,97 +44,42 @@
4344
<name>New BSD License</name>
4445
<url>http://nhindirect.org/BSDLicense</url>
4546
</license>
46-
</licenses>
47-
<repositories>
48-
<repository>
49-
<id>spring-milestones</id>
50-
<name>Spring Milestones</name>
51-
<url>https://repo.spring.io/milestone</url>
52-
</repository>
53-
</repositories>
47+
</licenses>
5448
<properties>
5549
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
56-
<camel.version>2.22.0</camel.version>
50+
<commons-net.version>3.8.0</commons-net.version>
51+
<bcprov-jdk15on.version>1.68</bcprov-jdk15on.version>
5752
</properties>
5853
<dependencies>
5954
<dependency>
6055
<groupId>org.springframework.boot</groupId>
6156
<artifactId>spring-boot-starter-webflux</artifactId>
62-
</dependency>
63-
<dependency>
64-
<groupId>org.springframework.boot</groupId>
65-
<artifactId>spring-boot-starter-tomcat</artifactId>
66-
</dependency>
67-
<dependency>
68-
<groupId>org.flywaydb</groupId>
69-
<artifactId>flyway-core</artifactId>
70-
<version>6.1.4</version>
71-
</dependency>
72-
<dependency>
73-
<groupId>com.fasterxml.jackson.core</groupId>
74-
<artifactId>jackson-databind</artifactId>
75-
</dependency>
57+
</dependency>
7658
<dependency>
7759
<groupId>org.nhind</groupId>
7860
<artifactId>config-store</artifactId>
79-
<version>7.0</version>
61+
<version>8.0.0</version>
8062
</dependency>
8163
<dependency>
8264
<groupId>org.nhind</groupId>
8365
<artifactId>config-model</artifactId>
84-
<version>7.0</version>
66+
<version>8.0.0</version>
8567
</dependency>
8668
<dependency>
8769
<groupId>org.nhind</groupId>
8870
<artifactId>direct-common</artifactId>
89-
<version>7.0</version>
90-
</dependency>
91-
<dependency>
92-
<groupId>com.google.guava</groupId>
93-
<artifactId>guava</artifactId>
94-
<version>28.2-jre</version>
95-
</dependency>
96-
<dependency>
97-
<groupId>org.apache.camel</groupId>
98-
<artifactId>camel-core</artifactId>
99-
<version>${camel.version}</version>
100-
</dependency>
101-
<dependency>
102-
<groupId>org.apache.camel</groupId>
103-
<artifactId>camel-spring</artifactId>
104-
<version>${camel.version}</version>
105-
</dependency>
106-
<dependency>
107-
<groupId>org.apache.camel</groupId>
108-
<artifactId>camel-mina</artifactId>
109-
<version>${camel.version}</version>
110-
</dependency>
71+
<version>8.0.0</version>
72+
</dependency>
11173
<dependency>
11274
<groupId>commons-net</groupId>
11375
<artifactId>commons-net</artifactId>
114-
<version>3.6</version>
76+
<version>${commons-net.version}</version>
11577
</dependency>
11678
<dependency>
11779
<groupId>org.bouncycastle</groupId>
11880
<artifactId>bcprov-jdk15on</artifactId>
119-
<version>1.64</version>
120-
</dependency>
121-
<dependency>
122-
<groupId>org.apache.camel</groupId>
123-
<artifactId>camel-test</artifactId>
124-
<version>${camel.version}</version>
125-
<scope>test</scope>
126-
</dependency>
127-
<dependency>
128-
<groupId>junit</groupId>
129-
<artifactId>junit</artifactId>
130-
<scope>test</scope>
131-
</dependency>
132-
<dependency>
133-
<groupId>org.mockito</groupId>
134-
<artifactId>mockito-core</artifactId>
135-
<scope>test</scope>
136-
</dependency>
81+
<version>${bcprov-jdk15on.version}</version>
82+
</dependency>
13783
<dependency>
13884
<groupId>com.h2database</groupId>
13985
<artifactId>h2</artifactId>
@@ -143,30 +89,12 @@
14389
<groupId>org.springframework.boot</groupId>
14490
<artifactId>spring-boot-starter-test</artifactId>
14591
<scope>test</scope>
146-
</dependency>
147-
<dependency>
148-
<groupId>org.apache.camel</groupId>
149-
<artifactId>camel-spring-boot-starter</artifactId>
150-
<version>2.22.0</version>
151-
<scope>test</scope>
152-
</dependency>
153-
<dependency>
154-
<groupId>com.h2database</groupId>
155-
<artifactId>h2</artifactId>
156-
<scope>test</scope>
157-
</dependency>
158-
<dependency>
159-
<groupId>org.springframework.boot.experimental</groupId>
160-
<artifactId>spring-boot-starter-r2dbc-h2</artifactId>
161-
<version>0.1.0.M1</version>
162-
<scope>test</scope>
163-
</dependency>
92+
</dependency>
16493
<dependency>
16594
<groupId>io.r2dbc</groupId>
16695
<artifactId>r2dbc-h2</artifactId>
167-
<version>0.8.1.RELEASE</version>
16896
<scope>test</scope>
169-
</dependency>
97+
</dependency>
17098
</dependencies>
17199
<build>
172100
<plugins>
@@ -229,9 +157,8 @@
229157
<plugin>
230158
<groupId>org.apache.maven.plugins</groupId>
231159
<artifactId>maven-javadoc-plugin</artifactId>
232-
<version>2.9.1</version>
233160
<configuration>
234-
<additionalparam>-Xdoclint:none</additionalparam>
161+
<additionalJOption>-Xdoclint:none</additionalJOption>
235162
<charset>UTF-8</charset>
236163
<docencoding>UTF-8</docencoding>
237164
<source>1.8</source>
@@ -246,7 +173,8 @@
246173
</goals>
247174
</execution>
248175
</executions>
249-
</plugin>
176+
</plugin>
177+
<!-- for releases only
250178
<plugin>
251179
<groupId>org.apache.maven.plugins</groupId>
252180
<artifactId>maven-gpg-plugin</artifactId>
@@ -259,22 +187,22 @@
259187
</goals>
260188
</execution>
261189
</executions>
190+
<version>3.0.1</version>
262191
</plugin>
192+
-->
263193
</plugins>
264194
</build>
265195
<reporting>
266196
<plugins>
267197
<plugin>
268198
<groupId>org.apache.maven.plugins</groupId>
269199
<artifactId>maven-project-info-reports-plugin</artifactId>
270-
<version>2.9</version>
271200
</plugin>
272201
<plugin>
273202
<groupId>org.apache.maven.plugins</groupId>
274203
<artifactId>maven-javadoc-plugin</artifactId>
275-
<version>2.9.1</version>
276204
<configuration>
277-
<additionalparam>-Xdoclint:none</additionalparam>
205+
<additionalJOption>-Xdoclint:none</additionalJOption>
278206
<charset>UTF-8</charset>
279207
<docencoding>UTF-8</docencoding>
280208
<docfilessubdirs>true</docfilessubdirs>
@@ -298,6 +226,7 @@
298226
<plugin>
299227
<groupId>org.apache.maven.plugins</groupId>
300228
<artifactId>maven-jxr-plugin</artifactId>
229+
<version>3.1.1</version>
301230
</plugin>
302231
<plugin>
303232
<groupId>org.codehaus.mojo</groupId>

src/main/java/org/nhindirect/config/processor/BundleCacheUpdateProcessor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2121

2222
package org.nhindirect.config.processor;
2323

24+
import reactor.core.publisher.Mono;
25+
2426
/**
2527
* Interface for updating the anchors within the local storage medium. This interface is typically
2628
* incorporated as part of enterprise application flow such as an Apache Camel route and is executed on a
@@ -34,5 +36,5 @@ public interface BundleCacheUpdateProcessor
3436
* Updates all anchors within each bundle in the system based on the bundles's refresh interval. If the bundles
3537
* refresh threshold has not been met, then the bundle will not be checked for updates. Anchors are loaded from the bundle's URL.
3638
*/
37-
public void updateBundleCache();
39+
public Mono<Void> updateBundleCache();
3840
}

src/main/java/org/nhindirect/config/processor/BundleRefreshProcessor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2323

2424
import org.nhindirect.config.store.TrustBundle;
2525

26+
import reactor.core.publisher.Mono;
27+
2628
/**
2729
* Interface for refreshing the anchors within a bundle. This interface is typically
2830
* incorporated as part of enterprise application flow such as an Apache Camel route
@@ -37,5 +39,5 @@ public interface BundleRefreshProcessor
3739
* using the bundle checksum), then the anchors in the bundle may not be updated.
3840
* @param bundle The bundle that will be updated.
3941
*/
40-
public void refreshBundle(TrustBundle bundle);
42+
public Mono<?> refreshBundle(TrustBundle bundle);
4143
}

src/main/java/org/nhindirect/config/processor/impl/DefaultBundleCacheUpdateProcessorImpl.java

Lines changed: 45 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,16 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2222
package org.nhindirect.config.processor.impl;
2323

2424
import java.time.LocalDateTime;
25-
import java.util.Collection;
2625

27-
import org.apache.camel.Handler;
28-
import org.apache.commons.logging.Log;
29-
import org.apache.commons.logging.LogFactory;
3026
import org.nhindirect.config.processor.BundleCacheUpdateProcessor;
3127
import org.nhindirect.config.processor.BundleRefreshProcessor;
3228
import org.nhindirect.config.repository.TrustBundleRepository;
33-
import org.nhindirect.config.store.TrustBundle;
29+
30+
import lombok.extern.slf4j.Slf4j;
31+
import reactor.core.publisher.Mono;
3432

3533
/**
36-
* Camel based implementation of the {@linkplain BundleCacheUpdateProcessor} interface.
34+
* Default implementation of the {@linkplain BundleCacheUpdateProcessor} interface.
3735
* <p>
3836
* This implementation can be triggered on a regular interval to check if a bundle needs to be refreshed.
3937
* The implementation iterates through the entire list of configured trust bundles in the system checking
@@ -43,9 +41,9 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
4341
* @author Greg Meyer
4442
* @since 1.3
4543
*/
44+
@Slf4j
4645
public class DefaultBundleCacheUpdateProcessorImpl implements BundleCacheUpdateProcessor
4746
{
48-
private static final Log log = LogFactory.getLog(DefaultBundleCacheUpdateProcessorImpl.class);
4947

5048
/**
5149
* Trust bundle repo
@@ -87,56 +85,57 @@ public void setRefreshProcessor(BundleRefreshProcessor refreshProcessor)
8785
/**
8886
* {@inheritDoc}
8987
*/
90-
@Handler
91-
public void updateBundleCache()
88+
public Mono<Void> updateBundleCache()
9289
{
93-
Collection<TrustBundle> bundles;
9490
try
9591
{
96-
bundles = bundleRepo.findAll().collectList().block();
97-
for (TrustBundle bundle : bundles)
98-
{
99-
boolean refresh = false;
100-
101-
// if the refresh interval is 0 or less, then we won't ever auto refresh the bundle
102-
if (bundle.getRefreshInterval() <= 0)
103-
continue;
104-
105-
// see if this bundle needs to be checked for updating
106-
final LocalDateTime lastAttempt = bundle.getLastSuccessfulRefresh();
107-
108-
if (lastAttempt == null)
109-
// never been attempted successfully... better go get it
110-
refresh = true;
111-
else
92+
return bundleRepo.findAll()
93+
.flatMap(bundle ->
11294
{
113-
// check the the last attempt date against now and see if we need to refresh
114-
LocalDateTime now = LocalDateTime.now();
115-
LocalDateTime lastAttemptCheck = LocalDateTime.from(lastAttempt);
116-
lastAttemptCheck.plusSeconds(bundle.getRefreshInterval());
11795

118-
if (lastAttemptCheck.isBefore(now))
96+
// if the refresh interval is 0 or less, then we won't ever auto refresh the bundle
97+
if (bundle.getRefreshInterval() <= 0)
98+
return Mono.empty();
99+
100+
boolean refresh = false;
101+
102+
103+
// see if this bundle needs to be checked for updating
104+
final LocalDateTime lastAttempt = bundle.getLastSuccessfulRefresh();
105+
106+
if (lastAttempt == null)
107+
// never been attempted successfully... better go get it
119108
refresh = true;
120-
}
121-
122-
if (refresh)
123-
{
124-
// refresh the bundle
125-
try
109+
else
126110
{
127-
refreshProcessor.refreshBundle(bundle);
111+
// check the the last attempt date against now and see if we need to refresh
112+
LocalDateTime now = LocalDateTime.now();
113+
LocalDateTime lastAttemptCheck = LocalDateTime.from(lastAttempt);
114+
lastAttemptCheck = lastAttemptCheck.plusSeconds(bundle.getRefreshInterval());
115+
116+
if (lastAttemptCheck.isBefore(now))
117+
refresh = true;
128118
}
129-
catch (Exception e)
130-
{
131-
log.warn("Failed to check the status of bundle " + bundle.getBundleName(), e);
132-
}
133-
}
134-
}
119+
120+
final Mono<?> retVal = (refresh) ? refreshProcessor.refreshBundle(bundle) : Mono.empty();
121+
122+
return retVal
123+
.onErrorResume(e -> {
124+
log.error("Error refreshing trust bundles", e);
125+
return Mono.empty();
126+
});
127+
})
128+
.onErrorResume(e -> {
129+
log.error("Error refreshing trust bundles", e);
130+
return Mono.empty();
131+
})
132+
.then();
135133
}
136134
catch (Exception e)
137135
{
138-
log.warn("Failed to check the status of trust bundles ", e);
136+
log.error("Error retriving trust bundles", e);
137+
return Mono.empty();
139138
}
140-
139+
141140
}
142141
}

0 commit comments

Comments
 (0)