Skip to content

Commit a35c229

Browse files
committed
feat: add spring-data v3.5 module
1 parent 881f8ab commit a35c229

File tree

97 files changed

+10113
-17
lines changed

Some content is hidden

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

97 files changed

+10113
-17
lines changed

CONTRIBUTE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ tarantool-java-sdk (parent POM)
8282
├── tarantool-spring-data-core
8383
├── tarantool-spring-data-27
8484
├── ...
85-
├── tarantool-spring-data-34
85+
├── tarantool-spring-data-35
8686
├── testcontainers
8787
└── jacoco-coverage-aggregate-report
8888
```

documentation/docs/documentation/spring-data/index.en.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ using [Tarantool](https://www.tarantool.io) as a data store.
2323

2424
## Project Status
2525

26-
| tarantool-java-sdk Version | tarantool-spring-data Version | Spring Boot Version |
27-
|:-------------------------:|:----------------------------:|:-----------------------------------------:|
28-
| 1.5.x | 1.5.x | 2.7.18 / 3.1.10 / 3.2.4 / 3.3.13 / 3.4.10 |
26+
| tarantool-java-sdk Version | tarantool-spring-data Version | Spring Boot Version |
27+
|:-------------------------:|:----------------------------:|:-------------------------------------------------:|
28+
| 1.5.x | 1.5.x | 2.7.18 / 3.1.10 / 3.2.4 / 3.3.13 / 3.4.10 / 3.5.7 |
2929

3030
### Tarantool Version and Supported Client Modules
3131

@@ -88,7 +88,7 @@ Include the module in your project as follows:
8888
</dependency>
8989
<dependency>
9090
<groupId>io.tarantool</groupId>
91-
<artifactId>tarantool-spring-data-34</artifactId>
91+
<artifactId>tarantool-spring-data-35</artifactId>
9292
<version>${tarantool-spring-data.version}</version>
9393
</dependency>
9494
</dependencies>

documentation/docs/documentation/spring-data/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ hide:
2323

2424
## Статус проекта
2525

26-
| Версия tarantool-java-sdk | Версия tarantool-spring-data | Версия Spring Boot |
27-
|:-------------------------:|:----------------------------:|:-----------------------------------------:|
28-
| 1.5.x | 1.5.x | 2.7.18 / 3.1.10 / 3.2.4 / 3.3.13 / 3.4.10 |
26+
| Версия tarantool-java-sdk | Версия tarantool-spring-data | Версия Spring Boot |
27+
|:-------------------------:|:----------------------------:|:-------------------------------------------------:|
28+
| 1.5.x | 1.5.x | 2.7.18 / 3.1.10 / 3.2.4 / 3.3.13 / 3.4.10 / 3.5.7 |
2929

3030
### Версия Tarantool и поддерживаемые модули-клиенты
3131

@@ -84,11 +84,11 @@ Tarantool можно найти
8484
<dependency>
8585
<groupId>org.springframework.boot</groupId>
8686
<artifactId>spring-boot-starter</artifactId>
87-
<version>3.4.12</version>
87+
<version>3.5.7</version>
8888
</dependency>
8989
<dependency>
9090
<groupId>io.tarantool</groupId>
91-
<artifactId>tarantool-spring-data-34</artifactId>
91+
<artifactId>tarantool-spring-data-35</artifactId>
9292
<version>${tarantool-spring-data.version}</version>
9393
</dependency>
9494
</dependencies>

tarantool-spring-data/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ data storage.
2020

2121
## Project Status
2222

23-
| tarantool-java-sdk Version | tarantool-spring-data Version | Spring Boot Version |
24-
|:--------------------------:|:-----------------------------:|:------------------------------------------:|
25-
| 1.0.0 | 1.0.0 | 2.7.18 |
26-
| 1.1.x | 1.1.x | 2.7.18 / 3.1.10 / 3.2.4 |
27-
| 1.2.x | 1.2.x | 2.7.18 / 3.1.10 / 3.2.4 |
28-
| 1.3.x | 1.3.x | 2.7.18 / 3.1.10 / 3.2.4 / 3.3.11 / 3.4.5 |
29-
| 1.4.x | 1.4.x | 2.7.18 / 3.1.10 / 3.2.4 / 3.3.13 / 3.4.10 |
23+
| tarantool-java-sdk Version | tarantool-spring-data Version | Spring Boot Version |
24+
|:--------------------------:|:-----------------------------:|:-------------------------------------------------:|
25+
| 1.0.0 | 1.0.0 | 2.7.18 |
26+
| 1.1.x | 1.1.x | 2.7.18 / 3.1.10 / 3.2.4 |
27+
| 1.2.x | 1.2.x | 2.7.18 / 3.1.10 / 3.2.4 |
28+
| 1.3.x | 1.3.x | 2.7.18 / 3.1.10 / 3.2.4 / 3.3.11 / 3.4.5 |
29+
| 1.4.x | 1.4.x | 2.7.18 / 3.1.10 / 3.2.4 / 3.3.13 / 3.4.10 |
30+
| 1.5.x | 1.5.x | 2.7.18 / 3.1.10 / 3.2.4 / 3.3.13 / 3.4.10 / 3.5.7 |
3031

3132
### Tarantool Version and Supported Client Modules
3233

tarantool-spring-data/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<module>tarantool-spring-data-32</module>
2424
<module>tarantool-spring-data-33</module>
2525
<module>tarantool-spring-data-34</module>
26+
<module>tarantool-spring-data-35</module>
2627
</modules>
2728

2829
<properties>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<name>tarantool-spring-data-35</name>
6+
<description>Minimalistic java connector for Tarantool versions 2.11+ based on Netty framework</description>
7+
<url>https://tarantool.io</url>
8+
9+
<parent>
10+
<groupId>io.tarantool</groupId>
11+
<artifactId>tarantool-spring-data</artifactId>
12+
<version>2.0.0-SNAPSHOT</version>
13+
</parent>
14+
15+
<artifactId>tarantool-spring-data-35</artifactId>
16+
<version>2.0.0-SNAPSHOT</version>
17+
<packaging>jar</packaging>
18+
19+
<properties>
20+
<maven.compiler.source>17</maven.compiler.source>
21+
<maven.compiler.target>17</maven.compiler.target>
22+
<spring.boot.version>3.5.7</spring.boot.version>
23+
<shared.dir>${project.parent.parent.basedir}/tarantool-shared-resources/</shared.dir>
24+
<license.header.file>${project.parent.parent.basedir}/LICENSE_HEADER.txt</license.header.file>
25+
</properties>
26+
27+
<dependencyManagement>
28+
<dependencies>
29+
<dependency>
30+
<groupId>org.springframework.boot</groupId>
31+
<artifactId>spring-boot-dependencies</artifactId>
32+
<version>${spring.boot.version}</version>
33+
<type>pom</type>
34+
<scope>import</scope>
35+
</dependency>
36+
</dependencies>
37+
</dependencyManagement>
38+
39+
<dependencies>
40+
<dependency>
41+
<groupId>io.tarantool</groupId>
42+
<artifactId>tarantool-spring-data-core</artifactId>
43+
</dependency>
44+
</dependencies>
45+
</project>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
* Copyright (c) 2025 VK DIGITAL TECHNOLOGIES LIMITED LIABILITY COMPANY
3+
* All Rights Reserved.
4+
*/
5+
6+
package io.tarantool.spring.data35;
7+
8+
import java.util.Map;
9+
10+
import org.springframework.data.keyvalue.core.AbstractKeyValueAdapter;
11+
import org.springframework.data.util.CloseableIterator;
12+
import org.springframework.lang.NonNull;
13+
14+
import io.tarantool.client.box.TarantoolBoxClient;
15+
import io.tarantool.spring.data.ProxyTarantoolBoxKeyValueAdapter;
16+
17+
public class TarantoolBoxKeyValueAdapter extends AbstractKeyValueAdapter {
18+
19+
private final ProxyTarantoolBoxKeyValueAdapter adapter;
20+
21+
public TarantoolBoxKeyValueAdapter(@NonNull TarantoolBoxClient tarantoolBoxClient) {
22+
adapter = new ProxyTarantoolBoxKeyValueAdapter(tarantoolBoxClient);
23+
}
24+
25+
@Override
26+
public Object put(Object id, Object item, String keyspace) {
27+
return adapter.put(id, item, keyspace);
28+
}
29+
30+
@Override
31+
public boolean contains(Object id, String keyspace) {
32+
return adapter.contains(id, keyspace);
33+
}
34+
35+
@Override
36+
public Object get(Object id, String keyspace) {
37+
return adapter.get(id, keyspace);
38+
}
39+
40+
@Override
41+
public Object delete(Object id, String keyspace) {
42+
return adapter.delete(id, keyspace);
43+
}
44+
45+
@Override
46+
public Iterable<?> getAllOf(String keyspace) {
47+
return adapter.getAllOf(keyspace);
48+
}
49+
50+
@Override
51+
public void deleteAllOf(String keyspace) {
52+
adapter.deleteAllOf(keyspace);
53+
}
54+
55+
@Override
56+
public void clear() {
57+
adapter.clear();
58+
}
59+
60+
@Override
61+
public long count(String keyspace) {
62+
return adapter.count(keyspace);
63+
}
64+
65+
@Override
66+
public void destroy() throws Exception {
67+
adapter.destroy();
68+
}
69+
70+
@Override
71+
public CloseableIterator<Map.Entry<Object, Object>> entries(String keyspace) {
72+
throw new UnsupportedOperationException("Not implemented yet");
73+
}
74+
}
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
/*
2+
* Copyright (c) 2025 VK DIGITAL TECHNOLOGIES LIMITED LIABILITY COMPANY
3+
* All Rights Reserved.
4+
*/
5+
6+
package io.tarantool.spring.data35;
7+
8+
import java.util.Collections;
9+
import java.util.Map.Entry;
10+
11+
import com.fasterxml.jackson.annotation.JsonFormat;
12+
import org.springframework.core.annotation.AnnotatedElementUtils;
13+
import org.springframework.data.keyvalue.core.AbstractKeyValueAdapter;
14+
import org.springframework.data.util.CloseableIterator;
15+
import org.springframework.lang.NonNull;
16+
17+
import io.tarantool.client.crud.TarantoolCrudClient;
18+
import io.tarantool.spring.data.ProxyTarantoolCrudKeyValueAdapter;
19+
import io.tarantool.spring.data.mapping.model.CompositeKey;
20+
21+
public class TarantoolCrudKeyValueAdapter extends AbstractKeyValueAdapter {
22+
23+
private final ProxyTarantoolCrudKeyValueAdapter adapter;
24+
25+
public TarantoolCrudKeyValueAdapter(@NonNull TarantoolCrudClient client) {
26+
super(new TarantoolQueryEngine(client));
27+
this.adapter = new ProxyTarantoolCrudKeyValueAdapter(client);
28+
}
29+
30+
@Override
31+
public Object put(Object id, Object item, String keyspace) {
32+
return adapter.put(convertId(id), item, keyspace);
33+
}
34+
35+
@Override
36+
public boolean contains(Object id, String keyspace) {
37+
return adapter.contains(convertId(id), keyspace);
38+
}
39+
40+
@Override
41+
public Object get(Object id, String keyspace) {
42+
return adapter.get(convertId(id), keyspace);
43+
}
44+
45+
@Override
46+
public <T> T get(Object id, String keyspace, Class<T> type) {
47+
return adapter.get(convertId(id), keyspace, type);
48+
}
49+
50+
@Override
51+
public Object delete(Object id, String keyspace) {
52+
return adapter.delete(convertId(id), keyspace);
53+
}
54+
55+
@Override
56+
public <T> T delete(Object id, String keyspace, Class<T> type) {
57+
return adapter.delete(convertId(id), keyspace, type);
58+
}
59+
60+
@Override
61+
public Iterable<?> getAllOf(String keyspace) {
62+
return adapter.getAllOf(keyspace);
63+
}
64+
65+
@Override
66+
public void deleteAllOf(String keyspace) {
67+
adapter.deleteAllOf(keyspace);
68+
}
69+
70+
@Override
71+
public void clear() {
72+
adapter.clear();
73+
}
74+
75+
@Override
76+
public void destroy() throws Exception {
77+
adapter.destroy();
78+
}
79+
80+
@Override
81+
public long count(String keyspace) {
82+
return adapter.count(keyspace);
83+
}
84+
85+
@Override
86+
public CloseableIterator<Entry<Object, Object>> entries(String keyspace) {
87+
throw new UnsupportedOperationException("Not implemented yet");
88+
}
89+
90+
/**
91+
* Convert the identifier to the form required by the tarantool-java-sdk driver.
92+
*
93+
* @param id identifier object
94+
* @return identifier in the required form
95+
*/
96+
private Object convertId(Object id) {
97+
if (id instanceof CompositeKey || hasJsonFormatArrayAnnotation(id)) {
98+
return id;
99+
}
100+
return Collections.singletonList(id);
101+
}
102+
103+
/**
104+
* Determine whether the identifier type is annotated with the {@link JsonFormat} annotation.
105+
*
106+
* @param id identifier object
107+
* @return return true if the annotation is present, false otherwise
108+
*/
109+
private boolean hasJsonFormatArrayAnnotation(Object id) {
110+
final JsonFormat jsonFormatAnnotation =
111+
AnnotatedElementUtils.findMergedAnnotation(id.getClass(), JsonFormat.class);
112+
113+
return jsonFormatAnnotation != null
114+
&& JsonFormat.Shape.ARRAY.equals(jsonFormatAnnotation.shape());
115+
}
116+
}

0 commit comments

Comments
 (0)