archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1425052 - in /archiva/trunk/archiva-modules/archiva-web: archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/ archiva-web-common/src/main/java/org/apache/archiva/web/security/ archiva-webapp-js/src/main/webapp...
Date Fri, 21 Dec 2012 17:53:59 GMT
Author: olamy
Date: Fri Dec 21 17:53:59 2012
New Revision: 1425052

URL: http://svn.apache.org/viewvc?rev=1425052&view=rev
Log:
[MRM-1732] dynamic configuration of users cache

Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java
    archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java?rev=1425052&r1=1425051&r2=1425052&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java
Fri Dec 21 17:53:59 2012
@@ -28,6 +28,7 @@ import org.apache.archiva.redback.common
 import org.apache.archiva.redback.common.ldap.connection.LdapConnectionConfiguration;
 import org.apache.archiva.redback.common.ldap.connection.LdapConnectionFactory;
 import org.apache.archiva.redback.common.ldap.connection.LdapException;
+import org.apache.archiva.redback.components.cache.Cache;
 import org.apache.archiva.redback.policy.CookieSettings;
 import org.apache.archiva.redback.policy.PasswordRule;
 import org.apache.archiva.redback.users.UserManager;
@@ -71,6 +72,10 @@ public class DefaultRedbackRuntimeConfig
     @Named(value = "ldapConnectionFactory#configurable")
     private LdapConnectionFactory ldapConnectionFactory;
 
+    @Inject
+    @Named( value = "cache#users" )
+    private Cache usersCache;
+
     public RedbackRuntimeConfiguration getRedbackRuntimeConfiguration()
         throws ArchivaRestServiceException
     {
@@ -131,6 +136,10 @@ public class DefaultRedbackRuntimeConfig
                 authenticator.initialize();
             }
 
