view src/kryshen/catalina/startup/HomesUserConfig.java @ 10:086a55aa2620

PasswdUserConfig. Error logging.
author Mikhail Kryshen <mikhail@kryshen.net>
date Mon, 02 Nov 2009 23:17:40 +0300
parents ff1e55a2171f
children 3a71cbe721f9
line wrap: on
line source

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package kryshen.catalina.startup;

import java.io.File;
import org.apache.juli.logging.LogFactory;

/**
 *
 * @author Mikhail Kryshen
 */
public class HomesUserConfig extends UserConfig {

    protected static org.apache.juli.logging.Log log =
            org.apache.juli.logging.LogFactory.getLog(HomesUserConfig.class);

    /**
     * The base directory containing user home directories.
     */
    private String homeBase = null;


    public HomesUserConfig() {
        log = LogFactory.getLog(HomesUserConfig.class);
    }

    /**
     * Return the base directory containing user home directories.
     */
    public String getHomeBase() {
        return homeBase;
    }

    /**
     * Set the base directory containing user home directories.
     *
     * @param homeBase The new base directory
     */
    public void setHomeBase(String homeBase) {
        this.homeBase = homeBase;
    }

    @Override
    protected void deployUserApps() {
        File homeBaseFile = new File(homeBase);

        if (!homeBaseFile.exists() || !homeBaseFile.isDirectory()) {
            log.error("Invalid home base.");
            return;
        }

        String[] homes = homeBaseFile.list();

        for (String name : homes) {
            File home = new File(homeBaseFile, name);
            
            if (!home.isDirectory() /* || !home.canExecute() */) {
                continue;
            }

            deployUserApps(name, home);
        }
    }
}