Skip to content

Commit a52dffc

Browse files
committed
Merge branch '7.13' into gh-5546-proxy-s3-forwarding
2 parents 25e4795 + abe193c commit a52dffc

114 files changed

Lines changed: 4565 additions & 758 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.

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ eventLogging = "5.0-beta.31_schema-v4.0-beta.3"
44
stroomStats = "1.0-alpha.6"
55

66
# ------------3rd-party------------
7-
aws = "2.46.7"
7+
aws = "2.46.16"
88
commons-io = "2.21.0"
9-
dropwizard = "5.0.1" # used to set the dropwizard-bom version, that controls lots of dependency versions
9+
dropwizard = "5.0.2" # used to set the dropwizard-bom version, that controls lots of dependency versions
1010
elasticsearch = "9.2.1"
1111
flyway = "12.0.0"
1212
guice = "7.0.0"
@@ -87,7 +87,7 @@ gwt-dev = { module = "org.gwtproject:gwt-dev", version.ref = "gwt" }
8787
gwt-user = { module = "org.gwtproject:gwt-user", version.ref = "gwt" }
8888
gwtp-mvp-client = { module = "com.gwtplatform:gwtp-mvp-client", version = "0.7" }
8989
#gson = { module = "com.google.code.gson:gson", version = "2.6.2" }
90-
hbase-shaded-netty = { module = "org.apache.hbase.thirdparty:hbase-shaded-netty", version = "4.1.12" } # Needed by our copied HBase classes in stroom.bytebuffer.hbase
90+
hbase-shaded-netty = { module = "org.apache.hbase.thirdparty:hbase-shaded-netty", version = "4.1.13" } # Needed by our copied HBase classes in stroom.bytebuffer.hbase
9191
hessian = { module = "com.caucho:hessian", version = "4.0.65" }
9292
hikari = { module = "com.zaxxer:HikariCP", version = "7.0.2" }
9393
http-client = { module = "org.apache.httpcomponents.client5:httpclient5" } # version controlled by dropwizard-dependencies

stroom-ai/stroom-ai-impl/src/main/java/stroom/ai/impl/ApacheHttpClient.java

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import stroom.util.http.HttpClientConfiguration;
44
import stroom.util.jersey.HttpClientProvider;
55
import stroom.util.jersey.HttpClientProviderCache;
6+
import stroom.util.logging.LambdaLogger;
7+
import stroom.util.logging.LambdaLoggerFactory;
8+
import stroom.util.logging.LogUtil;
69

710
import dev.langchain4j.http.client.HttpClient;
811
import dev.langchain4j.http.client.HttpRequest;
@@ -35,6 +38,8 @@
3538

