Skip to content

Commit

Permalink
ci: finalize 3.4.0
Browse files Browse the repository at this point in the history
ci: finalize 3.4.0
  • Loading branch information
Yalz authored Sep 24, 2024
2 parents ed55c08 + e7af622 commit f089f74
Show file tree
Hide file tree
Showing 200 changed files with 2,056 additions and 2,650 deletions.
8 changes: 1 addition & 7 deletions ldes-fragmentisers/ldes-fragmentisers-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ldes-fragmentisers</artifactId>
<groupId>be.vlaanderen.informatievlaanderen.vsds</groupId>
<version>3.3.0</version>
<version>3.4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -19,12 +19,6 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>be.vlaanderen.informatievlaanderen.vsds</groupId>
<artifactId>ldes-server-retention</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Spring batch -->
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package be.vlaanderen.informatievlaanderen.ldes.server.fragmentation;

import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.Bucket;
import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.BucketisedMember;
import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.FragmentationMember;
import io.micrometer.observation.Observation;

import java.util.List;

public interface FragmentationStrategy {
List<BucketisedMember> addMemberToBucket(Bucket rootFragmentOfView, FragmentationMember member, Observation parentObservation);
void addMemberToBucket(Bucket rootBucketOfView, FragmentationMember member, Observation parentObservation);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName;
import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewSpecification;
import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.factory.FragmentationStrategyCreator;
import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.repository.BucketRepository;
import io.micrometer.observation.ObservationRegistry;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
Expand All @@ -16,16 +15,13 @@
@Component
public class FragmentationStrategyBatchCollection implements FragmentationStrategyCollection {

private final BucketRepository bucketRepository;
private final Set<FragmentationStrategyBatchExecutor> fragmentationStrategySet;
private final FragmentationStrategyCreator fragmentationStrategyCreator;
private final ObservationRegistry observationRegistry;

public FragmentationStrategyBatchCollection(
BucketRepository bucketRepository,
FragmentationStrategyCreator fragmentationStrategyCreator,
ObservationRegistry observationRegistry) {
this.bucketRepository = bucketRepository;
this.fragmentationStrategyCreator = fragmentationStrategyCreator;
this.observationRegistry = observationRegistry;
this.fragmentationStrategySet = new HashSet<>();
Expand Down Expand Up @@ -78,7 +74,6 @@ private void removeFromStrategySet(Predicate<FragmentationStrategyBatchExecutor>
private FragmentationStrategyBatchExecutor createExecutor(ViewName viewName, ViewSpecification viewSpecification) {
final FragmentationStrategy fragmentationStrategy = fragmentationStrategyCreator
.createFragmentationStrategyForView(viewSpecification);
final var rootBucketRetriever = new RootBucketRetriever(viewName, bucketRepository, observationRegistry);
return new FragmentationStrategyBatchExecutor(viewName, fragmentationStrategy, rootBucketRetriever, observationRegistry);
return new FragmentationStrategyBatchExecutor(viewName, fragmentationStrategy, observationRegistry);
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package be.vlaanderen.informatievlaanderen.ldes.server.fragmentation;

import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName;
import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.BucketisedMember;
import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.Bucket;
import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.FragmentationMember;
import io.micrometer.observation.Observation;
import io.micrometer.observation.ObservationRegistry;

import java.util.List;
import java.util.Objects;

import static io.micrometer.observation.Observation.createNotStarted;
Expand All @@ -14,26 +14,23 @@ public class FragmentationStrategyBatchExecutor {

private final FragmentationStrategy fragmentationStrategy;
private final ViewName viewName;
private final RootBucketRetriever rootBucketRetriever;
private final ObservationRegistry observationRegistry;

@SuppressWarnings("java:S107")
public FragmentationStrategyBatchExecutor(ViewName viewName,
FragmentationStrategy fragmentationStrategy,
RootBucketRetriever rootBucketRetriever,
ObservationRegistry observationRegistry) {
this.rootBucketRetriever = rootBucketRetriever;
this.observationRegistry = observationRegistry;
this.fragmentationStrategy = fragmentationStrategy;
this.viewName = viewName;
}

public List<BucketisedMember> bucketise(FragmentationMember member) {
var parentObservation = createNotStarted("execute fragmentation", observationRegistry).start();
final var rootBucket = rootBucketRetriever.retrieveRootBucket(parentObservation);
List<BucketisedMember> bucketisedMembers = fragmentationStrategy.addMemberToBucket(rootBucket, member, parentObservation);
public Bucket bucketise(FragmentationMember member) {
final Observation parentObservation = createNotStarted("execute fragmentation", observationRegistry).start();
final Bucket rootBucket = Bucket.createRootBucketForView(viewName);
fragmentationStrategy.addMemberToBucket(rootBucket, member, parentObservation);
parentObservation.stop();
return bucketisedMembers;
return rootBucket;
}

public boolean isPartOfCollection(String collectionName) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,19 @@
package be.vlaanderen.informatievlaanderen.ldes.server.fragmentation;

import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.Bucket;
import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.BucketisedMember;
import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.FragmentationMember;
import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.valueobjects.BucketRelation;
import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.valueobjects.BucketRelationCreatedEvent;
import io.micrometer.observation.Observation;
import org.springframework.context.ApplicationEventPublisher;

import java.util.List;

public abstract class FragmentationStrategyDecorator implements FragmentationStrategy {

private final FragmentationStrategy fragmentationStrategy;

private final ApplicationEventPublisher applicationEventPublisher;

protected FragmentationStrategyDecorator(FragmentationStrategy fragmentationStrategy,
ApplicationEventPublisher applicationEventPublisher) {
protected FragmentationStrategyDecorator(FragmentationStrategy fragmentationStrategy) {
this.fragmentationStrategy = fragmentationStrategy;
this.applicationEventPublisher = applicationEventPublisher;
}

@Override
public List<BucketisedMember> addMemberToBucket(Bucket rootFragmentOfView, FragmentationMember member, Observation parentObservation) {
return fragmentationStrategy.addMemberToBucket(rootFragmentOfView, member, parentObservation);
}

protected void addRelationFromParentToChild(Bucket parentBucket, Bucket childBucket) {
BucketRelation bucketRelation = BucketRelation.createGenericRelation(parentBucket, childBucket);
applicationEventPublisher.publishEvent(new BucketRelationCreatedEvent(bucketRelation));
public void addMemberToBucket(Bucket parentBucket, FragmentationMember member, Observation parentObservation) {
fragmentationStrategy.addMemberToBucket(parentBucket, member, parentObservation);
}

}
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package be.vlaanderen.informatievlaanderen.ldes.server.fragmentation;

import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.Bucket;
import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.BucketisedMember;
import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.FragmentationMember;
import io.micrometer.observation.Observation;

import java.util.List;

public class FragmentationStrategyImpl implements FragmentationStrategy {
@Override
public List<BucketisedMember> addMemberToBucket(Bucket bucket, FragmentationMember member, Observation parentObservation) {
return List.of(new BucketisedMember(bucket.getBucketId(), member.getMemberId()));
public void addMemberToBucket(Bucket rootBucketOfView, FragmentationMember member, Observation parentObservation) {
rootBucketOfView.assignMember(member.getMemberId());
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
package be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.batch;

import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.BucketisedMember;
import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.Bucket;
import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.FragmentationMember;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.step.builder.StepBuilder;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemWriter;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.SimpleAsyncTaskExecutor;
import org.springframework.core.task.TaskExecutor;
import org.springframework.transaction.PlatformTransactionManager;

import java.util.List;

@Configuration
public class BucketJobDefinitions {
public static final String BUCKETISATION_STEP = "bucketisation";
Expand All @@ -26,23 +21,16 @@ public class BucketJobDefinitions {
public Step bucketiseMembersStep(JobRepository jobRepository,
PlatformTransactionManager transactionManager,
ItemReader<FragmentationMember> memberReader,
ItemProcessor<FragmentationMember, List<BucketisedMember>> viewBucketProcessor,
ItemWriter<List<BucketisedMember>> writer,
BucketMetricUpdater bucketMetricUpdater,
@Qualifier("bucketTaskExecutor") TaskExecutor taskExecutor) {
ItemProcessor<FragmentationMember, Bucket> bucketProcessor,
ItemWriter<Bucket> bucketisationItemWriter,
BucketMetricUpdater bucketMetricUpdater) {
return new StepBuilder(BUCKETISATION_STEP, jobRepository)
.<FragmentationMember, List<BucketisedMember>>chunk(CHUNK_SIZE, transactionManager)
.<FragmentationMember, Bucket>chunk(CHUNK_SIZE, transactionManager)
.reader(memberReader)
.processor(viewBucketProcessor)
.writer(writer)
.processor(bucketProcessor)
.writer(bucketisationItemWriter)
.listener(bucketMetricUpdater)
.build();
}

@Bean("bucketTaskExecutor")
public TaskExecutor paginationTaskExecutor() {
var taskExecutor = new SimpleAsyncTaskExecutor("spring_batch");
taskExecutor.setConcurrencyLimit(1);
return taskExecutor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,19 @@

import be.vlaanderen.informatievlaanderen.ldes.server.domain.model.ViewName;
import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.FragmentationStrategyCollection;
import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.BucketisedMember;
import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.Bucket;
import be.vlaanderen.informatievlaanderen.ldes.server.fragmentation.entities.FragmentationMember;
import org.springframework.batch.core.configuration.annotation.StepScope;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

@Configuration
public class BucketProcessors {
@Bean
@StepScope
public ItemProcessor<FragmentationMember, List<BucketisedMember>> viewBucketProcessor(
public ItemProcessor<FragmentationMember, Bucket> bucketProcessor(
FragmentationStrategyCollection fragmentationStrategyCollection,
@Value("#{jobParameters['collectionName']}") String collectionName,
@Value("#{jobParameters['viewName']}") String viewName
Expand Down
Loading

0 comments on commit f089f74

Please sign in to comment.