From bb3f890e24802ccc314d776759b8baa5229ef690 Mon Sep 17 00:00:00 2001 From: Daniil Palagin Date: Fri, 29 Nov 2024 17:51:15 +0100 Subject: [PATCH] [#80] Rename driver property to persistenceDriver --- doc/configuration.md | 2 +- .../study/persistence/FormGenPersistenceFactory.java | 5 ++--- .../kbss/study/persistence/PersistenceFactory.java | 4 ++-- .../java/cz/cvut/kbss/study/util/ConfigParam.java | 2 +- .../java/cz/cvut/kbss/study/util/Configuration.java | 12 ++++++------ src/main/resources/application.properties | 2 +- .../persistence/TestFormGenPersistenceFactory.java | 2 +- .../study/persistence/TestPersistenceFactory.java | 2 +- src/test/resources/application.properties | 9 ++------- 9 files changed, 17 insertions(+), 23 deletions(-) diff --git a/doc/configuration.md b/doc/configuration.md index dea03f3b..5f651403 100644 --- a/doc/configuration.md +++ b/doc/configuration.md @@ -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 | @@ -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 | diff --git a/src/main/java/cz/cvut/kbss/study/persistence/FormGenPersistenceFactory.java b/src/main/java/cz/cvut/kbss/study/persistence/FormGenPersistenceFactory.java index 0bab5333..70a80cbb 100644 --- a/src/main/java/cz/cvut/kbss/study/persistence/FormGenPersistenceFactory.java +++ b/src/main/java/cz/cvut/kbss/study/persistence/FormGenPersistenceFactory.java @@ -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; @@ -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 @@ -38,7 +37,7 @@ public EntityManagerFactory getEntityManagerFactory() { private void init() { final Map 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); } diff --git a/src/main/java/cz/cvut/kbss/study/persistence/PersistenceFactory.java b/src/main/java/cz/cvut/kbss/study/persistence/PersistenceFactory.java index 6c70eec6..085ec926 100644 --- a/src/main/java/cz/cvut/kbss/study/persistence/PersistenceFactory.java +++ b/src/main/java/cz/cvut/kbss/study/persistence/PersistenceFactory.java @@ -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; /** @@ -54,7 +54,7 @@ public EntityManagerFactory getEntityManagerFactory() { private void init() { final Map 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)); diff --git a/src/main/java/cz/cvut/kbss/study/util/ConfigParam.java b/src/main/java/cz/cvut/kbss/study/util/ConfigParam.java index 80c1c3f7..0f257bae 100644 --- a/src/main/java/cz/cvut/kbss/study/util/ConfigParam.java +++ b/src/main/java/cz/cvut/kbss/study/util/ConfigParam.java @@ -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"), diff --git a/src/main/java/cz/cvut/kbss/study/util/Configuration.java b/src/main/java/cz/cvut/kbss/study/util/Configuration.java index 196ffbf5..48a6579f 100644 --- a/src/main/java/cz/cvut/kbss/study/util/Configuration.java +++ b/src/main/java/cz/cvut/kbss/study/util/Configuration.java @@ -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 @@ -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() { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index c829826c..488d3b80 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -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 diff --git a/src/test/java/cz/cvut/kbss/study/persistence/TestFormGenPersistenceFactory.java b/src/test/java/cz/cvut/kbss/study/persistence/TestFormGenPersistenceFactory.java index 0e8df28b..5cdf8c3d 100644 --- a/src/test/java/cz/cvut/kbss/study/persistence/TestFormGenPersistenceFactory.java +++ b/src/test/java/cz/cvut/kbss/study/persistence/TestFormGenPersistenceFactory.java @@ -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; diff --git a/src/test/java/cz/cvut/kbss/study/persistence/TestPersistenceFactory.java b/src/test/java/cz/cvut/kbss/study/persistence/TestPersistenceFactory.java index 0f36b125..9510fde3 100644 --- a/src/test/java/cz/cvut/kbss/study/persistence/TestPersistenceFactory.java +++ b/src/test/java/cz/cvut/kbss/study/persistence/TestPersistenceFactory.java @@ -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"; diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 453a5f19..00a0e2dd 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -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 \ No newline at end of file