3639
public class ApacheHttpClient implements HttpClient {
3740

41+
private static final LambdaLogger LOGGER = LambdaLoggerFactory.getLogger(ApacheHttpClient.class);
42+
3843
private final HttpClientProviderCache httpClientProviderCache;
3944
private final HttpClientConfiguration httpClientConfiguration;
4045

@@ -63,6 +68,7 @@ public void execute(final HttpRequest request,
6368
final ClassicHttpRequest apacheRequest = createApacheRequest(request);
6469
try (final HttpClientProvider httpClientProvider = httpClientProviderCache.get(httpClientConfiguration)) {
6570
final org.apache.hc.client5.http.classic.HttpClient httpClient = httpClientProvider.get();
71+
6672
if (httpClient instanceof final CloseableHttpClient closeableHttpClient) {
6773
httpClient.execute(apacheRequest, response -> {
6874
handleServerSentEvents(response, parser, listener);
@@ -126,6 +132,7 @@ private ClassicHttpRequest createApacheRequest(final HttpRequest request) {
126132
apacheRequest.addHeader(key, value)));
127133
}
128134

135+
LOGGER.debug("createApacheRequest() - method: {}, url: {}, returning: {}", method, url, apacheRequest);
129136
return apacheRequest;
130137
}
131138

@@ -135,19 +142,29 @@ private SuccessfulHttpResponse convertResponse(final ClassicHttpResponse respons
135142

136143
final Map<String, List<String>> headers = new HashMap<>();
137144
for (final Header header : response.getHeaders()) {
138-
headers.computeIfAbsent(header.getName(), k -> new ArrayList<>()).add(header.getValue());
145+
headers.computeIfAbsent(header.getName(), ignored -> new ArrayList<>())
146+
.add(header.getValue());
139147
}
140148

141149
String body = null;
142150
if (response.getEntity() != null) {
143151
body = EntityUtils.toString(response.getEntity());
144152
}
145-
146-
return SuccessfulHttpResponse.builder()
147-
.statusCode(statusCode)
148-
.headers(headers)
149-
.body(body)
150-
.build();
153+
LOGGER.debug("convertResponse() - statusCode: {}, headers: {}, body:\n{}",
154+
statusCode, headers, body);
155+
156+
try {
157+
// This will throw if statusCode is not a 2xx
158+
return SuccessfulHttpResponse.builder()
159+
.statusCode(statusCode)
160+
.headers(headers)
161+
.body(body)
162+
.build();
163+
} catch (final RuntimeException e) {
164+
throw new RuntimeException(LogUtil.message(
165+
"Unable to convert HTTP response body, statusCode: {}, headers: {}, body:\n{}",
166+
statusCode, headers, body), e);
167+
}
151168
} catch (final IOException e) {
152169
throw new UncheckedIOException(e);
153170
} catch (final ParseException e) {

stroom-analytics/stroom-analytics-impl/src/main/java/stroom/analytics/impl/SmtpConfig.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@
3131
import jakarta.validation.constraints.NotNull;
3232
import org.simplejavamail.api.mailer.config.TransportStrategy;
3333

34+
import java.util.Objects;
35+
3436
@NotInjectableConfig
3537
@JsonPropertyOrder(alphabetic = true)
3638
public class SmtpConfig extends AbstractConfig implements IsStroomConfig {
3739

3840
public static final String DEFAULT_TRANSPORT = "plain";
41+
private static final int DEFAULT_PORT = 2525;
3942

4043
@NotNull
4144
@JsonProperty("host")
@@ -64,7 +67,7 @@ public class SmtpConfig extends AbstractConfig implements IsStroomConfig {
6467

6568
public SmtpConfig() {
6669
host = "localhost";
67-
port = 2525;
70+
port = DEFAULT_PORT;
6871
transport = DEFAULT_TRANSPORT;
6972
password = null;
7073
username = null;
@@ -73,12 +76,12 @@ public SmtpConfig() {
7376
@SuppressWarnings("unused")
7477
@JsonCreator
7578
public SmtpConfig(@JsonProperty("host") final String host,
76-
@JsonProperty("port") final int port,
79+
@JsonProperty("port") final Integer port,
7780
@JsonProperty("transport") final String transport,
7881
@JsonProperty("username") final String username,
7982
@JsonProperty("password") final String password) {
8083
this.host = host;
81-
this.port = port;
84+
this.port = Objects.requireNonNullElse(port, DEFAULT_PORT);
8285
this.transport = transport;
8386
this.username = username;
8487
this.password = password;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
-- ------------------------------------------------------------------------
2+
-- Copyright 2016-2026 Crown Copyright
3+
--
4+
-- Licensed under the Apache License, Version 2.0 (the "License");
5+
-- you may not use this file except in compliance with the License.
6+
-- You may obtain a copy of the License at
7+
--
8+
-- http://www.apache.org/licenses/LICENSE-2.0
9+
--
10+
-- Unless required by applicable law or agreed to in writing, software
11+
-- distributed under the License is distributed on an "AS IS" BASIS,
12+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
-- See the License for the specific language governing permissions and
14+
-- limitations under the License.
15+
-- ------------------------------------------------------------------------
16+
17+
-- Stop NOTE level warnings about objects (not)? existing
18+
SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0;
19+
20+
ALTER TABLE annotation_link CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
21+
ALTER TABLE annotation_subscription CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
22+
ALTER TABLE annotation_tag CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
23+
ALTER TABLE annotation_tag_link CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
24+
25+
SET SQL_NOTES=@OLD_SQL_NOTES;
26+
27+
-- vim: set shiftwidth=4 tabstop=4 expandtab:

stroom-app/src/test/java/stroom/contentindex/TestLuceneContentIndex.java

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,27 @@
1616

1717
package stroom.contentindex;
1818

19+
import stroom.cluster.api.ClusterNodeManager;
20+
import stroom.cluster.lock.api.ClusterLockService;
21+
import stroom.cluster.lock.mock.MockClusterLockService;
1922
import stroom.docref.DocRef;
2023
import stroom.explorer.api.ExplorerNodeService;
2124
import stroom.explorer.shared.DocContentHighlights;
2225
import stroom.explorer.shared.DocContentMatch;
2326
import stroom.explorer.shared.FetchHighlightsRequest;
2427
import stroom.explorer.shared.FindInContentRequest;
2528
import stroom.explorer.shared.StringMatch;
29+
import stroom.node.api.NodeInfo;
2630
import stroom.pipeline.shared.XsltDoc;
2731
import stroom.pipeline.xslt.XsltStore;
2832
import stroom.security.mock.MockSecurityContext;
2933
import stroom.task.api.ExecutorProvider;
3034
import stroom.task.api.SimpleTaskContextFactory;
3135
import stroom.task.shared.ThreadPool;
3236
import stroom.test.AbstractCoreIntegrationTest;
37+
import stroom.util.io.PathCreator;
38+
import stroom.util.io.SimplePathCreator;
39+
import stroom.util.io.TempDirProvider;
3340
import stroom.util.shared.PageRequest;
3441
import stroom.util.shared.ResultPage;
3542

@@ -42,6 +49,7 @@
4249
import org.mockito.Mock;
4350
import org.mockito.junit.jupiter.MockitoExtension;
4451

52+
import java.nio.file.Path;
4553
import java.util.Set;
4654
import java.util.concurrent.Executor;
4755
import java.util.concurrent.ExecutorService;
@@ -85,14 +93,22 @@ public class TestLuceneContentIndex extends AbstractCoreIntegrationTest {
8593
private static ExecutorService executorService;
8694
private static ExecutorProvider executorProvider;
8795

96+
private final ClusterLockService clusterLockService = new MockClusterLockService();
97+
8898
@Inject
8999
private XsltStore xsltStore;
90100

91101
private XsltDoc xsltDoc;
92102
private DocRef docRef;
103+
private TempDirProvider tempDirProvider;
104+
private PathCreator pathCreator;
93105

94106
@Mock
95107
ExplorerNodeService explorerNodeService;
108+
@Mock
109+
private NodeInfo mockNodeInfo;
110+
@Mock
111+
private ClusterNodeManager mockClusterNodeManager;
96112

97113
@BeforeAll
98114
static void beforeAll() {
@@ -121,6 +137,11 @@ void setup() {
121137
docRef = xsltStore.createDocument("Test");
122138
xsltDoc = xsltStore.readDocument(docRef).copy().data(TEXT).build();
123139
xsltStore.writeDocument(xsltDoc);
140+
final Path testDir = getCurrentTestDir();
141+
tempDirProvider = () -> testDir.resolve("temp");
142+
pathCreator = new SimplePathCreator(
143+
() -> testDir.resolve("home"),
144+
tempDirProvider);
124145
}
125146

126147
@Test
@@ -167,12 +188,17 @@ void test(final StringMatch stringMatch,
167188

168189
private DocContentHighlights test(final StringMatch stringMatch) {
169190
final LuceneContentIndex contentIndex = new LuceneContentIndex(
170-
this::getCurrentTestDir,
191+
tempDirProvider,
192+
pathCreator,
193+
ContentIndexConfig::new,
171194
Set.of(xsltStore),
172195
new MockSecurityContext(),
173196
new SimpleTaskContextFactory(),
174197
explorerNodeService,
175-
executorProvider);
198+
executorProvider,
199+
clusterLockService,
200+
mockNodeInfo,
201+
mockClusterNodeManager);
176202
contentIndex.reindex();
177203
contentIndex.flush();
178204

stroom-aws/stroom-aws-s3-impl/src/main/java/stroom/aws/s3/impl/S3Manager.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,32 @@ public static CIKey removeAwsPrefix(final CIKey key) {
680680
});
681681
}
682682

683+
// private PutObjectRequest createPutObjectRequest(final String bucketName,
684+
// final String key,
685+
// final Meta meta,
686+
// final AttributeMap attributeMap,
687+
// final S3UploadProperties uploadProperties) {
688+
// final Map<String, String> metadata = attributeMap
689+
// .entrySet()
690+
// .stream()
691+
// .collect(Collectors.toMap(e -> createS3Name(e.getKey()), Entry::getValue));
692+
//
693+
// final PutObjectRequest.Builder builder = PutObjectRequest.builder()
694+
// .bucket(bucketName)
695+
// .key(key)
696+
// .tagging(createTags(meta))
697+
// .metadata(metadata);
698+
//
699+
// if (uploadProperties != null) {
700+
// NullSafe.consumeNonBlankString(uploadProperties.cacheControl(), builder::cacheControl);
701+
// NullSafe.consumeNonBlankString(uploadProperties.contentDisposition(), builder::contentDisposition);
702+
// NullSafe.consumeNonBlankString(uploadProperties.contentEncoding(), builder::contentEncoding);
703+
// NullSafe.consumeNonBlankString(uploadProperties.contentType(), builder::contentType);
704+
// }
705+
// return ciKey;
706+
// });
707+
// }
708+
683709
/**
684710
* Remove a prefix if present.
685711
*

stroom-bytebuffer/src/main/java/stroom/bytebuffer/ByteBufferPoolConfig.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,21 @@
2828
import jakarta.validation.constraints.Min;
2929

3030
import java.util.Map;
31+
import java.util.Objects;
3132
import java.util.TreeMap;
3233

3334
@JsonPropertyOrder(alphabetic = true)
3435
public class ByteBufferPoolConfig extends AbstractConfig implements IsStroomConfig {
3536

37+
private static final int DEFAULT_WARNING_THRESHOLD_PERCENTAGE = 90;
38+
private static final boolean DEFAULT_BLOCK_ON_EXHAUSTED_POOL = false;
39+
3640
private final int warningThresholdPercentage;
3741
private final Map<Integer, Integer> pooledByteBufferCounts;
3842
private final boolean blockOnExhaustedPool;
3943

4044
public ByteBufferPoolConfig() {
41-
warningThresholdPercentage = 90;
45+
warningThresholdPercentage = DEFAULT_WARNING_THRESHOLD_PERCENTAGE;
4246
// Use a treemap so we get a consistent order in the yaml so TestYamlUtil doesn't fail
4347
pooledByteBufferCounts = new TreeMap<>(Map.of(
4448
1, 50,
@@ -48,17 +52,19 @@ public ByteBufferPoolConfig() {
4852
10_000, 50,
4953
100_000, 10,
5054
1_000_000, 3));
51-
blockOnExhaustedPool = false;
55+
blockOnExhaustedPool = DEFAULT_BLOCK_ON_EXHAUSTED_POOL;
5256
}
5357

5458
@JsonCreator
5559
public ByteBufferPoolConfig(
56-
@JsonProperty("warningThresholdPercentage") final int warningThresholdPercentage,
60+
@JsonProperty("warningThresholdPercentage") final Integer warningThresholdPercentage,
5761
@JsonProperty("pooledByteBufferCounts") final Map<Integer, Integer> pooledByteBufferCounts,
58-
@JsonProperty("blockOnExhaustedPool") final boolean blockOnExhaustedPool) {
59-
this.warningThresholdPercentage = warningThresholdPercentage;
62+
@JsonProperty("blockOnExhaustedPool") final Boolean blockOnExhaustedPool) {
63+
this.warningThresholdPercentage = Objects.requireNonNullElse(warningThresholdPercentage,
64+
DEFAULT_WARNING_THRESHOLD_PERCENTAGE);
6065
this.pooledByteBufferCounts = pooledByteBufferCounts;
61-
this.blockOnExhaustedPool = blockOnExhaustedPool;
66+
this.blockOnExhaustedPool = Objects.requireNonNullElse(blockOnExhaustedPool,
67+
DEFAULT_BLOCK_ON_EXHAUSTED_POOL);
6268
}
6369

6470
@Max(100)

stroom-cluster/stroom-cluster-api/src/main/java/stroom/cluster/api/ClusterConfig.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,39 @@
2626
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
2727
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
2828

29+
import java.util.Objects;
30+
2931

3032
@JsonPropertyOrder(alphabetic = true)
3133
public class ClusterConfig extends AbstractConfig implements IsStroomConfig {
3234

35+
private static final boolean DEFAULT_CLUSTER_CALL_USE_LOCAL = true;
36+
private static final boolean DEFAULT_CLUSTER_CALL_IGNORE_SSL_HOSTNAME_VERIFIER = true;
37+
3338
private final boolean clusterCallUseLocal;
3439
private final StroomDuration clusterCallReadTimeout;
3540
private final boolean clusterCallIgnoreSSLHostnameVerifier;
3641
private final StroomDuration clusterResponseTimeout;
3742

3843
public ClusterConfig() {
39-
clusterCallUseLocal = true;
44+
clusterCallUseLocal = DEFAULT_CLUSTER_CALL_USE_LOCAL;
4045
clusterCallReadTimeout = StroomDuration.ofSeconds(30);
41-
clusterCallIgnoreSSLHostnameVerifier = true;
46+
clusterCallIgnoreSSLHostnameVerifier = DEFAULT_CLUSTER_CALL_IGNORE_SSL_HOSTNAME_VERIFIER;
4247
clusterResponseTimeout = StroomDuration.ofSeconds(30);
4348
}
4449

4550
@SuppressWarnings("unused")
4651
@JsonCreator
4752
public ClusterConfig(
48-
@JsonProperty("clusterCallUseLocal") final boolean clusterCallUseLocal,
53+
@JsonProperty("clusterCallUseLocal") final Boolean clusterCallUseLocal,
4954
@JsonProperty("clusterCallReadTimeout") final StroomDuration clusterCallReadTimeout,
50-
@JsonProperty("clusterCallIgnoreSSLHostnameVerifier") final boolean clusterCallIgnoreSSLHostnameVerifier,
55+
@JsonProperty("clusterCallIgnoreSSLHostnameVerifier") final Boolean clusterCallIgnoreSSLHostnameVerifier,
5156
@JsonProperty("clusterResponseTimeout") final StroomDuration clusterResponseTimeout) {
52-
this.clusterCallUseLocal = clusterCallUseLocal;
57+
this.clusterCallUseLocal = Objects.requireNonNullElse(clusterCallUseLocal,
58+
DEFAULT_CLUSTER_CALL_USE_LOCAL);
5359
this.clusterCallReadTimeout = clusterCallReadTimeout;
54-
this.clusterCallIgnoreSSLHostnameVerifier = clusterCallIgnoreSSLHostnameVerifier;
60+
this.clusterCallIgnoreSSLHostnameVerifier = Objects.requireNonNullElse(clusterCallIgnoreSSLHostnameVerifier,
61+
DEFAULT_CLUSTER_CALL_IGNORE_SSL_HOSTNAME_VERIFIER);
5562
this.clusterResponseTimeout = clusterResponseTimeout;
5663
}
5764

stroom-config/stroom-config-app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ dependencies {
4040
implementation project(':stroom-importexport:stroom-importexport-impl')
4141
implementation project(':stroom-index:stroom-index-impl')
4242
implementation project(':stroom-index:stroom-index-impl-db')
43+
implementation project(':stroom-index:stroom-index-lucene')
4344
implementation project(':stroom-job:stroom-job-impl')
4445
implementation project(':stroom-job:stroom-job-impl-db')
4546
implementation project(':stroom-kafka:stroom-kafka-impl')

0 commit comments

Comments
 (0)