fix #2547 pass values to jobs

This commit is contained in:
Shinsuke Sugaya 2021-03-12 22:24:42 +09:00
parent 3d07c2b782
commit 9a90d5617f
6 changed files with 21 additions and 3 deletions

View file

@ -448,6 +448,8 @@ public class Constants extends CoreLibConstants {
public static final String SYSTEM_PROP_PREFIX = "fess.system.";
public static final String FESS_CONFIG_PREFIX = "fess.config.";
public static final String XERCES_FEATURE_PREFIX = "http://apache.org/xml/features/";
public static final String LOAD_EXTERNAL_DTD_FEATURE = "nonvalidating/load-external-dtd";

View file

@ -264,6 +264,8 @@ public class CrawlJob extends ExecJob {
cmdList.add("-Dlasta.env=" + getExecuteType());
}
addFessConfigProperties(cmdList);
addFessSystemProperties(cmdList);
addSystemProperty(cmdList, Constants.FESS_CONF_PATH, null, null);
cmdList.add("-Dfess." + getExecuteType() + ".process=true");
cmdList.add("-Dfess.log.path=" + (logFilePath != null ? logFilePath : systemHelper.getLogFilePath()));

View file

@ -138,6 +138,16 @@ public abstract class ExecJob {
}
}
protected void addFessConfigProperties(final List<String> cmdList) {
System.getProperties().keySet().stream().filter(k -> k != null && k.toString().startsWith(Constants.FESS_CONFIG_PREFIX))
.forEach(k -> addSystemProperty(cmdList, k.toString(), null, null));
}
protected void addFessSystemProperties(final List<String> cmdList) {
System.getProperties().keySet().stream().filter(k -> k != null && k.toString().startsWith(Constants.SYSTEM_PROP_PREFIX))
.forEach(k -> addSystemProperty(cmdList, k.toString(), null, null));
}
protected void deleteTempDir(final File ownTmpDir) {
if (ownTmpDir == null) {
return;

View file

@ -161,6 +161,8 @@ public class GenerateThumbnailJob extends ExecJob {
cmdList.add("-Dlasta.env=" + getExecuteType());
}
addFessConfigProperties(cmdList);
addFessSystemProperties(cmdList);
addSystemProperty(cmdList, Constants.FESS_CONF_PATH, null, null);
cmdList.add("-Dfess." + getExecuteType() + ".process=true");
if (logFilePath == null) {

View file

@ -148,6 +148,8 @@ public class SuggestJob extends ExecJob {
cmdList.add("-Dlasta.env=" + getExecuteType());
}
addFessConfigProperties(cmdList);
addFessSystemProperties(cmdList);
addSystemProperty(cmdList, Constants.FESS_CONF_PATH, null, null);
cmdList.add("-Dfess." + getExecuteType() + ".process=true");
if (logFilePath == null) {

View file

@ -17,6 +17,7 @@ package org.codelibs.fess.mylasta.direction;
import java.util.concurrent.ExecutionException;
import org.codelibs.fess.Constants;
import org.dbflute.helper.jprop.ObjectiveProperties;
import org.lastaflute.core.direction.PropertyFilter;
@ -27,8 +28,6 @@ public class FessConfigImpl extends FessConfig.SimpleImpl {
private static final long serialVersionUID = 1L;
private static final String FESS_CONFIG = "fess.config.";
@Override
protected ObjectiveProperties newObjectiveProperties(final String resourcePath, final PropertyFilter propertyFilter) {
return new ObjectiveProperties(resourcePath) { // for e.g. checking existence and filtering value
@ -44,7 +43,8 @@ public class FessConfigImpl extends FessConfig.SimpleImpl {
private String getFromCache(final String propertyKey) {
try {
return cache.get(propertyKey, () -> System.getProperty(FESS_CONFIG + propertyKey, super.get(propertyKey)));
return cache.get(propertyKey,
() -> System.getProperty(Constants.FESS_CONFIG_PREFIX + propertyKey, super.get(propertyKey)));
} catch (final ExecutionException e) {
return super.get(propertyKey);
}