+            // users cache
+            usersCache.setTimeToIdleSeconds( redbackRuntimeConfiguration.getUseUsersCacheTimeToIdleSeconds()
);
+            usersCache.setTimeToLiveSeconds( redbackRuntimeConfiguration.getUseUsersCacheTimeToLiveSeconds()
);
+
             return Boolean.TRUE;
         }
         catch ( AuthenticationException e )

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java?rev=1425052&r1=1425051&r2=1425052&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java
Fri Dec 21 17:53:59 2012
@@ -261,6 +261,10 @@ public class ArchivaConfigurableUsersMan
                 user = userManager.getGuestUser();
                 if ( user != null )
                 {
+                    if ( useUsersCache() )
+                    {
+                        usersCache.put( user.getUsername(), user );
+                    }
                     return user;
                 }
             }

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js?rev=1425052&r1=1425051&r2=1425052&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
Fri Dec 21 17:53:59 2012
@@ -1152,7 +1152,7 @@ define("archiva.general-admin",["jquery"
 
 
   RedbackRuntimeConfiguration=function(userManagerImpls,ldapConfiguration,migratedFromRedbackConfiguration,configurationPropertiesEntries
-                                      ,useUsersCache){
+                                      ,useUsersCache,useUsersCacheTimeToIdleSeconds,useUsersCacheTimeToLiveSeconds){
     $.log("new RedbackRuntimeConfiguration");
     var self=this;
     this.modified=ko.observable(false);
@@ -1188,6 +1188,13 @@ define("archiva.general-admin",["jquery"
 
     this.useUsersCache=ko.observable(useUsersCache);
     this.useUsersCache.subscribe(function(newValue){self.modified(true)});
+
+    this.useUsersCacheTimeToIdleSeconds=ko.observable(useUsersCacheTimeToIdleSeconds);
+    this.useUsersCacheTimeToIdleSeconds.subscribe(function(newValue){self.modified(true)});
+
+    this.useUsersCacheTimeToLiveSeconds=ko.observable(useUsersCacheTimeToLiveSeconds);
+    this.useUsersCacheTimeToLiveSeconds.subscribe(function(newValue){self.modified(true)});
+
   }
 
   mapRedbackRuntimeConfiguration=function(data){
@@ -1196,7 +1203,8 @@ define("archiva.general-admin",["jquery"
     $.log("mapLdapConfiguration done for ");
 
     var redbackRuntimeConfiguration =
-            new RedbackRuntimeConfiguration(data.userManagerImpls,ldapConfiguration,data.migratedFromRedbackConfiguration,[],data.useUsersCache);
+            new RedbackRuntimeConfiguration(data.userManagerImpls,ldapConfiguration,data.migratedFromRedbackConfiguration,[]
+                    ,data.useUsersCache,data.useUsersCacheTimeToIdleSeconds,data.useUsersCacheTimeToLiveSeconds);
 
     $.log("mapRedbackRuntimeConfiguration done");
     var configurationPropertiesEntries = data.configurationPropertiesEntries == null ? []:
$.each(data.configurationPropertiesEntries,function(item){

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html?rev=1425052&r1=1425051&r2=1425052&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html
Fri Dec 21 17:53:59 2012
@@ -899,26 +899,13 @@
     <li class="active" id="redback-runtime-general-li"><a href="#redback-runtime-general-content"
data-toggle="tab">${$.i18n.prop('redback.runtime.general.title')}</a></li>
     <li id="redback-runtime-ldap-li"><a href="#redback-runtime-ldap-content" data-toggle="tab">${$.i18n.prop('redback.runtime.ldap.title')}</a></li>
     <li id="redback-runtime-properties-li"><a href="#redback-runtime-properties-content"
data-toggle="tab">${$.i18n.prop('redback.runtime.properties.title')}</a></li>
+    <li id="redback-runtime-users-cache-li"><a href="#redback-runtime-users-cache-content"
data-toggle="tab">${$.i18n.prop('redback.runtime.users.cache.title')}</a></li>
   </ul>
 
   <div class="tab-content">
     <div class="tab-pane active" id="redback-runtime-general-content">
       <div class="well">
         <div class="row-fluid">
-          <form class="form-horizontal" id="redback-runtime-general-form-id">
-            <div class="control-group">
-              <label for="redback-runtime-useUsersCache" class="control-label">
-                ${$.i18n.prop('redback.runtime.useUsersCache.label')}
-              </label>
-              <div class="controls">
-                <input type="checkbox" id="redback-runtime-useUsersCache" name="redback-runtime-useUsersCache"
-                       data-bind="checked: redbackRuntimeConfiguration().useUsersCache"/>
-              </div>
-            </div>
-          </form>
-        </div>
-        <hr/>
-        <div class="row-fluid">
           <div class="span4 dotted">
             <h5>${$.i18n.prop('redback.runtime.user-managers.impls.choosed')}</h5>
             <div style="min-height: 40px" id="user-mananagers-sortables-choosed"
@@ -1034,7 +1021,43 @@
         </table>
         <div id="properties-grid-pagination"></div>
       </div>
-  </div>
+    </div>
+
+    <div class="tab-pane" id="redback-runtime-users-cache-content">
+
+      <div class="well">
+
+
+          <form class="form-horizontal" id="redback-runtime-general-form-id">
+            <div class="control-group">
+              <label for="redback-runtime-useUsersCache" class="control-label">${$.i18n.prop('redback.runtime.useUsersCache.label')}</label>
+              <div class="controls">
+                <input type="checkbox" id="redback-runtime-useUsersCache" name="redback-runtime-useUsersCache"
+                       data-bind="checked: redbackRuntimeConfiguration().useUsersCache"/>
+              </div>
+            </div>
+
+            <div class="control-group">
+              <label class="control-label" for="useUsersCacheTimeToLiveSeconds">${$.i18n.prop('redback.runtime.useUsersCacheTimeToLiveSeconds.label')}</label>
+              <div class="controls">
+                <input type="text" class="xlarge required numeric" data-bind="value: redbackRuntimeConfiguration().useUsersCacheTimeToLiveSeconds"
+                       id="useUsersCacheTimeToLiveSeconds" name="useUsersCacheTimeToLiveSeconds"
/>
+              </div>
+            </div>
+
+            <div class="control-group">
+              <label class="control-label" for="useUsersCacheTimeToIdleSeconds">${$.i18n.prop('redback.runtime.useUsersCacheTimeToIdleSeconds.label')}</label>
+              <div class="controls">
+                <input type="text" class="xlarge required numeric" data-bind="value: redbackRuntimeConfiguration().useUsersCacheTimeToIdleSeconds"
+                       id="useUsersCacheTimeToIdleSeconds" name="useUsersCacheTimeToIdleSeconds"
/>
+              </div>
+            </div>
+
+          </form>
+
+
+      </div>
+    </div>
 
   <div>
     <button data-bind="click: saveRedbackRuntimeConfiguration,css:{ 'btn-warning': redbackRuntimeConfiguration().modified()
| redbackRuntimeConfiguration().ldapConfiguration().modified()  }"



Mime
View raw message