Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#657 Change Environment key on appconfig.xml #752

Merged
merged 1 commit into from
Jun 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.support.project.common.log.LogFactory;
import org.support.project.common.util.PropertyUtil;
import org.support.project.knowledge.config.AppConfig;
import org.support.project.knowledge.config.SystemConfig;
import org.support.project.web.logic.DBConnenctionLogic;

public abstract class AbstractBat {
Expand All @@ -27,11 +26,11 @@ protected static void configInit(String batName) {
TimeZone zone = TimeZone.getTimeZone("GMT");
TimeZone.setDefault(zone);

AppConfig.initEnvKey(SystemConfig.KNOWLEDGE_ENV_KEY);
String envValue = System.getenv(SystemConfig.KNOWLEDGE_ENV_KEY);
AppConfig.get();
String envValue = System.getenv(AppConfig.getEnvKey());
LOG.info(batName + " is start.");
if (LOG.isDebugEnabled()) {
LOG.debug("Env [" + SystemConfig.KNOWLEDGE_ENV_KEY + "] is [" + envValue + "].");
LOG.debug("Env [" + AppConfig.getEnvKey() + "] is [" + envValue + "].");
LOG.debug("Config :" + PropertyUtil.reflectionToString(AppConfig.get()));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class SystemConfig {
/** ログ */
private static final Log LOG = LogFactory.getLog(SystemConfig.class);

public static final String KNOWLEDGE_ENV_KEY = "KNOWLEDGE_HOME";
//public static final String KNOWLEDGE_ENV_KEY = "KNOWLEDGE_HOME";

/** システム設定情報 */
private static ServiceConfigsEntity serviceConfigsEntity = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.support.project.knowledge.bat.NotifyMailBat;
import org.support.project.knowledge.bat.WebhookBat;
import org.support.project.knowledge.config.AppConfig;
import org.support.project.knowledge.config.SystemConfig;

public class CronListener implements ServletContextListener {

Expand All @@ -39,7 +38,8 @@ public class CronListener implements ServletContextListener {
public void contextInitialized(final ServletContextEvent sce) {
String logsPath = AppConfig.get().getLogsPath();
File logDir = new File(logsPath);
String envValue = System.getenv(SystemConfig.KNOWLEDGE_ENV_KEY);
AppConfig.get();
String envValue = System.getenv(AppConfig.getEnvKey());

service = new ScheduledThreadPoolExecutor(1);
fileClearfuture = service.scheduleAtFixedRate(new Runnable() {
Expand All @@ -54,7 +54,7 @@ public void run() {
job.setMainClass(KnowledgeFileClearBat.class.getName());
job.setXmx(256);
if (StringUtils.isNotEmpty(envValue)) {
job.addEnvironment(SystemConfig.KNOWLEDGE_ENV_KEY, envValue);
job.addEnvironment(AppConfig.getEnvKey(), envValue);
}
try {
JobResult result = job.execute();
Expand Down Expand Up @@ -82,7 +82,7 @@ public void run() {
job.setMainClass(FileParseBat.class.getName());
job.setXmx(1024);
if (StringUtils.isNotEmpty(envValue)) {
job.addEnvironment(SystemConfig.KNOWLEDGE_ENV_KEY, envValue);
job.addEnvironment(AppConfig.getEnvKey(), envValue);
}
try {
JobResult result = job.execute();
Expand Down Expand Up @@ -110,7 +110,7 @@ public void run() {
job.setMainClass(MailSendBat.class.getName());
job.setXmx(256);
if (StringUtils.isNotEmpty(envValue)) {
job.addEnvironment(SystemConfig.KNOWLEDGE_ENV_KEY, envValue);
job.addEnvironment(AppConfig.getEnvKey(), envValue);
}
try {
JobResult result = job.execute();
Expand Down Expand Up @@ -138,7 +138,7 @@ public void run() {
job.setMainClass(WebhookBat.class.getName());
job.setXmx(256);
if (StringUtils.isNotEmpty(envValue)) {
job.addEnvironment(SystemConfig.KNOWLEDGE_ENV_KEY, envValue);
job.addEnvironment(AppConfig.getEnvKey(), envValue);
}
try {
JobResult result = job.execute();
Expand Down Expand Up @@ -166,7 +166,7 @@ public void run() {
job.setMainClass(MailReadBat.class.getName());
job.setXmx(256);
if (StringUtils.isNotEmpty(envValue)) {
job.addEnvironment(SystemConfig.KNOWLEDGE_ENV_KEY, envValue);
job.addEnvironment(AppConfig.getEnvKey(), envValue);
}
try {
JobResult result = job.execute();
Expand All @@ -193,7 +193,7 @@ public void run() {
job.addClassPathDir(new File(sce.getServletContext().getRealPath("/WEB-INF/classes")));
job.setMainClass(NotifyMailBat.class.getName());
if (StringUtils.isNotEmpty(envValue)) {
job.addEnvironment(SystemConfig.KNOWLEDGE_ENV_KEY, envValue);
job.addEnvironment(AppConfig.getEnvKey(), envValue);
}
try {
JobResult result = job.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public class GlobalInitializationListener implements ServletContextListener {

@Override
public void contextInitialized(ServletContextEvent config) {
AppConfig.initEnvKey(SystemConfig.KNOWLEDGE_ENV_KEY);
String envValue = System.getenv(SystemConfig.KNOWLEDGE_ENV_KEY);
AppConfig.get();
String envValue = System.getenv(AppConfig.getEnvKey());
if (StringUtils.isNotEmpty(envValue)) {
LOG.info("Env [" + SystemConfig.KNOWLEDGE_ENV_KEY + "] is [" + envValue + "].");
LOG.info("Env [" + AppConfig.getEnvKey() + "] is [" + envValue + "].");
}
String rootPath = AppConfig.get().getBasePath();
System.setProperty("user.dir", rootPath);
Expand Down