Mercurial > hg > tomcat-userconfig
view src/kryshen/catalina/startup/HomesUserConfig.java @ 16:283527b97f1e
Add LICENSE.
author | Mikhail Kryshen <mikhail@kryshen.net> |
---|---|
date | Tue, 03 Nov 2009 03:02:57 +0300 |
parents | 618d0df5d46c |
children | 012d66bbc61f |
line wrap: on
line source
/* * Copyright 2009 Mikhail Kryshen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package kryshen.catalina.startup; import java.io.File; import org.apache.juli.logging.LogFactory; /** * Event listener for Host that deploys and updates applications * provided by users. Files in the specified base directory are * considered tp be user home directories. * * @author Mikhail Kryshen */ public class HomesUserConfig extends UserConfig { /** * 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.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); } } }