view src/kryshen/catalina/startup/HomesUserConfig.java @ 12:2f82b0faeb89

Javadoc.
author Mikhail Kryshen <mikhail@kryshen.net>
date Tue, 03 Nov 2009 00:36:43 +0300
parents 3a71cbe721f9
children 618d0df5d46c
line source
1 /*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
6 package kryshen.catalina.startup;
8 import java.io.File;
9 import org.apache.juli.logging.LogFactory;
11 /**
12 * Event listener for Host that deploys and updates applications
13 * provided by users. Files in the specified base directory are
14 * considered tp be user home directories.
15 *
16 * @author Mikhail Kryshen
17 */
18 public class HomesUserConfig extends UserConfig {
20 /**
21 * The base directory containing user home directories.
22 */
23 private String homeBase = null;
26 public HomesUserConfig() {
27 log = LogFactory.getLog(HomesUserConfig.class);
28 }
30 /**
31 * Return the base directory containing user home directories.
32 */
33 public String getHomeBase() {
34 return homeBase;
35 }
37 /**
38 * Set the base directory containing user home directories.
39 *
40 * @param homeBase The new base directory
41 */
42 public void setHomeBase(String homeBase) {
43 this.homeBase = homeBase;
44 }
46 @Override
47 protected void deployUserApps() {
48 File homeBaseFile = new File(homeBase);
50 if (!homeBaseFile.isDirectory()) {
51 log.error("Invalid home base.");
52 return;
53 }
55 String[] homes = homeBaseFile.list();
57 for (String name : homes) {
58 File home = new File(homeBaseFile, name);
60 if (!home.isDirectory() /* || !home.canExecute() */) {
61 continue;
62 }
64 deployUserApps(name, home);
65 }
66 }
67 }