changeset 19:d3495301ca01

Fix appsPerUser limit.
author Mikhail Kryshen <mikhail@kryshen.net>
date Tue, 03 Nov 2009 04:04:45 +0300
parents 1915c9c69129
children d9b6abd14326
files dist/README src/kryshen/catalina/userconfig/UserConfig.java
diffstat 2 files changed, 17 insertions(+), 9 deletions(-) [+]
line diff
     1.1 --- a/dist/README	Tue Nov 03 03:42:30 2009 +0300
     1.2 +++ b/dist/README	Tue Nov 03 04:04:45 2009 +0300
     1.3 @@ -7,7 +7,7 @@
     1.4  included in Tomcat which adds the following features:
     1.5   - multiple web applications for each user,
     1.6   - automatic application deployment,
     1.7 - - on UNIX access remote user database using getent command.
     1.8 + - on UNIX read network user database using getent command.
     1.9  
    1.10  = Installation =
    1.11  
    1.12 @@ -35,9 +35,20 @@
    1.13  
    1.14    passwd - path to local passwd file. Default: "/etc/passwd".
    1.15  
    1.16 -  getent - getent command. Local passwd is used if this is not set.
    1.17 -           Default: not set (null).
    1.18 +  getent - path to getent program. Local passwd is used if this is not
    1.19 +           set. Default: not set (null).
    1.20  
    1.21  HomesUserConfig
    1.22  
    1.23    homeBase - base directory for user homes. Default: "/home".
    1.24 +
    1.25 += Example = 
    1.26 +
    1.27 +<Host name="localhost"  appBase="webapps"
    1.28 +      unpackWARs="true" autoDeploy="true"
    1.29 +      xmlValidation="false" xmlNamespaceAware="false"
    1.30 +      backgroundProcessorDelay="15">
    1.31 +
    1.32 +     <Listener className="kryshen.catalina.userconfig.PasswdUserConfig"
    1.33 +               getent="/usr/bin/getent" appsPerUser="5"/>
    1.34 +</Host>
     2.1 --- a/src/kryshen/catalina/userconfig/UserConfig.java	Tue Nov 03 03:42:30 2009 +0300
     2.2 +++ b/src/kryshen/catalina/userconfig/UserConfig.java	Tue Nov 03 04:04:45 2009 +0300
     2.3 @@ -142,13 +142,9 @@
     2.4      protected void deployUserDirectories(String user, File base, 
     2.5              String[] files) {
     2.6  
     2.7 -        int appsNum = files.length;
     2.8 +        int appCount = 0;
     2.9  
    2.10 -        if (appsNum > appsPerUser) {
    2.11 -            appsNum = appsPerUser;
    2.12 -        }
    2.13 -
    2.14 -        for (int i = 0; i < appsNum; i++) {
    2.15 +        for (int i = 0; i < files.length && appCount < appsPerUser; i++) {
    2.16              if (files[i].equalsIgnoreCase("META-INF")) {
    2.17                  continue;
    2.18              }
    2.19 @@ -164,6 +160,7 @@
    2.20              }
    2.21  
    2.22              deployUserApp(user, dir, files[i]);
    2.23 +            appCount++;
    2.24          }
    2.25      }
    2.26