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 diff
     1.1 --- a/src/kryshen/catalina/startup/HomesUserConfig.java	Mon Nov 02 23:17:40 2009 +0300
     1.2 +++ b/src/kryshen/catalina/startup/HomesUserConfig.java	Mon Nov 02 23:47:14 2009 +0300
     1.3 @@ -47,7 +47,7 @@
     1.4      protected void deployUserApps() {
     1.5          File homeBaseFile = new File(homeBase);
     1.6  
     1.7 -        if (!homeBaseFile.exists() || !homeBaseFile.isDirectory()) {
     1.8 +        if (!homeBaseFile.isDirectory()) {
     1.9              log.error("Invalid home base.");
    1.10              return;
    1.11          }
     2.1 --- a/src/kryshen/catalina/startup/PasswdUserConfig.java	Mon Nov 02 23:17:40 2009 +0300
     2.2 +++ b/src/kryshen/catalina/startup/PasswdUserConfig.java	Mon Nov 02 23:47:14 2009 +0300
     2.3 @@ -72,7 +72,7 @@
     2.4                  in = new BufferedReader(new FileReader(passwd));
     2.5              } else {
     2.6                  Process process = Runtime.getRuntime().exec(
     2.7 -                        getent, new String[]{PASSWD_DATABASE});
     2.8 +                       new String[] {getent, PASSWD_DATABASE});
     2.9  
    2.10                  in = new BufferedReader(
    2.11                          new InputStreamReader(process.getInputStream()));
    2.12 @@ -88,8 +88,8 @@
    2.13                      File home = new File(fields[PASSWD_FIELD_HOME]);
    2.14  
    2.15                      if (!home.isDirectory()) {
    2.16 -                        log.error("Invalid home directory for user"
    2.17 -                                + name + ": " + home.getPath() + ".");
    2.18 +                        //log.warn("Invalid home directory for user "
    2.19 +                        //        + name + ": " + home.getPath() + ".");
    2.20                          continue;
    2.21                      }
    2.22  
     3.1 --- a/src/kryshen/catalina/startup/UserConfig.java	Mon Nov 02 23:17:40 2009 +0300
     3.2 +++ b/src/kryshen/catalina/startup/UserConfig.java	Mon Nov 02 23:47:14 2009 +0300
     3.3 @@ -19,14 +19,19 @@
     3.4      protected UserConfig() {
     3.5          log = LogFactory.getLog(UserConfig.class);
     3.6      }
     3.7 -    
     3.8 +
     3.9 +    /**
    3.10 +     *  Returns the directory name to be searched for webapps for each user
    3.11 +     *  (relative to the user's home direcotry).
    3.12 +     */
    3.13      public String getDirectoryName() {
    3.14          return directoryName;
    3.15      }
    3.16  
    3.17      /**
    3.18 -     * Set the directory name for user web applications.
    3.19 -     *
    3.20 +     *  Set the directory name to be searched for webapps for each user
    3.21 +     *  (relative to the user's home direcotry).
    3.22 +     * 
    3.23       * @param directoryName The new directory name
    3.24       */
    3.25      public void setDirectoryName(String directoryName) {
    3.26 @@ -44,19 +49,26 @@
    3.27                  ("deployApps(String) is not supported.");
    3.28      }
    3.29  
    3.30 +    /**
    3.31 +     * Deploy applications for all available users.
    3.32 +     */
    3.33      protected abstract void deployUserApps();
    3.34  
    3.35 +    /**
    3.36 +     * Deploy applications (if any) for specific user.
    3.37 +     *
    3.38 +     * @param user Username
    3.39 +     * @param home User home directory
    3.40 +     */
    3.41      protected void deployUserApps(String user, File home) {
    3.42          File base = new File(home, directoryName);
    3.43  
    3.44 -        if (!base.exists() || !base.isDirectory() || !base.canRead()) {
    3.45 +        if (!base.isDirectory() || !base.canRead()) {
    3.46              return;
    3.47          }
    3.48  
    3.49 -        // TODO: deployWARs
    3.50 -        // deployWARs(appBase, appBase.list());
    3.51 +        // TODO: deployWars
    3.52  
    3.53 -        // Deploy expanded folders
    3.54          deployDirectories(user, base, base.list());
    3.55      }
    3.56  
    3.57 @@ -66,7 +78,7 @@
    3.58      protected void deployDirectories(String user, File base, String[] files) {
    3.59  
    3.60          if (files == null) {
    3.61 -            log.error("Error reading base directory: " + base.getPath() + ".");
    3.62 +            log.warn("Error reading base directory: " + base.getPath() + ".");
    3.63              return;
    3.64          }
    3.65