/** * Get value for property bound to the current thread context class loader. * * @param propertyName property name. * @return property value if found, otherwise default. */ public static String getProperty(String propertyName) { return ManagedProperties.getProperty(propertyName); }
public static Enumeration propertyNames() { return ManagedProperties.propertyNames(); }
/** * Set property values for <code>Properties</code> bound to the * current thread context class loader. * * @param newProperties name/value pairs to be bound */ public static void setProperties(Map<?, ?> newProperties) { setProperties(newProperties, false); }
/** * Get value for property bound to the current thread context class loader. * If not found, then return default. * * @param propertyName property name. * @param dephault default value. * @return property value if found, otherwise default. */ public static String getProperty(String propertyName, String dephault) { return getProperty(getThreadContextClassLoader(), propertyName, dephault); }
/** * Set value for property bound to the current thread context class loader. * @param propertyName property name * @param value property value (non-default) If null, remove the property. */ public static void setProperty(String propertyName, String value) { setProperty(propertyName, value, false); }
/** * This is an expensive operation. * ON EACH CALL it walks through all property lists * associated with the current context class loader upto * and including the bootstrap class loader. * * @return Returns a <code>java.util.Properties</code> instance * that is equivalent to the current state of the scoped * properties, in that getProperty() will return the same value. * However, this is a copy, so setProperty on the * returned value will not effect the scoped properties. */ public static Properties getProperties() { Properties p = new Properties(); Enumeration<String> names = propertyNames(); while (names.hasMoreElements()) { String name = names.nextElement(); p.put(name, getProperty(name)); } return p; }
/** * This is an expensive operation. * * @return Returns a <code>java.util.Properties</code> instance * that is equivalent to the current state of the scoped * properties, in that getProperty() will return the same value. * However, this is a copy, so setProperty on the * returned value will not effect the scoped properties. */ public static Properties getProperties() { return ManagedProperties.getProperties(); }
/** * Return list of all property names. This is an expensive * operation: ON EACH CALL it walks through all property lists * associated with the current context class loader upto * and including the bootstrap class loader. * * @return The list of all property names */ public static Enumeration<String> propertyNames() { Map<String, Value> allProps = new Hashtable<String, Value>(); ClassLoader classLoader = getThreadContextClassLoader(); /** * Order doesn't matter, we are only going to use * the set of all keys... */ while (true) { Map<String, Value> properties = null; synchronized (propertiesCache) { properties = propertiesCache.get(classLoader); } if (properties != null) { allProps.putAll(properties); } if (classLoader == null) { break; } classLoader = getParent(classLoader); } return Collections.enumeration(allProps.keySet()); }
value = getValueProperty(getParent(classLoader), propertyName);
/** * Set value for property bound to the current thread context class loader. * @param propertyName property name * @param value property value. If null, remove the property. * @param isDefault determines if property is default or not. * A non-default property cannot be overriden. * A default property can be overriden by a property * (default or non-default) of the same name bound to * a decendent class loader. */ public static void setProperty(String propertyName, String value, boolean isDefault) { if (propertyName != null) { synchronized (propertiesCache) { ClassLoader classLoader = getThreadContextClassLoader(); Map<String, Value> properties = propertiesCache.get(classLoader); if (value == null) { if (properties != null) { properties.remove(propertyName); } } else { if (properties == null) { properties = new HashMap<String, Value>(); propertiesCache.put(classLoader, properties); } properties.put(propertyName, new Value(value, isDefault)); } } } }
/** * Set value for property bound to the current thread context class loader. * @param propertyName property name * @param value property value (non-default) If null, remove the property. */ public static void setProperty(String propertyName, String value) { ManagedProperties.setProperty(propertyName, value); }
/** * Get value for property bound to the current thread context class loader. * * @param propertyName property name. * @return property value if found, otherwise default. */ public static String getProperty(String propertyName) { return getProperty(getThreadContextClassLoader(), propertyName); }
/** * This is an expensive operation. * * @return Returns a <code>java.util.Properties</code> instance * that is equivalent to the current state of the scoped * properties, in that getProperty() will return the same value. * However, this is a copy, so setProperty on the * returned value will not effect the scoped properties. */ public static Properties getProperties() { return ManagedProperties.getProperties(); }
/** * Get value for property bound to the current thread context class loader. * If not found, then return default. * * @param propertyName property name. * @param dephault default value. * @return property value if found, otherwise default. */ public static String getProperty(String propertyName, String dephault) { return ManagedProperties.getProperty(propertyName, dephault); }
/** * Set value for property bound to the current thread context class loader. * @param propertyName property name * @param value property value (non-default) If null, remove the property. */ public static void setProperty(String propertyName, String value) { ManagedProperties.setProperty(propertyName, value); }
/** * Set property values for <code>Properties</code> bound to the * current thread context class loader. * * @param newProperties name/value pairs to be bound */ public static void setProperties(Map newProperties) { ManagedProperties.setProperties(newProperties); }
public static Enumeration propertyNames() { return ManagedProperties.propertyNames(); }
/** * This is an expensive operation. * * @return Returns a <code>java.util.Properties</code> instance * that is equivalent to the current state of the scoped * properties, in that getProperty() will return the same value. * However, this is a copy, so setProperty on the * returned value will not effect the scoped properties. */ public static Properties getProperties() { return ManagedProperties.getProperties(); }
/** * Get value for property bound to the current thread context class loader. * If not found, then return default. * * @param propertyName property name. * @param dephault default value. * @return property value if found, otherwise default. */ public static String getProperty(String propertyName, String dephault) { return ManagedProperties.getProperty(propertyName, dephault); }
/** * Set value for property bound to the current thread context class loader. * @param propertyName property name * @param value property value (non-default) If null, remove the property. */ public static void setProperty(String propertyName, String value) { ManagedProperties.setProperty(propertyName, value); }