package jp.agentec.sinaburocast.action.common; import jp.agentec.sinaburocast.common.util.PropertyUtil; import org.apache.log4j.Logger; import org.seasar.struts.annotation.Execute; import org.seasar.struts.util.ResponseUtil; /** * プロパティファイルのリロードを行う。 * * * @author tsukada * */ public class PropertyAction { private final Logger logger = Logger.getLogger(getClass()); public String file; public String key; @Execute(validator=false, urlPattern = "reload/{file}") public String reload() { try { PropertyUtil.reloadProperty(file); ResponseUtil.write("OK"); } catch (Exception e) { logger.error("reload property [" + file + "] failed.", e); ResponseUtil.write("NG " + e.toString()); } return null; } @Execute(validator=false, urlPattern = "show/{file}/{key}") public String show() { try { ResponseUtil.write(PropertyUtil.getProperty(file, key, false)); } catch (Exception e) { logger.error("show property [" + file + " : " + key + " ] failed.", e); ResponseUtil.write("NG " + e.toString()); } return null; } }