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 wrap: on
line diff
--- a/dist/README	Tue Nov 03 03:42:30 2009 +0300
+++ b/dist/README	Tue Nov 03 04:04:45 2009 +0300
@@ -7,7 +7,7 @@
 included in Tomcat which adds the following features:
  - multiple web applications for each user,
  - automatic application deployment,
- - on UNIX access remote user database using getent command.
+ - on UNIX read network user database using getent command.
 
 = Installation =
 
@@ -35,9 +35,20 @@
 
   passwd - path to local passwd file. Default: "/etc/passwd".
 
-  getent - getent command. Local passwd is used if this is not set.
-           Default: not set (null).
+  getent - path to getent program. Local passwd is used if this is not
+           set. Default: not set (null).
 
 HomesUserConfig
 
   homeBase - base directory for user homes. Default: "/home".
+
+= Example = 
+
+<Host name="localhost"  appBase="webapps"
+      unpackWARs="true" autoDeploy="true"
+      xmlValidation="false" xmlNamespaceAware="false"
+      backgroundProcessorDelay="15">
+
+     <Listener className="kryshen.catalina.userconfig.PasswdUserConfig"
+               getent="/usr/bin/getent" appsPerUser="5"/>
+</Host>
--- a/src/kryshen/catalina/userconfig/UserConfig.java	Tue Nov 03 03:42:30 2009 +0300
+++ b/src/kryshen/catalina/userconfig/UserConfig.java	Tue Nov 03 04:04:45 2009 +0300
@@ -142,13 +142,9 @@
     protected void deployUserDirectories(String user, File base, 
             String[] files) {
 
-        int appsNum = files.length;
+        int appCount = 0;
 
-        if (appsNum > appsPerUser) {
-            appsNum = appsPerUser;
-        }
-
-        for (int i = 0; i < appsNum; i++) {
+        for (int i = 0; i < files.length && appCount < appsPerUser; i++) {
             if (files[i].equalsIgnoreCase("META-INF")) {
                 continue;
             }
@@ -164,6 +160,7 @@
             }
 
             deployUserApp(user, dir, files[i]);
+            appCount++;
         }
     }