19 package org.turro.indicator;
21 import java.io.FileInputStream;
22 import java.io.FileOutputStream;
23 import java.io.IOException;
24 import java.util.Properties;
25 import java.util.logging.Level;
26 import java.util.logging.Logger;
27 import org.turro.elephant.context.ElephantContext;
28 import org.turro.file.FileWatch;
42 public String
getFormula(Class javaClass, String defaultValue) {
43 return getFormula(javaClass.getSimpleName(), defaultValue);
47 return getProperty(classContext);
50 public String
getFormula(String classContext, String defaultValue) {
51 return getProperty(classContext, defaultValue);
54 public void setFormula(String classContext, String value) {
55 setProperty(classContext, value);
65 public String
getFormulaAttr(Class javaClass, String attribute, String defaultValue) {
66 return getFormulaAttr(javaClass.getSimpleName(), attribute, defaultValue);
70 return getProperty(createProperty(classContext, attribute));
73 public String
getFormulaAttr(String classContext, String attribute, String defaultValue) {
74 return getProperty(createProperty(classContext, attribute), defaultValue);
79 private String createProperty(String classContext, String attribute) {
80 return classContext +
"#" + attribute;
85 private static final String formulaFile =
"/WEB-INF/elephant/conf/formula-context.properties";
87 private static Formulas _formulas;
88 private static long _lastLoad;
97 }
catch (IOException ex) {
108 private static void store() {
110 _formulas.store(fos,
null);
111 }
catch (IOException ex) {
112 Logger.getLogger(Formulas.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
static String getRealPath(String path)
static String logMsg(String msg)