Skip to content

Commit

Permalink
[Enhancement #298] Support configuring ASCII-only identifiers.
Browse files Browse the repository at this point in the history
  • Loading branch information
ledsoft committed Sep 16, 2024
1 parent d30ec7d commit 7b7f99a
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions src/main/java/cz/cvut/kbss/termit/util/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
package cz.cvut.kbss.termit.util;

import cz.cvut.kbss.termit.model.acl.AccessLevel;
import cz.cvut.kbss.termit.util.throttle.ThrottleAspect;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Future;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import org.springframework.boot.context.properties.ConfigurationProperties;
Expand Down Expand Up @@ -61,28 +59,39 @@ public class Configuration {

/**
* The number of threads for thread pool executing asynchronous and long-running tasks.
*
* @configurationdoc.default The number of processors available to the Java virtual machine.
*/
@Min(1)
private Integer asyncThreadCount = Runtime.getRuntime().availableProcessors();

/**
* The amount of time in which calls of throttled methods
* should be merged.
* The value must be positive ({@code > 0}).
* The amount of time in which calls of throttled methods should be merged. The value must be positive
* ({@code > 0}).
*
* @configurationdoc.default 10 seconds
* @see cz.cvut.kbss.termit.util.throttle.Throttle
* @see cz.cvut.kbss.termit.util.throttle.ThrottleAspect
*/
private Duration throttleThreshold = Duration.ofSeconds(10);

/**
* After how much time, should objects with completed futures be discarded.
* The value must be positive ({@code > 0}).
* After how much time, should objects with completed futures be discarded. The value must be positive
* ({@code > 0}).
*
* @configurationdoc.default 1 minute
*/
private Duration throttleDiscardThreshold = Duration.ofMinutes(1);

/**
* Whether to generate ASCII-only identifiers.
* <p>
* By default, generated identifiers may contain accented characters (like č). Setting this configuration to
* {@code true} ensures all generated identifiers are ASCII-only and accented character are normalized to ASCII.
* @configurationdoc.default false
*/
private boolean asciiIdentifiers = false;

@Valid
private Persistence persistence = new Persistence();
@Valid
Expand Down Expand Up @@ -146,6 +155,14 @@ public void setAsyncThreadCount(@Min(1) Integer asyncThreadCount) {
this.asyncThreadCount = asyncThreadCount;
}

public boolean isAsciiIdentifiers() {
return asciiIdentifiers;
}

public void setAsciiIdentifiers(boolean asciiIdentifiers) {
this.asciiIdentifiers = asciiIdentifiers;
}

public Persistence getPersistence() {
return persistence;
}
Expand Down

0 comments on commit 7b7f99a

Please sign in to comment.