]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1702] make the locking configurable via the UI
authorOlivier Lamy <olamy@apache.org>
Fri, 13 Dec 2013 12:33:35 +0000 (12:33 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 13 Dec 2013 12:33:35 +0000 (12:33 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1550708 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultArchivaRuntimeConfigurationAdmin.java
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java
archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/generaladmin/main.js
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/general-admin.html

index 3c6704d8b794c7de8e9663340151016a94684e82..3ac847b9fef23d734fec1dbaee3162876a34e3e8 100644 (file)
@@ -162,6 +162,13 @@ public class DefaultArchivaRuntimeConfigurationAdmin
 
         }
 
+        if ( archivaRuntimeConfiguration.getFileLockConfiguration() != null )
+        {
+            res.setFileLockConfiguration(
+                new BeanReplicator().replicateBean( archivaRuntimeConfiguration.getFileLockConfiguration(),
+                                                    FileLockConfiguration.class ) );
+        }
+
         return res;
     }
 
index 834b50556031f75311a62e54f0e1b1d9b8da7fa4..37ffe0aa816103447f852d3ec815760e083dfed7 100644 (file)
@@ -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<LdapGroupMapping> ldapGroupMappings = archivaRuntimeConfiguration.getLdapGroupMappings();
+        List<LdapGroupMapping> 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)
index 07af93db143f17a9be38922ae7fe81ee3ae62561..134e48b90b701ae02d0c4948cee055e77b927705 100644 (file)
@@ -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.
index 2ce5c7562097792ec5c14ccf4f7c4e623d625d95..4784224b4a5d628dca49a2d193f9fdee7bc7f184 100644 (file)
@@ -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
index fe734ee834e5154eb5ea3f5177b4c6be206d8559..1397b4eaf1e110a9647b8dd3dd048d033d32bc8e 100644 (file)
   <ul class="nav nav-tabs">
     <li class="active" id="network-configuration-form-li"><a href="#network-configuration-form-content" data-toggle="tab">${$.i18n.prop('runtime-configuration.maven.network.title')}</a></li>
     <li id="cache-failure-form-li"><a href="#cache-failure-form-content" data-toggle="tab">${$.i18n.prop('runtime-configuration.cache.failure.title')}</a></li>
+    <li id="filelocking-form-li"><a href="#filelocking-form-content" data-toggle="tab">${$.i18n.prop('runtime-configuration.filelocking.title')}</a></li>
   </ul>
 
   <div class="tab-content">
       <div id="network-configuration-form" data-bind='template: {name:"network-configuration-form-tmpl"}'></div>
     </div>
     <div class="tab-pane" id="cache-failure-form-content">
-
       <div id="cache-failure-form" data-bind='template: {name:"cache-failure-form-tmpl"}'></div>
     </div>
+    <div class="tab-pane" id="filelocking-form-content">
+      <div id="filelocking-form" data-bind='template: {name:"filelocking-form-tmpl"}'></div>
+    </div>
   </div>
 </script>
 
       </div>
     </div>
 
+
+
     <button id="cache-failure-form-btn-save" data-loading-text="${$.i18n.prop('common.loading')}"
             data-bind="click: save" class="btn">${$.i18n.prop('save')}</button>
 
 
 </script>
 
+
+<script id="filelocking-form-tmpl" type="text/html">
+
+  <form class="well form-horizontal" id="filelocking-form-id">
+
+    <div class="control-group">
+      <label class="control-label" for="skipLocking">${$.i18n.prop('runtime.fileLockConfiguration.skipLocking.label')}</label>
+      <div class="controls">
+        <input type="checkbox" class="xlarge" data-bind="checked: archivaRuntimeConfiguration().fileLockConfiguration().skipLocking"
+               id="skipLocking" name="skipLocking" />
+      </div>
+    </div>
+
+    <div class="control-group">
+      <label class="control-label" for="lockingTimeout">${$.i18n.prop('runtime.fileLockConfiguration.lockingTimeout.label')}</label>
+      <div class="controls">
+        <input type="text" class="xlarge required digits" data-bind="value: archivaRuntimeConfiguration().fileLockConfiguration().lockingTimeout"
+               id="lockingTimeout" name="lockingTimeout" />
+      </div>
+    </div>
+
+    <button id="filelocking-form-btn-save" data-loading-text="${$.i18n.prop('common.loading')}"
+            data-bind="click: save" class="btn">${$.i18n.prop('save')}</button>
+
+  </form>
+
+</script>
+
+
 <script id="system-status-main" type="text/html">
   <div class="page-header">
     <h4>${$.i18n.prop('system-status.header.version.info')}</h4>