From 22a5983d60c4411792523640d5c38b6fb8a69a4f Mon Sep 17 00:00:00 2001 From: Oliver Bertuch Date: Wed, 9 Dec 2020 20:53:28 +0100 Subject: [PATCH 01/10] Test using MPCONFIG variable substitution in web.xml. #6953 --- src/main/resources/META-INF/microprofile-config.properties | 2 ++ src/main/webapp/WEB-INF/web.xml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/resources/META-INF/microprofile-config.properties b/src/main/resources/META-INF/microprofile-config.properties index 8c475f1c050..2b7aa405f32 100644 --- a/src/main/resources/META-INF/microprofile-config.properties +++ b/src/main/resources/META-INF/microprofile-config.properties @@ -2,3 +2,5 @@ dataverse.db.host=localhost dataverse.db.port=5432 dataverse.db.user=dataverse dataverse.db.name=dataverse + +dataverse.webxml.faces.buffer-size=102400 \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 9ccec3d9d59..a1c99457ee6 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -50,7 +50,7 @@ javax.faces.FACELETS_BUFFER_SIZE - 102400 + ${MPCONFIG=dataverse.webxml.faces.buffer-size} javax.faces.FACELETS_REFRESH_PERIOD From 222d6545b415da258ad3be1ffd6beaf3dbb5dd43 Mon Sep 17 00:00:00 2001 From: Oliver Bertuch Date: Wed, 17 Mar 2021 16:02:41 +0100 Subject: [PATCH 02/10] feature(config): Make JSF parameters dynamically configurable. #6953 --- .../META-INF/microprofile-config.properties | 2 -- src/main/webapp/WEB-INF/web.xml | 12 ++++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/resources/META-INF/microprofile-config.properties b/src/main/resources/META-INF/microprofile-config.properties index 2b7aa405f32..8c475f1c050 100644 --- a/src/main/resources/META-INF/microprofile-config.properties +++ b/src/main/resources/META-INF/microprofile-config.properties @@ -2,5 +2,3 @@ dataverse.db.host=localhost dataverse.db.port=5432 dataverse.db.user=dataverse dataverse.db.name=dataverse - -dataverse.webxml.faces.buffer-size=102400 \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index a1c99457ee6..5413f902595 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -27,11 +27,11 @@ javax.faces.PROJECT_STAGE - Production + ${MPCONFIG=dataverse.jsf.project-stage:Production} primefaces.THEME - bootstrap + ${MPCONFIG=dataverse.jsf.primefaces.theme:bootstrap} @@ -42,19 +42,19 @@ javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL - true + ${MPCONFIG=dataverse.jsf.empty-string-null:true} javax.faces.FACELETS_SKIP_COMMENTS - true + ${MPCONFIG=dataverse.jsf.skip-comments:true} javax.faces.FACELETS_BUFFER_SIZE - ${MPCONFIG=dataverse.webxml.faces.buffer-size} + ${MPCONFIG=dataverse.jsf.buffer-size:102400} javax.faces.FACELETS_REFRESH_PERIOD - -1 + ${MPCONFIG=dataverse.jsf.refresh-period:-1} From 617592ff26976cee58f3676ceac5f459e3e2ab34 Mon Sep 17 00:00:00 2001 From: Oliver Bertuch Date: Wed, 17 Mar 2021 16:03:16 +0100 Subject: [PATCH 03/10] docs(config): add docs about JSF parameter configuration for devs --- doc/release-notes/6953-dev-jsf-settings.md | 4 ++ .../source/developers/debugging.rst | 52 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 doc/release-notes/6953-dev-jsf-settings.md diff --git a/doc/release-notes/6953-dev-jsf-settings.md b/doc/release-notes/6953-dev-jsf-settings.md new file mode 100644 index 00000000000..677b44176d2 --- /dev/null +++ b/doc/release-notes/6953-dev-jsf-settings.md @@ -0,0 +1,4 @@ +### Dynamic Java Server Faces Configuration Options + +This release includes a new way to easily change JSF settings via MicroProfile Config, especially useful during development. +See the [development guide on "Debugging"](https://guides.dataverse.org/en/5.4/developers/debugging.html). \ No newline at end of file diff --git a/doc/sphinx-guides/source/developers/debugging.rst b/doc/sphinx-guides/source/developers/debugging.rst index 402788cf4e0..abbba80e687 100644 --- a/doc/sphinx-guides/source/developers/debugging.rst +++ b/doc/sphinx-guides/source/developers/debugging.rst @@ -10,6 +10,58 @@ Logging By default, the app server logs at the "INFO" level but logging can be increased to "FINE" on the fly with (for example) ``./asadmin set-log-levels edu.harvard.iq.dataverse.api.Datasets=FINE``. Running ``./asadmin list-log-levels`` will show the current logging levels. +Java Server Faces (JSF) Configuration Options +--------------------------------------------- + +Some JSF options can be easily changed via MicroProfile Config (using env vars, system properties, etc) +during development without recompiling. Changing the options will require at least a redeployment, obviously depending +how you get these options in. (Variable substitution only happens during deployment and when using system properties +or env vars, you'll need to pass these into the domain, which usually will require a app server restart.) + +Please note that since Payara 5.2021.1 supporting MicroProfile Config 2.0, you can +`use profiles `_ +to maintain your settings more easily for different environments. + +.. list-table:: + :widths: 15 15 60 10 + :header-rows: 1 + :align: left + + * - JSF Option + - MPCONFIG Key + - Description + - Default + * - javax.faces.PROJECT_STAGE + - dataverse.jsf.project-stage + - Switch to different levels to make JSF more verbose, disable caches etc. + Read more `here `_, + `here `_ and `here `_ + - ``Production`` + * - javax.faces.INTERPRET_EMPTY + _STRING_SUBMITTED_VALUES_AS_NULL + - dataverse.jsf.empty-string-null + - See `Jakarta Server Faces 3.0 Spec`_ + - ``true`` + * - javax.faces.FACELETS_SKIP_COMMENTS + - dataverse.jsf.skip-comments + - See `Jakarta Server Faces 3.0 Spec`_ + - ``true`` + * - javax.faces.FACELETS_BUFFER_SIZE + - dataverse.jsf.buffer-size + - See `Jakarta Server Faces 3.0 Spec`_ + - ``102400`` (100 KB) + * - javax.faces.FACELETS_REFRESH_PERIOD + - dataverse.jsf.refresh-period + - See `Jakarta Server Faces 3.0 Spec`_ + - ``-1`` + * - primefaces.THEME + - dataverse.jsf.primefaces.theme + - See `PrimeFaces Configuration Docs`_ + - ``bootstrap`` + +.. _Jakarta Server Faces 3.0 Spec: https://jakarta.ee/specifications/faces/3.0/jakarta-faces-3.0.html#a6088 +.. _PrimeFaces Configuration Docs: https://primefaces.github.io/primefaces/8_0/#/gettingstarted/configuration + ---- Previous: :doc:`documentation` | Next: :doc:`coding-style` From ca35411941adffa8fb8e1b4fce927a5f2db90aaf Mon Sep 17 00:00:00 2001 From: Oliver Bertuch Date: Thu, 25 Mar 2021 23:27:48 +0100 Subject: [PATCH 04/10] refactor(config): make web.xml variable substitution compatible with Payara 5.2020.6 #6953 --- .../META-INF/microprofile-config.properties | 9 +++++++++ src/main/webapp/WEB-INF/web.xml | 12 ++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/resources/META-INF/microprofile-config.properties b/src/main/resources/META-INF/microprofile-config.properties index 8c475f1c050..75dc4bc3f05 100644 --- a/src/main/resources/META-INF/microprofile-config.properties +++ b/src/main/resources/META-INF/microprofile-config.properties @@ -1,4 +1,13 @@ +# DATABASE dataverse.db.host=localhost dataverse.db.port=5432 dataverse.db.user=dataverse dataverse.db.name=dataverse + +# WEB.XML / JSF +dataverse.jsf.project-stage=Production +dataverse.jsf.primefaces.theme=bootstrap +dataverse.jsf.empty-string-null=true +dataverse.jsf.skip-comments=true +dataverse.jsf.buffer-size=102400 +dataverse.jsf.refresh-period=-1 \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 5413f902595..1a924dbb8f4 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -27,11 +27,11 @@ javax.faces.PROJECT_STAGE - ${MPCONFIG=dataverse.jsf.project-stage:Production} + ${MPCONFIG=dataverse.jsf.project-stage} primefaces.THEME - ${MPCONFIG=dataverse.jsf.primefaces.theme:bootstrap} + ${MPCONFIG=dataverse.jsf.primefaces.theme} @@ -42,19 +42,19 @@ javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL - ${MPCONFIG=dataverse.jsf.empty-string-null:true} + ${MPCONFIG=dataverse.jsf.empty-string-null} javax.faces.FACELETS_SKIP_COMMENTS - ${MPCONFIG=dataverse.jsf.skip-comments:true} + ${MPCONFIG=dataverse.jsf.skip-comments} javax.faces.FACELETS_BUFFER_SIZE - ${MPCONFIG=dataverse.jsf.buffer-size:102400} + ${MPCONFIG=dataverse.jsf.buffer-size} javax.faces.FACELETS_REFRESH_PERIOD - ${MPCONFIG=dataverse.jsf.refresh-period:-1} + ${MPCONFIG=dataverse.jsf.refresh-period} From cc022cfe89359f21f574cd4098219a873eb5f815 Mon Sep 17 00:00:00 2001 From: Oliver Bertuch Date: Thu, 25 Mar 2021 23:30:39 +0100 Subject: [PATCH 05/10] docs(config): add some notes about the MPCONFIG portability in web.xml and a docs hint. #6953 --- src/main/webapp/WEB-INF/web.xml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 1a924dbb8f4..9d4d5f6b989 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -22,15 +22,18 @@ org.jboss.weld.context.conversation.lazy false - + javax.faces.PROJECT_STAGE - + ${MPCONFIG=dataverse.jsf.project-stage} primefaces.THEME + ${MPCONFIG=dataverse.jsf.primefaces.theme} @@ -42,18 +45,22 @@ javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL + ${MPCONFIG=dataverse.jsf.empty-string-null} javax.faces.FACELETS_SKIP_COMMENTS + ${MPCONFIG=dataverse.jsf.skip-comments} javax.faces.FACELETS_BUFFER_SIZE + ${MPCONFIG=dataverse.jsf.buffer-size} javax.faces.FACELETS_REFRESH_PERIOD + ${MPCONFIG=dataverse.jsf.refresh-period} From 48d6501894f07c9f17f787fe132b551d4cb28a67 Mon Sep 17 00:00:00 2001 From: Oliver Bertuch Date: Fri, 26 Mar 2021 01:28:47 +0100 Subject: [PATCH 06/10] revert(config): make web.xml variable substitution compatible with Payara 5.2020.6 #6953 Reverts commit ca354119 Due to the nature of the application server, when the web app context is initialised, it cannot yet access the deployments default MPCONFIG source within META-INF/microprofile-config.properties. As a consequence, as long as we do not update to Payara 5.2021.1, we cannot provide sane defaults within the variable. That means that every installation would need to set the variables in MPCONFIG sources available at startup time and before the deployment finished: any are possible that are baked into Payara. As this doesn't seem feasible, this PR will be blocked until #7700 is resolved. --- .../META-INF/microprofile-config.properties | 10 +--------- src/main/webapp/WEB-INF/web.xml | 12 ++++++------ 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/main/resources/META-INF/microprofile-config.properties b/src/main/resources/META-INF/microprofile-config.properties index 75dc4bc3f05..ef114f60dc1 100644 --- a/src/main/resources/META-INF/microprofile-config.properties +++ b/src/main/resources/META-INF/microprofile-config.properties @@ -2,12 +2,4 @@ dataverse.db.host=localhost dataverse.db.port=5432 dataverse.db.user=dataverse -dataverse.db.name=dataverse - -# WEB.XML / JSF -dataverse.jsf.project-stage=Production -dataverse.jsf.primefaces.theme=bootstrap -dataverse.jsf.empty-string-null=true -dataverse.jsf.skip-comments=true -dataverse.jsf.buffer-size=102400 -dataverse.jsf.refresh-period=-1 \ No newline at end of file +dataverse.db.name=dataverse \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 9d4d5f6b989..8179ca970d5 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -29,12 +29,12 @@ javax.faces.PROJECT_STAGE - ${MPCONFIG=dataverse.jsf.project-stage} + ${MPCONFIG=dataverse.jsf.project-stage:Production} primefaces.THEME - ${MPCONFIG=dataverse.jsf.primefaces.theme} + ${MPCONFIG=dataverse.jsf.primefaces.theme:bootstrap} @@ -46,22 +46,22 @@ javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL - ${MPCONFIG=dataverse.jsf.empty-string-null} + ${MPCONFIG=dataverse.jsf.empty-string-null:true} javax.faces.FACELETS_SKIP_COMMENTS - ${MPCONFIG=dataverse.jsf.skip-comments} + ${MPCONFIG=dataverse.jsf.skip-comments:true} javax.faces.FACELETS_BUFFER_SIZE - ${MPCONFIG=dataverse.jsf.buffer-size} + ${MPCONFIG=dataverse.jsf.buffer-size:102400} javax.faces.FACELETS_REFRESH_PERIOD - ${MPCONFIG=dataverse.jsf.refresh-period} + ${MPCONFIG=dataverse.jsf.refresh-period:-1} From 712a1e649ac10f6eab384affb7a6b0bb178a4837 Mon Sep 17 00:00:00 2001 From: Oliver Bertuch Date: Tue, 8 Jun 2021 12:30:46 +0200 Subject: [PATCH 07/10] chore(mpconfig): add newline at end of microprofile-config.properties --- src/main/resources/META-INF/microprofile-config.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/META-INF/microprofile-config.properties b/src/main/resources/META-INF/microprofile-config.properties index ef114f60dc1..09d71dfbf3a 100644 --- a/src/main/resources/META-INF/microprofile-config.properties +++ b/src/main/resources/META-INF/microprofile-config.properties @@ -2,4 +2,4 @@ dataverse.db.host=localhost dataverse.db.port=5432 dataverse.db.user=dataverse -dataverse.db.name=dataverse \ No newline at end of file +dataverse.db.name=dataverse From 570c20d8d07418dcc5080d9169db9853f0da4578 Mon Sep 17 00:00:00 2001 From: Danny Brooke Date: Tue, 17 Aug 2021 11:39:54 -0400 Subject: [PATCH 08/10] updating to latest instead of a specific version --- doc/release-notes/6953-dev-jsf-settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/release-notes/6953-dev-jsf-settings.md b/doc/release-notes/6953-dev-jsf-settings.md index 677b44176d2..2ad8c45edf1 100644 --- a/doc/release-notes/6953-dev-jsf-settings.md +++ b/doc/release-notes/6953-dev-jsf-settings.md @@ -1,4 +1,4 @@ ### Dynamic Java Server Faces Configuration Options This release includes a new way to easily change JSF settings via MicroProfile Config, especially useful during development. -See the [development guide on "Debugging"](https://guides.dataverse.org/en/5.4/developers/debugging.html). \ No newline at end of file +See the [development guide on "Debugging"](https://guides.dataverse.org/en/latest/developers/debugging.html). From 98dbcb539158b798972e0b5682a66ddad844b17c Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Tue, 17 Aug 2021 14:48:56 -0400 Subject: [PATCH 09/10] resolve 'Duplicate explicit target name: "here"' error #6953 --- doc/sphinx-guides/source/developers/debugging.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/sphinx-guides/source/developers/debugging.rst b/doc/sphinx-guides/source/developers/debugging.rst index abbba80e687..4df028c5bef 100644 --- a/doc/sphinx-guides/source/developers/debugging.rst +++ b/doc/sphinx-guides/source/developers/debugging.rst @@ -34,8 +34,8 @@ to maintain your settings more easily for different environments. * - javax.faces.PROJECT_STAGE - dataverse.jsf.project-stage - Switch to different levels to make JSF more verbose, disable caches etc. - Read more `here `_, - `here `_ and `here `_ + Read more `at `_ + `various `_ `places `_. - ``Production`` * - javax.faces.INTERPRET_EMPTY _STRING_SUBMITTED_VALUES_AS_NULL From ea22af3827203c96fa654242f87e3dd961457f46 Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Tue, 17 Aug 2021 16:16:35 -0400 Subject: [PATCH 10/10] explain how devs can get instant gui edit feedback #6953 --- doc/sphinx-guides/source/developers/debugging.rst | 6 ++++-- .../source/developers/dev-environment.rst | 11 +++++++++++ scripts/dev/dev-rebuild.sh | 4 ++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/doc/sphinx-guides/source/developers/debugging.rst b/doc/sphinx-guides/source/developers/debugging.rst index 4df028c5bef..d4ba214d5be 100644 --- a/doc/sphinx-guides/source/developers/debugging.rst +++ b/doc/sphinx-guides/source/developers/debugging.rst @@ -10,13 +10,15 @@ Logging By default, the app server logs at the "INFO" level but logging can be increased to "FINE" on the fly with (for example) ``./asadmin set-log-levels edu.harvard.iq.dataverse.api.Datasets=FINE``. Running ``./asadmin list-log-levels`` will show the current logging levels. +.. _jsf-config: + Java Server Faces (JSF) Configuration Options --------------------------------------------- -Some JSF options can be easily changed via MicroProfile Config (using env vars, system properties, etc) +Some JSF options can be easily changed via MicroProfile Config (using environment variables, system properties, etc.) during development without recompiling. Changing the options will require at least a redeployment, obviously depending how you get these options in. (Variable substitution only happens during deployment and when using system properties -or env vars, you'll need to pass these into the domain, which usually will require a app server restart.) +or environment variables, you'll need to pass these into the domain, which usually will require an app server restart.) Please note that since Payara 5.2021.1 supporting MicroProfile Config 2.0, you can `use profiles `_ diff --git a/doc/sphinx-guides/source/developers/dev-environment.rst b/doc/sphinx-guides/source/developers/dev-environment.rst index 61ab98bf292..2ec5dbea29e 100755 --- a/doc/sphinx-guides/source/developers/dev-environment.rst +++ b/doc/sphinx-guides/source/developers/dev-environment.rst @@ -192,6 +192,17 @@ Run the following command: This will disable DOI registration by using a fake (in-code) DOI provider. Please note that this feature is only available in Dataverse Software 4.10+ and that at present, the UI will give no indication that the DOIs thus minted are fake. +Configure Your Development Environment for GUI Edits +---------------------------------------------------- + +Out of the box, a JSF setting is configured for production use and prevents edits to the GUI (xhtml files) from being visible unless you do a full deployment. + +It is recommended that you run the following command so that simply saving the xhtml file in Netbeans is enough for the change to show up. + +``asadmin create-system-properties "dataverse.jsf.refresh-period=1"`` + +For more on JSF settings like this, see :ref:`jsf-config`. + Next Steps ---------- diff --git a/scripts/dev/dev-rebuild.sh b/scripts/dev/dev-rebuild.sh index f98edc8d938..71857b14068 100755 --- a/scripts/dev/dev-rebuild.sh +++ b/scripts/dev/dev-rebuild.sh @@ -57,6 +57,10 @@ psql -U $DB_USER $DB_NAME -f doc/sphinx-guides/source/_static/util/createsequenc echo "Setting DOI provider to \"FAKE\"..." curl http://localhost:8080/api/admin/settings/:DoiProvider -X PUT -d FAKE + +echo "Allowing GUI edits to be visible without redeploy..." +$PAYARA_DIR/glassfish/bin/asadmin create-system-properties "dataverse.jsf.refresh-period=1" + export API_TOKEN=`cat /tmp/setup-all.sh.out | grep apiToken| jq .data.apiToken | tr -d \"` echo "Publishing root dataverse..."