Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.1.0

* Restructured root to improve performance with IDs in entities

# 1.0.10

* Optimistic locking with @Version now possible
Expand Down
6 changes: 3 additions & 3 deletions docs/antora.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: ROOT
title: Spring-Data-Eclipse-Store
version: master
display_version: '1.0.10'
display_version: '2.0.0'
start_page: index.adoc
nav:
- modules/ROOT/nav.adoc
asciidoc:
attributes:
product-name: 'Spring-Data-Eclipse-Store'
display-version: '1.0.10'
maven-version: '1.0.10'
display-version: '2.0.0'
maven-version: '2.0.0'
page-editable: false
page-out-of-support: false
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>software.xdev</groupId>
<artifactId>spring-data-eclipse-store-root</artifactId>
<version>1.0.11-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

<organization>
Expand Down
4 changes: 2 additions & 2 deletions spring-data-eclipse-store-benchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<parent>
<groupId>software.xdev</groupId>
<artifactId>spring-data-eclipse-store-root</artifactId>
<version>1.0.11-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<artifactId>spring-data-eclipse-store-benchmark</artifactId>
<version>1.0.11-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<inceptionYear>2023</inceptionYear>
Expand Down
4 changes: 2 additions & 2 deletions spring-data-eclipse-store-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<parent>
<groupId>software.xdev</groupId>
<artifactId>spring-data-eclipse-store-root</artifactId>
<version>1.0.11-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<artifactId>spring-data-eclipse-store-demo</artifactId>
<version>1.0.11-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<organization>
Expand Down
4 changes: 2 additions & 2 deletions spring-data-eclipse-store-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<parent>
<groupId>software.xdev</groupId>
<artifactId>spring-data-eclipse-store-root</artifactId>
<version>1.0.11-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<artifactId>spring-data-eclipse-store-jpa</artifactId>
<version>1.0.11-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<inceptionYear>2023</inceptionYear>
Expand Down
18 changes: 17 additions & 1 deletion spring-data-eclipse-store/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>software.xdev</groupId>
<artifactId>spring-data-eclipse-store</artifactId>
<version>1.0.11-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>spring-data-eclipse-store</name>
Expand Down Expand Up @@ -148,6 +148,22 @@
<version>${org.eclipse.serializer.version}</version>
</dependency>

<dependency>
<groupId>software.xdev</groupId>
<artifactId>micro-migration</artifactId>
<version>2.0.0</version>
<exclusions>
<exclusion>
<artifactId>storage-embedded</artifactId>
<groupId>org.eclipse.store</groupId>
</exclusion>
<exclusion>
<artifactId>storage-embedded-configuration</artifactId>
<groupId>org.eclipse.store</groupId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

public interface EntityListProvider
{
<T> EntityProvider<T> getEntityProvider(final Class<T> clazz);
<T, ID> EntityProvider<T, ID> getEntityProvider(final Class<T> clazz);

<T> long getEntityCount(final Class<T> clazz);
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,27 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

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

public class EntityProvider<T>

@SuppressWarnings("java:S119")
public class EntityProvider<T, ID>
{
private final List<IdentitySet<? extends T>> identitySets = new ArrayList<>();
private final List<EntityData<? extends T, ID>> entityDataList = new ArrayList<>();

public void addIdentitySet(final IdentitySet<? extends T> identitySet)
public void addEntityData(final EntityData<? extends T, ID> entityData)
{
this.identitySets.add(identitySet);
this.entityDataList.add(entityData);
}

public Stream<? extends T> stream()
{
return this.identitySets.stream().flatMap(Set::stream);
return this.entityDataList.stream().map(EntityData::getEntities).flatMap(Set::stream);
}

public Collection<T> toCollection()
Expand All @@ -51,4 +55,13 @@ public long size()
{
return this.stream().count();
}

public Optional<T> findAnyEntityWithId(final ID id)
{
return (Optional<T>)this.entityDataList
.stream()
.map(entityData -> entityData.getEntitiesById().get(id))
.filter(e -> e != null)
.findAny();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright © 2024 XDEV Software (https://xdev.software)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package software.xdev.spring.data.eclipse.store.exceptions;

public class InvalidRootException extends RuntimeException
{
public InvalidRootException(final String message)
{
super(message);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
import software.xdev.spring.data.eclipse.store.repository.SupportedChecker;
import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration;
import software.xdev.spring.data.eclipse.store.repository.support.SimpleEclipseStoreRepository;
import software.xdev.spring.data.eclipse.store.repository.support.copier.id.IdManager;
import software.xdev.spring.data.eclipse.store.repository.support.copier.working.RecursiveWorkingCopier;
import software.xdev.spring.data.eclipse.store.repository.support.id.IdManager;
import software.xdev.spring.data.eclipse.store.transactions.EclipseStoreTransactionManager;


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright © 2024 XDEV Software (https://xdev.software)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package software.xdev.spring.data.eclipse.store.repository;

import java.util.TreeSet;

import org.eclipse.store.storage.embedded.types.EmbeddedStorageManager;

import software.xdev.micromigration.eclipsestore.MigrationManager;
import software.xdev.micromigration.migrater.reflection.ReflectiveMigrater;
import software.xdev.micromigration.scripts.VersionAgnosticMigrationScript;
import software.xdev.micromigration.version.MigrationVersion;
import software.xdev.spring.data.eclipse.store.repository.root.VersionedRoot;
import software.xdev.spring.data.eclipse.store.repository.root.update.scripts.v2_0_0_InitalizeVersioning;


public final class EclipseStoreMigrator
{
public static final Class<?> FIRST_UPDATE_SCRIPT = v2_0_0_InitalizeVersioning.class;

private EclipseStoreMigrator()
{
}

public static void migrate(final VersionedRoot versionedRoot, final EmbeddedStorageManager storageManager)
{
final ReflectiveMigrater migrater =
new ReflectiveMigrater(FIRST_UPDATE_SCRIPT.getPackageName());
new MigrationManager(versionedRoot, migrater, storageManager)
.migrate(versionedRoot);
}

public static MigrationVersion getLatestVersion()
{
final ReflectiveMigrater migrater =
new ReflectiveMigrater(FIRST_UPDATE_SCRIPT.getPackageName());
final TreeSet<VersionAgnosticMigrationScript<?, ?>> sortedScripts = migrater.getSortedScripts();
return sortedScripts.isEmpty() ? new MigrationVersion(0, 0, 0) : sortedScripts.last().getTargetVersion();
}
}
Loading