This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit 0013a92295d659fb9eb5b055b3e31f6dab8835c7 Author: Brendan Le Ny <bleny@codelutin.com> Date: Thu Oct 23 16:19:33 2014 +0200 Ajout d'une interface utilisateur pour invalider tous les caches sans redémarrer Wao --- .../ifremer/wao/services/AuthenticatedWaoUser.java | 4 +++ .../wao/services/service/InitWaoService.java | 17 +++++++++++++ .../administration/InvalidateAllCachesAction.java | 26 +++++++++++++++++++ .../main/resources/i18n/wao-web_en_GB.properties | 4 +++ .../main/resources/i18n/wao-web_fr_FR.properties | 4 +++ .../administration/invalidate-all-caches-input.jsp | 29 ++++++++++++++++++++++ .../src/main/webapp/WEB-INF/decorators/layout.jsp | 8 ++++++ 7 files changed, 92 insertions(+) diff --git a/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java b/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java index e67f14d..6f162bf 100644 --- a/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java +++ b/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java @@ -145,6 +145,10 @@ public class AuthenticatedWaoUser implements Serializable{ return userProfile.isAdmin() && isCanWrite(); } + public boolean isAuthorizedToInvalidateAllCaches() { + return userProfile.isAdmin() && isCanWrite(); + } + public boolean isAuthorizedToViewCompanies() { return userProfile.isAdmin(); } diff --git a/wao-services/src/main/java/fr/ifremer/wao/services/service/InitWaoService.java b/wao-services/src/main/java/fr/ifremer/wao/services/service/InitWaoService.java index c90205a..8013668 100644 --- a/wao-services/src/main/java/fr/ifremer/wao/services/service/InitWaoService.java +++ b/wao-services/src/main/java/fr/ifremer/wao/services/service/InitWaoService.java @@ -72,4 +72,21 @@ public class InitWaoService extends WaoServiceSupport { } + public void invalidateAllCaches() { + + if (log.isInfoEnabled()) { + log.info("début de l'invalidation de tous les caches"); + } + + serviceContext.getSamplingPlansCache().invalidateAll(); + serviceContext.getBoatsFilterValuesCache().invalidateAll(); + serviceContext.getContactsFilterValuesCache().invalidateAll(); + serviceContext.getSynthesesCache().invalidateAll(); + + if (log.isInfoEnabled()) { + log.info("fin de l'invalidation de tous les caches"); + } + + } + } diff --git a/wao-web/src/main/java/fr/ifremer/wao/web/action/administration/InvalidateAllCachesAction.java b/wao-web/src/main/java/fr/ifremer/wao/web/action/administration/InvalidateAllCachesAction.java new file mode 100644 index 0000000..9041c19 --- /dev/null +++ b/wao-web/src/main/java/fr/ifremer/wao/web/action/administration/InvalidateAllCachesAction.java @@ -0,0 +1,26 @@ +package fr.ifremer.wao.web.action.administration; + +import fr.ifremer.wao.services.service.InitWaoService; +import fr.ifremer.wao.web.WaoJspActionSupport; +import org.nuiton.i18n.I18n; + +public class InvalidateAllCachesAction extends WaoJspActionSupport { + + protected InitWaoService service; + + public void setService(InitWaoService service) { + this.service = service; + } + + @Override + public String execute() { + + service.invalidateAllCaches(); + + addActionMessage(getText(I18n.n("wao.ui.action.invalidateAllCaches.success"))); + + return INPUT; + + } + +} diff --git a/wao-web/src/main/resources/i18n/wao-web_en_GB.properties b/wao-web/src/main/resources/i18n/wao-web_en_GB.properties index 5ed97b4..4a8da23 100644 --- a/wao-web/src/main/resources/i18n/wao-web_en_GB.properties +++ b/wao-web/src/main/resources/i18n/wao-web_en_GB.properties @@ -62,6 +62,9 @@ wao.ui.action.exportSamplingPlanCsvWithStatistics=Export the plan and the statis wao.ui.action.filter=Apply filters wao.ui.action.goBackToSamplingPlan=Back to sampling plan wao.ui.action.hideFilters=Hide filters +wao.ui.action.invalidateAllCaches=Invalidate all caches +wao.ui.action.invalidateAllCaches.disclaimer=Invalidate all caches will result in very low performance for some minutes +wao.ui.action.invalidateAllCaches.success=Caches were successfully invalidated wao.ui.action.login=Connection wao.ui.action.logout=Logout wao.ui.action.reduceView=Reduce view @@ -483,6 +486,7 @@ wao.ui.page.ContactForm.mammalsInfo.disclaimer=Warning, all the information you wao.ui.page.ContactForm.title=Contact edition wao.ui.page.Contacts.title=Contacts wao.ui.page.Index.title=Home +wao.ui.page.InvalidateAllCaches.title=Caches invalidation wao.ui.page.ReferentialManagement.title=Referentials management wao.ui.page.SamplingPlan.title=Sampling plan wao.ui.page.Synthesis.title=Synthesis diff --git a/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties b/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties index 5de8dc6..92b4202 100644 --- a/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties +++ b/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties @@ -63,6 +63,9 @@ wao.ui.action.exportSamplingPlanCsvWithStatistics=Exporter au format CSV le plan wao.ui.action.filter=Appliquer les filtres wao.ui.action.goBackToSamplingPlan=Retourner au plan d'échantillonnage wao.ui.action.hideFilters=Masquer les filtres +wao.ui.action.invalidateAllCaches=Purger tous les caches +wao.ui.action.invalidateAllCaches.disclaimer=La purge de tous les caches de WAO permet de forcer le recalcul des différentes données affichées à partir des données en base. Cela va entraîner des performances dégradées pendant quelques minutes, le temps que les caches soient de nouveaux remplis. +wao.ui.action.invalidateAllCaches.success=Les caches ont été purgés avec succès wao.ui.action.login=Connexion wao.ui.action.logout=Déconnexion wao.ui.action.reduceView=Réduire la vue @@ -484,6 +487,7 @@ wao.ui.page.ContactForm.mammalsInfo.disclaimer=Noms scientifiques, nombre d'indi wao.ui.page.ContactForm.title=Modification d'un contact wao.ui.page.Contacts.title=Contacts wao.ui.page.Index.title=Accueil +wao.ui.page.InvalidateAllCaches.title=Purge des caches wao.ui.page.ReferentialManagement.title=Gestion des référentiels wao.ui.page.SamplingPlan.title=Plan d'échantillonnage wao.ui.page.Synthesis.title=Synthèse diff --git a/wao-web/src/main/webapp/WEB-INF/content/administration/invalidate-all-caches-input.jsp b/wao-web/src/main/webapp/WEB-INF/content/administration/invalidate-all-caches-input.jsp new file mode 100644 index 0000000..0896101 --- /dev/null +++ b/wao-web/src/main/webapp/WEB-INF/content/administration/invalidate-all-caches-input.jsp @@ -0,0 +1,29 @@ +<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> +<%@taglib uri="/struts-tags" prefix="s" %> + +<html> + <head> + <title> + <s:text name="wao.ui.page.InvalidateAllCaches.title" /> + </title> + <content tag="mainClass">form</content> + </head> + + <body> + + <s:form action="invalidate-all-caches" method="POST"> + + <h1><s:text name="wao.ui.page.InvalidateAllCaches.title" /></h1> + + <div class="alert alert-warn"> + <s:text name="wao.ui.action.invalidateAllCaches.disclaimer" /> + </div> + + <s:submit type="button" cssClass="btn btn-danger"> + <i class="icon-trash"></i> <s:text name="wao.ui.action.invalidateAllCaches" /> + </s:submit> + + </s:form> + + </body> +</html> \ No newline at end of file diff --git a/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp b/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp index 3dc5ff1..211341f 100644 --- a/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp +++ b/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp @@ -188,6 +188,14 @@ </s:a> </li> </s:if> + <s:if test="authenticatedWaoUser.authorizedToInvalidateAllCaches"> + <li> + <s:url namespace="/administration" action="invalidate-all-caches!input" id="invalidateAllCachesUrl" /> + <s:a href="%{invalidateAllCachesUrl}"> + <i class="fa fa-gear"></i> <s:text name="wao.ui.page.InvalidateAllCaches.title" /> + </s:a> + </li> + </s:if> <s:if test="authenticatedWaoUser.authorizedToViewCompanies"> <li> <s:url namespace="/administration" action="companies" id="companiesUrl" /> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.