Skip to content

Commit

Permalink
[#80] Rename driver property to persistenceDriver
Browse files Browse the repository at this point in the history
  • Loading branch information
palagdan committed Nov 29, 2024
1 parent 77dccf5 commit bb3f890
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 23 deletions.
2 changes: 1 addition & 1 deletion doc/configuration.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
| Variable | Description |
| --- | --- |
| ```APPCONTEXT``` | Public URL of the frontend of record-manager application that is used for password reset emails. e.g. https://study.example.com/record-manager/ (must have "/" at the end) |
| ```DRIVER``` | Driver to manage triple stores |
| ```EMAIL_BCC``` | Email addresses to be blind carbon-copied, separated by a comma (optional, can be empty). |
| ```EMAIL_CC``` | Email addresses to be carbon-copied, separated by a comma (optional, can be empty). |
| ```EMAIL_DISPLAYNAME``` | Email display name |
Expand All @@ -17,6 +16,7 @@
| ```EMAIL_REPLYTO``` | Email cc addresses where all invitations will be sent. For more use delimiter "," (can remain empty) |
| ```FORMGENREPOSITORYURL``` | URL of repository where output and configuration of form-generator should be held |
| ```FORMGENSERVICEURL``` | REST endpoint of form generator service |
| ```PERSISTENCEDRIVER``` | Persistence driver to manage triple stores |
| ```RECORDS_ALLOWEDREJECTREASON``` | it indicates functionality allowing users to specify a reason for rejection is enabled. |
| ```REPOSITORYURL``` | URL of repository that holds main data of the application |
| ```SECURITY_CORD_ALLOWEDORIGINS``` | Configures allowed origins for CORS (e.g. http://localhost:3000). Use a comma to separate multiple values |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import jakarta.annotation.PreDestroy;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;

import java.util.HashMap;
Expand All @@ -15,7 +14,7 @@
import static cz.cvut.kbss.jopa.model.JOPAPersistenceProperties.CACHE_ENABLED;
import static cz.cvut.kbss.jopa.model.JOPAPersistenceProperties.DATA_SOURCE_CLASS;
import static cz.cvut.kbss.jopa.model.JOPAPersistenceProperties.ONTOLOGY_PHYSICAL_URI_KEY;
import static cz.cvut.kbss.study.util.ConfigParam.DRIVER;
import static cz.cvut.kbss.study.util.ConfigParam.PERSISTENCE_DRIVER;
import static cz.cvut.kbss.study.util.ConfigParam.FORM_GEN_REPOSITORY_URL;

@Configuration
Expand All @@ -38,7 +37,7 @@ public EntityManagerFactory getEntityManagerFactory() {
private void init() {
final Map<String, String> properties = new HashMap<>(PersistenceFactory.getDefaultParams());
properties.put(ONTOLOGY_PHYSICAL_URI_KEY, environment.getProperty(FORM_GEN_REPOSITORY_URL.toString()));
properties.put(DATA_SOURCE_CLASS, environment.getProperty(DRIVER.toString()));
properties.put(DATA_SOURCE_CLASS, environment.getProperty(PERSISTENCE_DRIVER.toString()));
properties.put(CACHE_ENABLED, Boolean.FALSE.toString());
this.emf = Persistence.createEntityManagerFactory("formGenPU", properties);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import static cz.cvut.kbss.jopa.model.JOPAPersistenceProperties.SCAN_PACKAGE;
import static cz.cvut.kbss.ontodriver.config.OntoDriverProperties.DATA_SOURCE_PASSWORD;
import static cz.cvut.kbss.ontodriver.config.OntoDriverProperties.DATA_SOURCE_USERNAME;
import static cz.cvut.kbss.study.util.ConfigParam.DRIVER;
import static cz.cvut.kbss.study.util.ConfigParam.PERSISTENCE_DRIVER;
import static cz.cvut.kbss.study.util.ConfigParam.REPOSITORY_URL;

/**
Expand Down Expand Up @@ -54,7 +54,7 @@ public EntityManagerFactory getEntityManagerFactory() {
private void init() {
final Map<String, String> properties = new HashMap<>(DEFAULT_PARAMS);
properties.put(ONTOLOGY_PHYSICAL_URI_KEY, environment.getProperty(REPOSITORY_URL.toString()));
properties.put(DATA_SOURCE_CLASS, environment.getProperty(DRIVER.toString()));
properties.put(DATA_SOURCE_CLASS, environment.getProperty(PERSISTENCE_DRIVER.toString()));
if (environment.getProperty(USERNAME_PROPERTY) != null) {
properties.put(DATA_SOURCE_USERNAME, environment.getProperty(USERNAME_PROPERTY));
properties.put(DATA_SOURCE_PASSWORD, environment.getProperty(PASSWORD_PROPERTY));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cz/cvut/kbss/study/util/ConfigParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public enum ConfigParam {
SECURITY_SAME_SITE("security.sameSite"),

REPOSITORY_URL("repositoryUrl"),
DRIVER("driver"),
PERSISTENCE_DRIVER("persistenceDriver"),
FORM_GEN_REPOSITORY_URL("formGenRepositoryUrl"),
FORM_GEN_SERVICE_URL("formGenServiceUrl"),

Expand Down
12 changes: 6 additions & 6 deletions src/main/java/cz/cvut/kbss/study/util/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ public class Configuration {
String appContext;

/**
* Driver to manage triple stores
* Persistence driver to manage triple stores
*/
String driver;
String persistenceDriver;

/**
* URL of repository that holds main data of the application
Expand Down Expand Up @@ -43,12 +43,12 @@ public void setAppContext(String appContext) {
this.appContext = appContext;
}

public String getDriver() {
return driver;
public String getPersistenceDriver() {
return persistenceDriver;
}

public void setDriver(String driver) {
this.driver = driver;
public void setPersistenceDriver(String persistenceDriver) {
this.persistenceDriver = persistenceDriver;
}

public String getRepositoryUrl() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ server.servlet.context-path=/record-manager
management.endpoints.web.exposure.include=health

# Driver to manage triple stores
driver=cz.cvut.kbss.ontodriver.rdf4j.Rdf4jDataSource
persistenceDriver=cz.cvut.kbss.ontodriver.rdf4j.Rdf4jDataSource
# URL of repository that holds main data of the application
repositoryUrl=http://localhost:7200/repositories/record-manager-app
# URL of repository where output and configuration of form-generator should be held
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
public class TestFormGenPersistenceFactory {

private static final String URL_PROPERTY = "test." + ConfigParam.FORM_GEN_REPOSITORY_URL;
private static final String DRIVER_PROPERTY = "test." + ConfigParam.DRIVER;
private static final String DRIVER_PROPERTY = "test." + ConfigParam.PERSISTENCE_DRIVER;

@Autowired
private Environment environment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
public class TestPersistenceFactory {

private static final String URL_PROPERTY = "test." + ConfigParam.REPOSITORY_URL;
private static final String DRIVER_PROPERTY = "test." + ConfigParam.DRIVER;
private static final String DRIVER_PROPERTY = "test." + ConfigParam.PERSISTENCE_DRIVER;
private static final String USERNAME_PROPERTY = "test.username";
private static final String PASSWORD_PROPERTY = "test.password";

Expand Down
9 changes: 2 additions & 7 deletions src/test/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
test.repositoryUrl=study-test-repository
test.driver=cz.cvut.kbss.ontodriver.rdf4j.Rdf4jDataSource
test.persistenceDriver=cz.cvut.kbss.ontodriver.rdf4j.Rdf4jDataSource
test.formGenRepositoryUrl=test-formGen-repository

repositoryUrl=study-test-repository

driver=cz.cvut.kbss.ontodriver.rdf4j.Rdf4jDataSource

formGenRepositoryUrl=test-formGen-repositor\
y
formGenRepositoryUrl=test-formGen-repository
formGenServiceUrl=http://localhost:8081/formGenerator

0 comments on commit bb3f890

Please sign in to comment.