Skip to content

Commit

Permalink
Merge branch 'main' into refactoring/4843-Promote-sidebar-curation-mo…
Browse files Browse the repository at this point in the history
…de-to-proper-curation-page

* main: (24 commits)
  #4919 - Unable to import project with knowledge-based exported by INCEpTION 33.0 (again)
  #4921 - Constraints do not work properly when rules are distributed over multiple rulesets
  #4915 - Support for MySQL 8
  #4051 - Postgres support
  #3407 - Remove old database migrations that seem to get always executed
  #3407 - Remove old database migrations that seem to get always executed
  #4909 - Upgrade dependencies
  #4911 - No results when searching as curator after re-indexing project
  #4909 - Upgrade dependencies
  [maven-release-plugin] prepare for next development iteration
  [maven-release-plugin] prepare release inception-33.1
  #4901 - Consider document structure when splitting sentences in custom XML formats
  #4880 - Upgrade dependencies
  #4898 - Unable to import project with knowledge-based exported by INCEpTION 33.0
  #4896 - Ability to search for additional languages in knowledge-base
  No issue: Trim LLM responses
  #4892 - Curation sidebar state not cleared when logging out
  #4891 - Exception in sidebar curation mode when document-level annotations exist
  #4727 - Switching between editors can cause the old and the new editors to be loaded and initialized
  #4889 - Document sometimes not rendered in by-line brat render modes
  ...

% Conflicts:
%	inception/inception-ui-annotation/src/main/java/de/tudarmstadt/ukp/clarin/webanno/ui/annotation/AnnotationPage.java
  • Loading branch information
