diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SystemStatusService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SystemStatusService.java index 056b57b1c..8e0c809b3 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SystemStatusService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SystemStatusService.java @@ -72,4 +72,12 @@ public interface SystemStatusService Boolean clearCache( @PathParam( "key" ) String cacheKey ) throws ArchivaRestServiceException; + @Path( "clearAllCaches" ) + @GET + @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) + @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) + Boolean clearAllCaches() + throws ArchivaRestServiceException; + + } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java index b951db3ae..31e529a1b 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java @@ -140,4 +140,14 @@ public class DefaultSystemStatusService cache.clear(); return Boolean.TRUE; } + + public Boolean clearAllCaches() + throws ArchivaRestServiceException + { + for ( Cache cache : caches.values() ) + { + cache.clear(); + } + return Boolean.TRUE; + } } diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties index 95a0245bc..1c43eb746 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties @@ -306,6 +306,8 @@ system-status.caches.grid.header.flush=Flush system-status.caches.grid.header.key=Cache system-status.caches.flushed=Cache {0} flushed. system-status.caches.grid.header.size=Size +system-status.caches.flushAll=Flush All Caches +system-status.caches.all.flushed=All Caches flushed. diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js index c3480b333..e7933568f 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js @@ -615,6 +615,18 @@ $(function() { }); } + flushAllCaches=function(){ + clearUserMessages(); + $("#main-content #status_caches").html(smallSpinnerImg()); + $.ajax("restServices/archivaServices/systemStatusService/clearAllCaches", { + type: "GET", + success: function(data){ + displaySuccessMessage( $.i18n.prop("system-status.caches.all.flushed")); + displayCacheEntries(); + } + }); + } + displaySystemStatus=function(){ screenChange(); var mainContent=$("#main-content"); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/general-admin.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/general-admin.html index 39a76eda7..28ea2acb3 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/general-admin.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/general-admin.html @@ -359,6 +359,9 @@