view src/kryshen/catalina/startup/HomesUserConfig.java @ 8:ff1e55a2171f

Refactored.
author Mikhail Kryshen <mikhail@kryshen.net>
date Sun, 01 Nov 2009 05:41:39 +0300
parents
children 086a55aa2620
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;
10 /**
11 *
12 * @author Mikhail Kryshen
13 */
14 public class HomesUserConfig extends UserConfig {
16 /**
17 * The directory name to be searched for within each user home directory.
18 */
19 private String directoryName = "public_webapps";
20 /**
21 * The base directory containing user home directories.
22 */
23 private String homeBase = null;
25 public String getDirectoryName() {
26 return directoryName;
27 }
29 /**
30 * Set the directory name for user web applications.
31 *
32 * @param directoryName The new directory name
33 */
34 public void setDirectoryName(String directoryName) {
35 this.directoryName = directoryName;
36 }
38 /**
39 * Return the base directory containing user home directories.
40 */
41 public String getHomeBase() {
42 return homeBase;
43 }
45 /**
46 * Set the base directory containing user home directories.
47 *
48 * @param homeBase The new base directory
49 */
50 public void setHomeBase(String homeBase) {
51 this.homeBase = homeBase;
52 }
54 @Override
55 protected void deployUserApps() {
56 File homeBaseFile = new File(homeBase);
58 if (!homeBaseFile.exists() || !homeBaseFile.isDirectory()) {
59 host.getLogger().error("Invalid home base.");
60 return;
61 }
63 String[] homes = homeBaseFile.list();
65 for (String name : homes) {
66 File home = new File(homeBaseFile, name);
68 if (!home.isDirectory() /* || !home.canExecute() */) {
69 continue;
70 }
72 File base = new File(home, directoryName);
73 deployUserApps(name, base);
74 }
75 }
76 }