/** * @param theName the key name of the configuration parameter * @return the overridden value if override is set, null otherwise */ public static <T> T getOverride(final String theName) { return (T) ApplicationProperties.getProperty(theName); }
/** * @param theName the key name of the configuration parameter * @return the overridden value if override is set, null otherwise */ public static <T> T getOverride(final String theName) { return (T) ApplicationProperties.getProperty(theName); }
/** * Looks up for a named string property in the order defined by {@link #getProperty(String, * ApplicationContext)} using the internally cached spring application context. * * <p>Care should be taken when using this method. It should not be called during startup or * from tests cases as the internal context will not have been set. * * @param propertyName The property name to lookup. * @return The property value, or null if not found */ public static String getProperty(String propertyName) { return getProperty(propertyName, context); }
/** * Looks up for a named string property in the order defined by * {@link #getProperty(String, ApplicationContext)} using the internally cached spring * application context. * <p> * Care should be taken when using this method. It should not be called during startup or from * tests cases as the internal context will not have been set. * </p> * @param propertyName The property name to lookup. * * @return The property value, or null if not found */ public static String getProperty(String propertyName) { return getProperty(propertyName, context); }
public static final File getTempDir() { String tempPath = (ApplicationProperties.getProperty(WebUtils.TEMP_DIR_CONTEXT_ATTRIBUTE) != null ? ApplicationProperties.getProperty(WebUtils.TEMP_DIR_CONTEXT_ATTRIBUTE) : System.getProperty("java.io.tmpdir")); if (tempPath == null) { return null; } File tempDir = new File(tempPath); if (tempDir.exists() == false) return null; if (tempDir.isDirectory() == false) return null; if (tempDir.canWrite() == false) return null; return tempDir; } }
/** * Looks up for a named string property into the following contexts (in order): * <ul> * <li>System Property</li> * <li>web.xml init parameters (only works if the context is a {@link WebApplicationContext}</li> * <li>Environment variable</li> * </ul> * and returns the first non null, non empty value found. * @param propertyName The property name to be searched * @param context The Spring context (may be null) * @return The property value, or null if not found */ public static String getProperty(String propertyName, ApplicationContext context) { if (context instanceof WebApplicationContext) { return getProperty(propertyName, ((WebApplicationContext) context).getServletContext()); } else { return getProperty(propertyName, (ServletContext) null); } }
public final static File getTempDir() { String tempPath = ApplicationProperties.getProperty(WebUtils.TEMP_DIR_CONTEXT_ATTRIBUTE); if (tempPath == null) { return null; } File tempDir = new File(tempPath); if (tempDir.exists() == false) return null; if (tempDir.isDirectory() == false) return null; if (tempDir.canWrite() == false) return null; return tempDir; } }
/** * Looks up for a named string property into the following contexts (in order): * * <ul> * <li>System Property * <li>web.xml init parameters (only works if the context is a {@link WebApplicationContext} * <li>Environment variable * </ul> * * and returns the first non null, non empty value found. * * @param propertyName The property name to be searched * @param context The Spring context (may be null) * @return The property value, or null if not found */ public static String getProperty(String propertyName, ApplicationContext context) { if (context instanceof WebApplicationContext) { return getProperty(propertyName, ((WebApplicationContext) context).getServletContext()); } else { return getProperty(propertyName, (ServletContext) null); } }