Skip to content

Commit 69e6651

Browse files
Merge branch 'develop' into renovate/org.springframework.boot.version
2 parents 94843e4 + 664989a commit 69e6651

File tree

69 files changed

+999
-199
lines changed

Some content is hidden

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

69 files changed

+999
-199
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.1.0
2+
3+
* Restructured root to improve performance with IDs in entities
4+
15
# 1.0.10
26

37
* Optimistic locking with @Version now possible

docs/antora.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
name: ROOT
22
title: Spring-Data-Eclipse-Store
33
version: master
4-
display_version: '1.0.10'
4+
display_version: '2.0.0'
55
start_page: index.adoc
66
nav:
77
- modules/ROOT/nav.adoc
88
asciidoc:
99
attributes:
1010
product-name: 'Spring-Data-Eclipse-Store'
11-
display-version: '1.0.10'
12-
maven-version: '1.0.10'
11+
display-version: '2.0.0'
12+
maven-version: '2.0.0'
1313
page-editable: false
1414
page-out-of-support: false

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>software.xdev</groupId>
88
<artifactId>spring-data-eclipse-store-root</artifactId>
9-
<version>1.0.11-SNAPSHOT</version>
9+
<version>2.0.0-SNAPSHOT</version>
1010
<packaging>pom</packaging>
1111

1212
<organization>

spring-data-eclipse-store-benchmark/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
<parent>
66
<groupId>software.xdev</groupId>
77
<artifactId>spring-data-eclipse-store-root</artifactId>
8-
<version>1.0.11-SNAPSHOT</version>
8+
<version>2.0.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>spring-data-eclipse-store-benchmark</artifactId>
12-
<version>1.0.11-SNAPSHOT</version>
12+
<version>2.0.0-SNAPSHOT</version>
1313
<packaging>jar</packaging>
1414

1515
<inceptionYear>2023</inceptionYear>

spring-data-eclipse-store-demo/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
<parent>
88
<groupId>software.xdev</groupId>
99
<artifactId>spring-data-eclipse-store-root</artifactId>
10-
<version>1.0.11-SNAPSHOT</version>
10+
<version>2.0.0-SNAPSHOT</version>
1111
</parent>
1212

1313
<artifactId>spring-data-eclipse-store-demo</artifactId>
14-
<version>1.0.11-SNAPSHOT</version>
14+
<version>2.0.0-SNAPSHOT</version>
1515
<packaging>jar</packaging>
1616

1717
<organization>

spring-data-eclipse-store-jpa/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
<parent>
88
<groupId>software.xdev</groupId>
99
<artifactId>spring-data-eclipse-store-root</artifactId>
10-
<version>1.0.11-SNAPSHOT</version>
10+
<version>2.0.0-SNAPSHOT</version>
1111
</parent>
1212

1313
<artifactId>spring-data-eclipse-store-jpa</artifactId>
14-
<version>1.0.11-SNAPSHOT</version>
14+
<version>2.0.0-SNAPSHOT</version>
1515
<packaging>jar</packaging>
1616

1717
<inceptionYear>2023</inceptionYear>

spring-data-eclipse-store/pom.xml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>software.xdev</groupId>
88
<artifactId>spring-data-eclipse-store</artifactId>
9-
<version>1.0.11-SNAPSHOT</version>
9+
<version>2.0.0-SNAPSHOT</version>
1010
<packaging>jar</packaging>
1111

1212
<name>spring-data-eclipse-store</name>
@@ -51,8 +51,8 @@
5151

5252
<!-- Should be in sync with org.eclipse.store:integrations-spring-boot3 -->
5353
<org.springframework.boot.version>3.3.2</org.springframework.boot.version>
54-
<org.eclipse.store.version>1.3.2</org.eclipse.store.version>
55-
<org.eclipse.serializer.version>1.3.2</org.eclipse.serializer.version>
54+
<org.eclipse.store.version>1.4.0</org.eclipse.store.version>
55+
<org.eclipse.serializer.version>1.4.0</org.eclipse.serializer.version>
5656
</properties>
5757

5858
<repositories>
@@ -148,6 +148,22 @@
148148
<version>${org.eclipse.serializer.version}</version>
149149
</dependency>
150150

151+
<dependency>
152+
<groupId>software.xdev</groupId>
153+
<artifactId>micro-migration</artifactId>
154+
<version>2.0.0</version>
155+
<exclusions>
156+
<exclusion>
157+
<artifactId>storage-embedded</artifactId>
158+
<groupId>org.eclipse.store</groupId>
159+
</exclusion>
160+
<exclusion>
161+
<artifactId>storage-embedded-configuration</artifactId>
162+
<groupId>org.eclipse.store</groupId>
163+
</exclusion>
164+
</exclusions>
165+
</dependency>
166+
151167
<dependency>
152168
<groupId>org.junit.jupiter</groupId>
153169
<artifactId>junit-jupiter-engine</artifactId>

spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/core/EntityListProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
public interface EntityListProvider
1919
{
20-
<T> EntityProvider<T> getEntityProvider(final Class<T> clazz);
20+
<T, ID> EntityProvider<T, ID> getEntityProvider(final Class<T> clazz);
2121

2222
<T> long getEntityCount(final Class<T> clazz);
2323
}

spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/core/EntityProvider.java

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,27 @@
1818
import java.util.ArrayList;
1919
import java.util.Collection;
2020
import java.util.List;
21+
import java.util.Optional;
2122
import java.util.Set;
2223
import java.util.stream.Collectors;
2324
import java.util.stream.Stream;
2425

26+
import software.xdev.spring.data.eclipse.store.repository.root.EntityData;
2527

26-
public class EntityProvider<T>
28+
29+
@SuppressWarnings("java:S119")
30+
public class EntityProvider<T, ID>
2731
{
28-
private final List<IdentitySet<? extends T>> identitySets = new ArrayList<>();
32+
private final List<EntityData<? extends T, ID>> entityDataList = new ArrayList<>();
2933

30-
public void addIdentitySet(final IdentitySet<? extends T> identitySet)
34+
public void addEntityData(final EntityData<? extends T, ID> entityData)
3135
{
32-
this.identitySets.add(identitySet);
36+
this.entityDataList.add(entityData);
3337
}
3438

3539
public Stream<? extends T> stream()
3640
{
37-
return this.identitySets.stream().flatMap(Set::stream);
41+
return this.entityDataList.stream().map(EntityData::getEntities).flatMap(Set::stream);
3842
}
3943

4044
public Collection<T> toCollection()
@@ -51,4 +55,13 @@ public long size()
5155
{
5256
return this.stream().count();
5357
}
58+
59+
public Optional<T> findAnyEntityWithId(final ID id)
60+
{
61+
return (Optional<T>)this.entityDataList
62+
.stream()
63+
.map(entityData -> entityData.getEntitiesById().get(id))
64+
.filter(e -> e != null)
65+
.findAny();
66+
}
5467
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright © 2024 XDEV Software (https://xdev.software)
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+
package software.xdev.spring.data.eclipse.store.exceptions;
17+
18+
public class InvalidRootException extends RuntimeException
19+
{
20+
public InvalidRootException(final String message)
21+
{
22+
super(message);
23+
}
24+
}

spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/importer/EclipseStoreDataImporter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
import software.xdev.spring.data.eclipse.store.repository.SupportedChecker;
3535
import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration;
3636
import software.xdev.spring.data.eclipse.store.repository.support.SimpleEclipseStoreRepository;
37-
import software.xdev.spring.data.eclipse.store.repository.support.copier.id.IdManager;
3837
import software.xdev.spring.data.eclipse.store.repository.support.copier.working.RecursiveWorkingCopier;
38+
import software.xdev.spring.data.eclipse.store.repository.support.id.IdManager;
3939
import software.xdev.spring.data.eclipse.store.transactions.EclipseStoreTransactionManager;
4040

4141

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright © 2024 XDEV Software (https://xdev.software)
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+
package software.xdev.spring.data.eclipse.store.repository;
17+
18+
import java.util.TreeSet;
19+
20+
import org.eclipse.store.storage.embedded.types.EmbeddedStorageManager;
21+
22+
import software.xdev.micromigration.eclipsestore.MigrationManager;
23+
import software.xdev.micromigration.migrater.reflection.ReflectiveMigrater;
24+
import software.xdev.micromigration.scripts.VersionAgnosticMigrationScript;
25+
import software.xdev.micromigration.version.MigrationVersion;
26+
import software.xdev.spring.data.eclipse.store.repository.root.VersionedRoot;
27+
import software.xdev.spring.data.eclipse.store.repository.root.update.scripts.v2_0_0_InitalizeVersioning;
28+
29+
30+
public final class EclipseStoreMigrator
31+
{
32+
public static final Class<?> FIRST_UPDATE_SCRIPT = v2_0_0_InitalizeVersioning.class;
33+
34+
private EclipseStoreMigrator()
35+
{
36+
}
37+
38+
public static void migrate(final VersionedRoot versionedRoot, final EmbeddedStorageManager storageManager)
39+
{
40+
final ReflectiveMigrater migrater =
41+
new ReflectiveMigrater(FIRST_UPDATE_SCRIPT.getPackageName());
42+
new MigrationManager(versionedRoot, migrater, storageManager)
43+
.migrate(versionedRoot);
44+
}
45+
46+
public static MigrationVersion getLatestVersion()
47+
{
48+
final ReflectiveMigrater migrater =
49+
new ReflectiveMigrater(FIRST_UPDATE_SCRIPT.getPackageName());
50+
final TreeSet<VersionAgnosticMigrationScript<?, ?>> sortedScripts = migrater.getSortedScripts();
51+
return sortedScripts.isEmpty() ? new MigrationVersion(0, 0, 0) : sortedScripts.last().getTargetVersion();
52+
}
53+
}

0 commit comments

Comments
 (0)