From: Olivier Lamy Date: Fri, 13 Dec 2013 12:33:35 +0000 (+0000) Subject: [MRM-1702] make the locking configurable via the UI X-Git-Tag: archiva-2.0.0-RC1~119 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4803f6be063373fb0303ea3167f7bdaac32ad872;p=archiva.git [MRM-1702] make the locking configurable via the UI git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1550708 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultArchivaRuntimeConfigurationAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultArchivaRuntimeConfigurationAdmin.java index 3c6704d8b..3ac847b9f 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultArchivaRuntimeConfigurationAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultArchivaRuntimeConfigurationAdmin.java @@ -162,6 +162,13 @@ public class DefaultArchivaRuntimeConfigurationAdmin } + if ( archivaRuntimeConfiguration.getFileLockConfiguration() != null ) + { + res.setFileLockConfiguration( + new BeanReplicator().replicateBean( archivaRuntimeConfiguration.getFileLockConfiguration(), + FileLockConfiguration.class ) ); + } + return res; } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java index 834b50556..37ffe0aa8 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java @@ -375,30 +375,31 @@ public class DefaultRedbackRuntimeConfigurationAdmin } private org.apache.archiva.configuration.RedbackRuntimeConfiguration build( - RedbackRuntimeConfiguration archivaRuntimeConfiguration ) + RedbackRuntimeConfiguration redbackRuntimeConfiguration ) { - org.apache.archiva.configuration.RedbackRuntimeConfiguration redbackRuntimeConfiguration = - new BeanReplicator().replicateBean( archivaRuntimeConfiguration, + org.apache.archiva.configuration.RedbackRuntimeConfiguration res = + new BeanReplicator().replicateBean( redbackRuntimeConfiguration, org.apache.archiva.configuration.RedbackRuntimeConfiguration.class ); - if ( archivaRuntimeConfiguration.getLdapConfiguration() == null ) + if ( redbackRuntimeConfiguration.getLdapConfiguration() == null ) { - archivaRuntimeConfiguration.setLdapConfiguration( new LdapConfiguration() ); + redbackRuntimeConfiguration.setLdapConfiguration( new LdapConfiguration() ); } - redbackRuntimeConfiguration.setLdapConfiguration( - new BeanReplicator().replicateBean( archivaRuntimeConfiguration.getLdapConfiguration(), + res.setLdapConfiguration( + new BeanReplicator().replicateBean( redbackRuntimeConfiguration.getLdapConfiguration(), org.apache.archiva.configuration.LdapConfiguration.class ) ); - if ( archivaRuntimeConfiguration.getUsersCacheConfiguration() == null ) + if ( redbackRuntimeConfiguration.getUsersCacheConfiguration() == null ) { - archivaRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() ); + redbackRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() ); } - redbackRuntimeConfiguration.setUsersCacheConfiguration( - new BeanReplicator().replicateBean( archivaRuntimeConfiguration.getUsersCacheConfiguration(), + + res.setUsersCacheConfiguration( + new BeanReplicator().replicateBean( redbackRuntimeConfiguration.getUsersCacheConfiguration(), org.apache.archiva.configuration.CacheConfiguration.class ) ); - List ldapGroupMappings = archivaRuntimeConfiguration.getLdapGroupMappings(); + List ldapGroupMappings = redbackRuntimeConfiguration.getLdapGroupMappings(); if ( ldapGroupMappings != null && ldapGroupMappings.size() > 0 ) { @@ -416,9 +417,9 @@ public class DefaultRedbackRuntimeConfigurationAdmin mappings.add( mapping ); } - redbackRuntimeConfiguration.setLdapGroupMappings( mappings ); + res.setLdapGroupMappings( mappings ); } - return redbackRuntimeConfiguration; + return res; } // wrapper for UserConfiguration to intercept values (and store it not yet migrated) 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 07af93db1..134e48b90 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 @@ -681,6 +681,11 @@ archiva-runtime-configuration.title=Archiva Runtime Configuration runtime-configuration.cache.failure.title=Url Cache Failure runtime-configuration.maven.network.title=Maven Network +runtime-configuration.filelocking.title=FileLocking +runtime.fileLockConfiguration.lockingTimeout.label=Lock Timeout +runtime.fileLockConfiguration.skipLocking.label=Skip Locking + + redback.runtime.ldap.mapping.group.label=LDAP Groups redback.runtime.ldap.mapping.roles.label=Roles redback-runtime-ldap-group-mapping.updated=LDAP Role-Group mapping updated. diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/generaladmin/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/generaladmin/main.js index 2ce5c7562..4784224b4 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/generaladmin/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/generaladmin/main.js @@ -317,7 +317,8 @@ define("archiva/admin/features/generaladmin/main",["jquery","i18n","utils","jque var archivaRuntimeConfiguration=mapArchivaRuntimeConfiguration(data); var archivaRuntimeConfigurationViewModel=new ArchivaRuntimeConfigurationViewModel(archivaRuntimeConfiguration); ko.applyBindings(archivaRuntimeConfigurationViewModel,mainContent.find("#cache-failure-form").get(0)); - var validator = mainContent.find("#cache-failure-form-id") + ko.applyBindings(archivaRuntimeConfigurationViewModel,mainContent.find("#filelocking-form").get(0)); + mainContent.find("#cache-failure-form-id") .validate({ showErrors: function(validator, errorMap, errorList) { customShowError(mainContent.find("#cache-failure-form-id" ),validator,errorMap,errorMap); @@ -362,16 +363,31 @@ define("archiva/admin/features/generaladmin/main",["jquery","i18n","utils","jque } } - ArchivaRuntimeConfiguration=function(cacheConfiguration){ + FileLockConfiguration=function(skipLocking,lockingTimeout){ + //private boolean skipLocking = true; + this.skipLocking=ko.observable(skipLocking); + //private int lockingTimeout = 0; + this.lockingTimeout=ko.observable(lockingTimeout) ; + } + + ArchivaRuntimeConfiguration=function(cacheConfiguration,fileLockConfiguration){ this.urlFailureCacheConfiguration=ko.observable(cacheConfiguration); + this.fileLockConfiguration=ko.observable(fileLockConfiguration); } + mapFileLockConfiguration=function(data){ + if (!data){ + return null; + } + return new FileLockConfiguration(data.skipLocking,data.lockingTimeout); + } mapArchivaRuntimeConfiguration=function(data){ if(!data){ return null; } - return new ArchivaRuntimeConfiguration(data.urlFailureCacheConfiguration?mapCacheConfiguration(data.urlFailureCacheConfiguration):null); + return new ArchivaRuntimeConfiguration(data.urlFailureCacheConfiguration?mapCacheConfiguration(data.urlFailureCacheConfiguration):null, + data.fileLockConfiguration?mapFileLockConfiguration(data.fileLockConfiguration):null); } //--------------------------- // organisation/appearance configuration part diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/general-admin.html b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/general-admin.html index fe734ee83..1397b4eaf 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/general-admin.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/general-admin.html @@ -287,6 +287,7 @@
@@ -297,9 +298,11 @@
-
+
+
+
@@ -369,6 +372,8 @@ + + @@ -376,6 +381,35 @@ + + + +