Fields Summary |
---|
public static final String | GENERIC_PROPERTY_OVERRIDE_PREFIX |
public static final String | DEFAULT_META_DATA_OUT_FILE |
public static final Boolean | DEFAULT_META_DATA_OUT_MERGE |
public static final String | PREFIX_META_DATA |
public static final String | PROPERTY_META_DATA_OUT_FILE |
public static final String | PROPERTY_META_DATA_OUT_MERGE |
public static final String | DEFAULT_COVERAGE_DATA_OUT_FILE |
public static final Boolean | DEFAULT_COVERAGE_DATA_OUT_MERGE |
public static final String | PREFIX_COVERAGE_DATA |
public static final String | PROPERTY_COVERAGE_DATA_OUT_FILE |
public static final String | PROPERTY_COVERAGE_DATA_OUT_MERGE |
public static final String | DEFAULT_SESSION_DATA_OUT_FILE |
public static final Boolean | DEFAULT_SESSION_DATA_OUT_MERGE |
public static final String | PREFIX_SESSION_DATA |
public static final String | PROPERTY_SESSION_DATA_OUT_FILE |
public static final String | PROPERTY_SESSION_DATA_OUT_MERGE |
public static final String | PROPERTY_TEMP_FILE_EXT |
public static final Map | SYSTEM_PROPERTY_REDIRECTS |
private static long | s_timestamp |
private static final Map | s_properties |
Methods Summary |
---|
public static synchronized com.vladium.util.IProperties | getAppProperties()Retrieves application properties as classloader resource with a given name.
[as seen from ClassLoaderResolver.getClassLoader ()]. The result is cached
using this loader as a weak key.
final ClassLoader loader = ClassLoaderResolver.getClassLoader ();
return getAppProperties (loader);
|
public static synchronized com.vladium.util.IProperties | getAppProperties(java.lang.ClassLoader loader)
IProperties properties = (IProperties) s_properties.get (loader);
if (properties != null)
return properties;
else
{
final String appName = IAppConstants.APP_NAME_LC;
// note: this does not use Property.getAppProperties() by design,
// because that mechanism is not property alias-capable
final IProperties systemRedirects = wrap (Property.getSystemPropertyRedirects (EMMAProperties.SYSTEM_PROPERTY_REDIRECTS));
final IProperties appDefaults = wrap (Property.getProperties (appName + "_default.properties", loader));
final IProperties systemFile;
{
final String fileName = Property.getSystemProperty (appName + ".properties");
final File file = fileName != null
? new File (fileName)
: null;
systemFile = wrap (Property.getLazyPropertiesFromFile (file));
}
final IProperties system = wrap (Property.getSystemProperties (appName));
final IProperties userOverrides = wrap (Property.getProperties (appName + ".properties", loader));
// "vertical" inheritance order:
// (1) user overrides ("emma.properties" classloader resource)
// (2) system properties (java.lang.System.getProperties(),
// filtered by the app prefix)
// (3) system file properties ("emma.properties" system property,
// interpreted as a property file)
// (4) app defaults ("emma_default.properties" classloader resource)
// (5) system property redirects (report.out.encoding->file.encoding,
// report.out.dir->user.dir, etc)
properties = IProperties.Factory.combine (userOverrides,
IProperties.Factory.combine (system,
IProperties.Factory.combine (systemFile,
IProperties.Factory.combine (appDefaults,
systemRedirects))));
s_properties.put (loader, properties);
return properties;
}
|
public static synchronized long | getTimeStamp()Global method used to create an appearance that all app work has been
done at the same point in time (useful for setting archive and report
timestamps etc). // set in <clinit>
long result = s_timestamp;
if (result == 0)
{
s_timestamp = result = System.currentTimeMillis ();
}
return result;
|
public static java.lang.String | makeAppVersion(int major, int minor, int build)
final StringBuffer buf = new StringBuffer ();
buf.append (major);
buf.append ('.");
buf.append (minor);
buf.append ('.");
buf.append (build);
return buf.toString ();
|
public static com.vladium.util.IProperties | wrap(java.util.Properties properties)Wraps a Properties into a IProperties with the app's standard property
mapping in place.
if (properties == null) return null;
return IProperties.Factory.wrap (properties, ReportProperties.REPORT_PROPERTY_MAPPER);
|