changeset 11:3a71cbe721f9

Fixed PasswdUserConfig. Better error logging.
author Mikhail Kryshen <mikhail@kryshen.net>
date Mon, 02 Nov 2009 23:47:14 +0300
parents 086a55aa2620
children 2f82b0faeb89
files src/kryshen/catalina/startup/HomesUserConfig.java src/kryshen/catalina/startup/PasswdUserConfig.java src/kryshen/catalina/startup/UserConfig.java
diffstat 3 files changed, 24 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/kryshen/catalina/startup/HomesUserConfig.java	Mon Nov 02 23:17:40 2009 +0300
+++ b/src/kryshen/catalina/startup/HomesUserConfig.java	Mon Nov 02 23:47:14 2009 +0300
@@ -47,7 +47,7 @@
     protected void deployUserApps() {
         File homeBaseFile = new File(homeBase);
 
-        if (!homeBaseFile.exists() || !homeBaseFile.isDirectory()) {
+        if (!homeBaseFile.isDirectory()) {
             log.error("Invalid home base.");
             return;
         }
--- a/src/kryshen/catalina/startup/PasswdUserConfig.java	Mon Nov 02 23:17:40 2009 +0300
+++ b/src/kryshen/catalina/startup/PasswdUserConfig.java	Mon Nov 02 23:47:14 2009 +0300
@@ -72,7 +72,7 @@
                 in = new BufferedReader(new FileReader(passwd));
             } else {
                 Process process = Runtime.getRuntime().exec(
-                        getent, new String[]{PASSWD_DATABASE});
+                       new String[] {getent, PASSWD_DATABASE});
 
                 in = new BufferedReader(
                         new InputStreamReader(process.getInputStream()));
@@ -88,8 +88,8 @@
                     File home = new File(fields[PASSWD_FIELD_HOME]);
 
                     if (!home.isDirectory()) {
-                        log.error("Invalid home directory for user"
-                                + name + ": " + home.getPath() + ".");
+                        //log.warn("Invalid home directory for user "
+                        //        + name + ": " + home.getPath() + ".");
                         continue;
                     }
 
--- a/src/kryshen/catalina/startup/UserConfig.java	Mon Nov 02 23:17:40 2009 +0300
+++ b/src/kryshen/catalina/startup/UserConfig.java	Mon Nov 02 23:47:14 2009 +0300
@@ -19,14 +19,19 @@
     protected UserConfig() {
         log = LogFactory.getLog(UserConfig.class);
     }
-    
+
+    /**
+     *  Returns the directory name to be searched for webapps for each user
+     *  (relative to the user's home direcotry).
+     */
     public String getDirectoryName() {
         return directoryName;
     }
 
     /**
-     * Set the directory name for user web applications.
-     *
+     *  Set the directory name to be searched for webapps for each user
+     *  (relative to the user's home direcotry).
+     * 
      * @param directoryName The new directory name
      */
     public void setDirectoryName(String directoryName) {
@@ -44,19 +49,26 @@
                 ("deployApps(String) is not supported.");
     }
 
+    /**
+     * Deploy applications for all available users.
+     */
     protected abstract void deployUserApps();
 
+    /**
+     * Deploy applications (if any) for specific user.
+     *
+     * @param user Username
+     * @param home User home directory
+     */
     protected void deployUserApps(String user, File home) {
         File base = new File(home, directoryName);
 
-        if (!base.exists() || !base.isDirectory() || !base.canRead()) {
+        if (!base.isDirectory() || !base.canRead()) {
             return;
         }
 
-        // TODO: deployWARs
-        // deployWARs(appBase, appBase.list());
+        // TODO: deployWars
 
-        // Deploy expanded folders
         deployDirectories(user, base, base.list());
     }
 
@@ -66,7 +78,7 @@
     protected void deployDirectories(String user, File base, String[] files) {
 
         if (files == null) {
-            log.error("Error reading base directory: " + base.getPath() + ".");
+            log.warn("Error reading base directory: " + base.getPath() + ".");
             return;
         }