本文整理汇总了Java中org.javastack.mapexpression.InvalidExpression类的典型用法代码示例。如果您正苦于以下问题:Java InvalidExpression类的具体用法?Java InvalidExpression怎么用?Java InvalidExpression使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InvalidExpression类属于org.javastack.mapexpression包,在下文中一共展示了InvalidExpression类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSourceDir
import org.javastack.mapexpression.InvalidExpression; //导入依赖的package包/类
private final String getSourceDir() {
if (SOURCE_EXPR != null) {
try {
final StringBuilder sb = new StringBuilder();
SOURCE_EXPR.eval(sb); // Thread-Safe
return sb.toString();
} catch (InvalidExpression e) {
final String exp = SOURCE_EXPR.getExpression();
log.log(Level.WARNING, "Error in eval of " + exp + ": " + e.toString());
}
}
return PROP_SOURCE_DIR_DEF_VALUE;
}
示例2: getSpi
import org.javastack.mapexpression.InvalidExpression; //导入依赖的package包/类
@Override
protected String getSpi(final String key) {
if (globalEvalDisabled || nodeEvalDisabled)
return data.getProperty(key);
try {
return data.getPropertyEval(key);
} catch (InvalidExpression e) {
log.log(Level.WARNING, "Error in eval of " + absolutePath() + "/" + key + ": " + e.toString());
return data.getProperty(key);
}
}
示例3: getPropertyAsPropertiesEval
import org.javastack.mapexpression.InvalidExpression; //导入依赖的package包/类
public StringPropertiesRoot getPropertyAsPropertiesEval(final String key, final char separator)
throws InvalidExpression {
final String value = getPropertyEval(key);
final StringPropertiesRoot p = new StringPropertiesRoot();
p.load(new StringReader(value.replace(separator, '\n')));
return p;
}
示例4: getMultiIndexEval
import org.javastack.mapexpression.InvalidExpression; //导入依赖的package包/类
public List<String> getMultiIndexEval(final int beginIndex) throws InvalidExpression {
final ArrayList<String> list = new ArrayList<String>();
int i = beginIndex;
String p = null;
while ((p = getPropertyEval(Integer.toString(i++))) != null) {
list.add(p);
}
return list;
}
示例5: eval
import org.javastack.mapexpression.InvalidExpression; //导入依赖的package包/类
private final String eval(final String str) throws InvalidExpression {
if (str == null)
return null;
return new MapExpression(str, null, mapper, false).eval().get();
}
示例6: getPropertyEval
import org.javastack.mapexpression.InvalidExpression; //导入依赖的package包/类
public String getPropertyEval(final String key) throws InvalidExpression {
return eval(getProperty(key));
}
示例7: init0
import org.javastack.mapexpression.InvalidExpression; //导入依赖的package包/类
private void init0() throws NoSuchAlgorithmException, InstantiationException, IllegalAccessException,
IOException, InvalidExpression, InvalidDataException, ClassNotFoundException {
// Config Source
final String configSource = System.getProperty(Config.PROP_CONFIG, Config.DEF_CONFIG_FILE);
log.info("ConfigSource: " + configSource);
config = new Config(configSource);
// Storage Directory
final String defStoreDir = getServletContext().getRealPath("/WEB-INF/storage/");
String storeDir = config.get(CFG_STORAGE);
if (storeDir == null) {
storeDir = defStoreDir;
config.put(CFG_STORAGE, storeDir);
}
log.info("StoragePath: " + storeDir);
connectionTimeout = Math.max(config.getInt(CFG_CONN_TIMEOUT, Constants.DEF_CONNECTION_TIMEOUT), 1000);
readTimeout = Math.max(config.getInt(CFG_READ_TIMEOUT, Constants.DEF_READ_TIMEOUT), 1000);
log.info("Timeouts connection=" + connectionTimeout + "ms read=" + readTimeout + "ms");
// Dump Key
dumpKey = config.get(CFG_DUMP_KEY);
if (dumpKey == null) {
dumpKey = generateRandomKey(64);
log.info("Generated random dump.key=" + dumpKey);
writeKey(new File(storeDir, "dump.key"), dumpKey);
}
// Check Flags
checkFlags = CheckType.parseFlags(config.get(CFG_FLAGS, DEF_CHECKS));
checkCacheExpire = (Math.max(config.getInt(CFG_CHECK_CACHE, Constants.DEF_CHECK_CACHE_EXPIRE), 1000) / 1000);
log.info("Check flags=" + checkFlags + " cache=" + checkCacheExpire + "seconds");
// Message Digester
hasher = new Hasher();
// WhiteList Check
if (checkFlags.contains(CheckType.WHITELIST)) {
// WhiteList File
final String defWhiteListFile = "file:///"
+ new File(storeDir, "whitelist.conf").getAbsolutePath();
final String whiteListFile = config.get(CFG_WHITELIST, defWhiteListFile);
log.info("WhiteListFile: " + whiteListFile);
whiteList = new WhiteList(whiteListFile) //
.setConnectionTimeout(connectionTimeout) //
.setReadTimeout(readTimeout);
whiteList.load();
}
// SURBL Check
if (checkFlags.contains(CheckType.SURBL)) {
surbl = new SURBL(storeDir) //
.setConnectionTimeout(connectionTimeout) //
.setReadTimeout(readTimeout);
surbl.load();
}
// Storage
try {
final String defaultClass = PersistentKVStore.class.getName();
final Class<?> clazz = Class.forName(config.get("storage.class", defaultClass));
store = (Persistence) clazz.newInstance();
log.info("Storage class=" + clazz.getName());
store.configure(config.getSubview("storage"));
store.open();
} catch (IOException e) {
closeSilent(store);
throw e;
}
// Check cache
if (!checkFlags.isEmpty()) {
checkCache = new LinkedHashMap<String, Integer>() {
private static final long serialVersionUID = 42L;
@Override
protected boolean removeEldestEntry(final Map.Entry<String, Integer> eldest) {
return size() > 128;
}
};
}
}
示例8: get
import org.javastack.mapexpression.InvalidExpression; //导入依赖的package包/类
public String get(final String key) throws InvalidExpression {
return cfg.getPropertyEval(key);
}
示例9: getInt
import org.javastack.mapexpression.InvalidExpression; //导入依赖的package包/类
public int getInt(final String key, final int def) throws InvalidExpression {
final String value = get(key);
if (value == null)
return def;
return Integer.parseInt(value);
}
示例10: getBoolean
import org.javastack.mapexpression.InvalidExpression; //导入依赖的package包/类
public boolean getBoolean(final String key, final Boolean def) throws InvalidExpression {
final String value = get(key);
if (value == null)
return def;
return Boolean.parseBoolean(value);
}