reckart committed Jul 3, 2024
2 parents 44731d9 + 6390a40 commit eb1427a
Show file tree
Hide file tree
Showing 122 changed files with 19,071 additions and 7,565 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ private Unit toUnit(int aIndex, AnnotationFS aSentence)
@Override
public Component createPositionLabel(String aId, IModel<AnnotatorState> aModel)
{
Label label = new Label(aId, () -> {
AnnotatorState state = aModel.getObject();
var label = new Label(aId, () -> {
var state = aModel.getObject();
return String.format("%d-%d / %d sentences [doc %d / %d]",
state.getFirstVisibleUnitIndex(), state.getLastVisibleUnitIndex(),
state.getUnitCount(), state.getDocumentIndex() + 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public List<Unit> units(CAS aCas, int aFirstIndex, int aLastIndex)
{
Iterator<AnnotationFS> tokenIterator = WebAnnoCasUtil.selectTokens(aCas).iterator();

List<Unit> units = new ArrayList<>();
var units = new ArrayList<Unit>();

int currentUnitStart = 0;
int currentUnitEnd = 0;
Expand All @@ -65,7 +65,7 @@ public List<Unit> units(CAS aCas, int aFirstIndex, int aLastIndex)
currentToken.getBegin(), currentToken.getEnd(), currentUnitEnd));
}

String gap = aCas.getDocumentText().substring(currentUnitEnd, currentToken.getBegin());
var gap = aCas.getDocumentText().substring(currentUnitEnd, currentToken.getBegin());
int gapStart = currentUnitEnd;
int lineBreakIndex = gap.indexOf("\n");
while (lineBreakIndex > -1) {
Expand All @@ -75,8 +75,8 @@ public List<Unit> units(CAS aCas, int aFirstIndex, int aLastIndex)
lineBreakIndex = gap.indexOf("\n", lineBreakIndex + 1);
}

boolean unitNonEmpty = (currentUnitEnd - currentUnitStart) > 0;
boolean unitFull = unitNonEmpty
var unitNonEmpty = (currentUnitEnd - currentUnitStart) > 0;
var unitFull = unitNonEmpty
&& ((currentToken.getEnd() - currentUnitStart) > maxLineLength);

// If the unit is full, finish the unit and start a new one
Expand Down
58 changes: 47 additions & 11 deletions inception/inception-app-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
</dependency>

<!-- INCEPTION - CORE DEPENDENCIES -->
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-model</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-documents</artifactId>
Expand Down Expand Up @@ -64,10 +68,6 @@
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-ui-scheduling</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-project</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-doc</artifactId>
Expand Down Expand Up @@ -112,6 +112,10 @@
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-processing</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-project-api</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-project-initializers</artifactId>
Expand Down Expand Up @@ -531,10 +535,6 @@
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
Expand Down Expand Up @@ -570,6 +570,11 @@
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
<dependency>
<groupId>com.mattbertolini</groupId>
<artifactId>liquibase-slf4j</artifactId>
<version>5.0.0</version>
</dependency>

<dependency>
<groupId>org.hibernate.orm</groupId>
Expand Down Expand Up @@ -686,6 +691,31 @@
<artifactId>mock-oauth2-server</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mariadb</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mysql</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down Expand Up @@ -909,12 +939,17 @@
<ignoredUsedUndeclaredDependencies>
<ignoredUsedUndeclaredDependency>org.apache.tomcat.embed:tomcat-embed-core</ignoredUsedUndeclaredDependency>
</ignoredUsedUndeclaredDependencies>
<ignoredNonTestScopedDependencies>
<dependency>de.tudarmstadt.ukp.inception.app:inception-model</dependency>
<dependency>de.tudarmstadt.ukp.inception.app:inception-project</dependency>
<dependency>de.tudarmstadt.ukp.inception.app:inception-project-api</dependency>
<dependency>de.tudarmstadt.ukp.inception.app:inception-project-initializers</dependency>
</ignoredNonTestScopedDependencies>
<usedDependencies>
<!-- INCEpTION backend modules - used via Spring -->
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-guidelines</usedDependency>
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-documents</usedDependency>
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-image</usedDependency>
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-project</usedDependency>
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-plugin-manager</usedDependency>
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-concept-linking</usedDependency>
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-recommendation</usedDependency>
Expand Down Expand Up @@ -955,7 +990,6 @@
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-layer-docmetadata</usedDependency>
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-feature-lookup</usedDependency>
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-processing</usedDependency>
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-project-initializers</usedDependency>
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-project-initializers-basic</usedDependency>
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-project-initializers-doclabeling</usedDependency>
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-project-initializers-sentencelabeling</usedDependency>
Expand Down Expand Up @@ -993,10 +1027,12 @@
<usedDependency>de.tudarmstadt.ukp.inception.app:inception-telemetry</usedDependency>
<!-- JDBC drivers and database stuff - used via reflection -->
<usedDependency>org.hibernate.orm:hibernate-core</usedDependency>
<usedDependency>org.hsqldb:hsqldb</usedDependency>
<usedDependency>org.mariadb.jdbc:mariadb-java-client</usedDependency>
<usedDependency>mysql:mysql-connector-java</usedDependency>
<usedDependency>org.postgresql:postgresql</usedDependency>
<usedDependency>org.hsqldb:hsqldb</usedDependency>
<!-- Logging - used via reflection / optional -->
<usedDependency>com.mattbertolini:liquibase-slf4j</usedDependency>
<usedDependency>org.slf4j:log4j-over-slf4j</usedDependency>
<usedDependency>org.apache.logging.log4j:log4j-slf4j2-impl</usedDependency>
<usedDependency>org.apache.logging.log4j:log4j-core</usedDependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,24 @@
package de.tudarmstadt.ukp.inception.app.config;

import static de.tudarmstadt.ukp.inception.support.SettingsUtil.CFG_AUTH_MODE;
import static de.tudarmstadt.ukp.inception.support.deployment.DeploymentModeService.PROFILE_AUTH_MODE_DATABASE;
import static de.tudarmstadt.ukp.inception.support.deployment.DeploymentModeService.PROFILE_AUTH_MODE_EXTERNAL_PREAUTH;
import static de.tudarmstadt.ukp.inception.support.logging.BaseLoggers.BOOT_LOG;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;

import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.MapPropertySource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.support.ResourcePropertySource;
import org.springframework.util.unit.DataSize;

import de.tudarmstadt.ukp.inception.support.SettingsUtil;
import de.tudarmstadt.ukp.inception.support.deployment.DeploymentModeService;
import de.tudarmstadt.ukp.inception.support.db.InceptionHSQLDialect;
import de.tudarmstadt.ukp.inception.support.db.InceptionMySQLDialect;
import de.tudarmstadt.ukp.inception.support.logging.BaseLoggers;
import de.tudarmstadt.ukp.inception.support.logging.LoggingFilter;

Expand All @@ -45,9 +49,22 @@ public void initialize(ConfigurableApplicationContext aApplicationContext)
{
LoggingFilter.setLoggingUsername("SYSTEM");

ConfigurableEnvironment aEnvironment = aApplicationContext.getEnvironment();
var aEnvironment = aApplicationContext.getEnvironment();

File settings = SettingsUtil.getSettingsFileLocation();
loadSettings(aEnvironment);

applyDatabaseSpecificOverrides(aEnvironment);

activateAuthenticationProfiles(aEnvironment);

Runtime rt = Runtime.getRuntime();
BOOT_LOG.info("Max. application memory: {}MB",
DataSize.ofBytes(rt.maxMemory()).toMegabytes());
}

private void loadSettings(ConfigurableEnvironment aEnvironment)
{
var settings = SettingsUtil.getSettingsFileLocation();

BaseLoggers.BOOT_LOG.info("Settings: {} {}", settings,
settings.exists() ? "(file exists)" : "(file does not exist)");
Expand All @@ -62,19 +79,56 @@ public void initialize(ConfigurableApplicationContext aApplicationContext)
throw new IllegalStateException(e);
}
}
}

private void applyDatabaseSpecificOverrides(ConfigurableEnvironment aEnvironment)
{
var datasourceUrl = aEnvironment.getProperty("spring.datasource.url");
if (datasourceUrl == null) {
return;
}

if (datasourceUrl.startsWith("jdbc:hsqldb:")) {
var overrides = new HashMap<String, Object>();
overrides.put("spring.jpa.properties.hibernate.dialect",
InceptionHSQLDialect.class.getName());
// Existing HSQLDBs will have all-caps table and column names - if we quote, it will
// break loading these.
overrides.put("spring.jpa.properties.hibernate.globally_quoted_identifiers", false);
aEnvironment.getPropertySources()
.addFirst(new MapPropertySource("HSQLDB-Overrides", overrides));
}

if (datasourceUrl.startsWith("jdbc:postgresql:")) {
var overrides = new HashMap<String, Object>();
// PostgreSQL does not like unquoted mixed-case columns - but we have those, e.g.
// the `curationSettings_users` table.
overrides.put("spring.jpa.properties.hibernate.globally_quoted_identifiers", true);
aEnvironment.getPropertySources()
.addFirst(new MapPropertySource("PostgreSQL-Overrides", overrides));
}

if (datasourceUrl.startsWith("jdbc:mysql:")) {
var overrides = new HashMap<String, Object>();
// We use certain column names like `rank` that are reserved words in MySQL
overrides.put("spring.jpa.properties.hibernate.globally_quoted_identifiers", true);
overrides.put("spring.jpa.properties.hibernate.dialect",
InceptionMySQLDialect.class.getName());
aEnvironment.getPropertySources()
.addFirst(new MapPropertySource("MySQL-Overrides", overrides));
}
}

private void activateAuthenticationProfiles(ConfigurableEnvironment aEnvironment)
{
// Activate bean profile depending on authentication mode
if (AUTH_MODE_PREAUTH.equals(aEnvironment.getProperty(CFG_AUTH_MODE))) {
aEnvironment.addActiveProfile(DeploymentModeService.PROFILE_AUTH_MODE_EXTERNAL_PREAUTH);
aEnvironment.addActiveProfile(PROFILE_AUTH_MODE_EXTERNAL_PREAUTH);
BOOT_LOG.info("Authentication: pre-auth");
}
else {
aEnvironment.addActiveProfile(DeploymentModeService.PROFILE_AUTH_MODE_DATABASE);
aEnvironment.addActiveProfile(PROFILE_AUTH_MODE_DATABASE);
BOOT_LOG.info("Authentication: database");
}

Runtime rt = Runtime.getRuntime();
BOOT_LOG.info("Max. application memory: {}MB",
DataSize.ofBytes(rt.maxMemory()).toMegabytes());
}
}

This file was deleted.

Loading

0 comments on commit eb1427a

Please sign in to comment.