/** * Adds a set of deprecated keys to the global deprecations. * * This method is lockless. It works by means of creating a new * DeprecationContext based on the old one, and then atomically swapping in * the new context. If someone else updated the context in between us reading * the old context and swapping in the new one, we try again until we win the * race. * * @param deltas The deprecations to add. */ public static void addDeprecations(DeprecationDelta[] deltas) { DeprecationContext prev, next; do { prev = deprecationContext.get(); next = new DeprecationContext(prev, deltas); } while (!deprecationContext.compareAndSet(prev, next)); }
deprecations.getDeprecatedKeyMap().get(confName); if (keyInfo != null) { keyInfo.clearAccessed();
DeprecatedKeyInfo keyInfo = deprecations.getDeprecatedKeyMap().get(name); if (keyInfo != null) { if (!keyInfo.getAndSetAccessed()) { String deprecatedKey = deprecations.getReverseDeprecatedKeyMap().get(n); if (deprecatedKey != null && !overlayProperties.containsKey(n)) { String deprecatedValue = overlayProperties.getProperty(deprecatedKey);
if (deprecations.getDeprecatedKeyMap().containsKey(attr)) { DeprecatedKeyInfo keyInfo = deprecations.getDeprecatedKeyMap().get(attr); keyInfo.clearAccessed(); for (String key:keyInfo.newKeys) {
if (deprecations.getDeprecatedKeyMap().containsKey(attr)) { DeprecatedKeyInfo keyInfo = deprecations.getDeprecatedKeyMap().get(attr); keyInfo.clearAccessed(); for (String key:keyInfo.newKeys) {
if (deprecations.getDeprecatedKeyMap().containsKey(attr)) { DeprecatedKeyInfo keyInfo = deprecations.getDeprecatedKeyMap().get(attr); keyInfo.clearAccessed(); for (String key:keyInfo.newKeys) {
if (deprecations.getDeprecatedKeyMap().containsKey(attr)) { DeprecatedKeyInfo keyInfo = deprecations.getDeprecatedKeyMap().get(attr); keyInfo.clearAccessed(); for (String key:keyInfo.newKeys) {
name = name.trim(); DeprecationContext deprecations = deprecationContext.get(); if (deprecations.getDeprecatedKeyMap().isEmpty()) { getProps();
name = name.trim(); DeprecationContext deprecations = deprecationContext.get(); if (deprecations.getDeprecatedKeyMap().isEmpty()) { getProps();
name = name.trim(); DeprecationContext deprecations = deprecationContext.get(); if (deprecations.getDeprecatedKeyMap().isEmpty()) { getProps();
DeprecatedKeyInfo keyInfo = deprecations.getDeprecatedKeyMap().get(name); if (keyInfo != null) { if (!keyInfo.getAndSetAccessed()) { String deprecatedKey = deprecations.getReverseDeprecatedKeyMap().get(n); if (deprecatedKey != null && !overlay.containsKey(n)) { String deprecatedValue = overlay.getProperty(deprecatedKey);
name = name.trim(); DeprecationContext deprecations = deprecationContext.get(); if (deprecations.getDeprecatedKeyMap().isEmpty()) { getProps();
DeprecatedKeyInfo keyInfo = deprecations.getDeprecatedKeyMap().get(name); warnOnceIfDeprecated(deprecations, name); for (String newKey : keyInfo.newKeys) { String deprecatedKey = deprecations.getReverseDeprecatedKeyMap().get(n); if (deprecatedKey != null && !getOverlay().containsKey(n) && getOverlay().containsKey(deprecatedKey)) {
DeprecatedKeyInfo keyInfo = deprecations.getDeprecatedKeyMap().get(name); warnOnceIfDeprecated(deprecations, name); for (String newKey : keyInfo.newKeys) { String deprecatedKey = deprecations.getReverseDeprecatedKeyMap().get(n); if (deprecatedKey != null && !getOverlay().containsKey(n) && getOverlay().containsKey(deprecatedKey)) {
DeprecatedKeyInfo keyInfo = deprecations.getDeprecatedKeyMap().get(name); warnOnceIfDeprecated(deprecations, name); for (String newKey : keyInfo.newKeys) { String deprecatedKey = deprecations.getReverseDeprecatedKeyMap().get(n); if (deprecatedKey != null && !getOverlay().containsKey(n) && getOverlay().containsKey(deprecatedKey)) {
/** * Returns alternative names (non-deprecated keys or previously-set deprecated keys) * for a given non-deprecated key. * If the given key is deprecated, return null. * * @param name property name. * @return alternative names. */ private String[] getAlternativeNames(String name) { String altNames[] = null; DeprecatedKeyInfo keyInfo = null; DeprecationContext cur = deprecationContext.get(); String depKey = cur.getReverseDeprecatedKeyMap().get(name); if(depKey != null) { keyInfo = cur.getDeprecatedKeyMap().get(depKey); if(keyInfo.newKeys.length > 0) { if(getProps().containsKey(depKey)) { //if deprecated key is previously set explicitly List<String> list = new ArrayList<String>(); list.addAll(Arrays.asList(keyInfo.newKeys)); list.add(depKey); altNames = list.toArray(new String[list.size()]); } else { altNames = keyInfo.newKeys; } } } return altNames; }
/** * Returns alternative names (non-deprecated keys or previously-set deprecated keys) * for a given non-deprecated key. * If the given key is deprecated, return null. * * @param name property name. * @return alternative names. */ private String[] getAlternativeNames(String name) { String altNames[] = null; DeprecatedKeyInfo keyInfo = null; DeprecationContext cur = deprecationContext.get(); String depKey = cur.getReverseDeprecatedKeyMap().get(name); if(depKey != null) { keyInfo = cur.getDeprecatedKeyMap().get(depKey); if(keyInfo.newKeys.length > 0) { if(getProps().containsKey(depKey)) { //if deprecated key is previously set explicitly List<String> list = new ArrayList<String>(); list.addAll(Arrays.asList(keyInfo.newKeys)); list.add(depKey); altNames = list.toArray(new String[list.size()]); } else { altNames = keyInfo.newKeys; } } } return altNames; }
/** * Returns alternative names (non-deprecated keys or previously-set deprecated keys) * for a given non-deprecated key. * If the given key is deprecated, return null. * * @param name property name. * @return alternative names. */ private String[] getAlternativeNames(String name) { String altNames[] = null; DeprecatedKeyInfo keyInfo = null; DeprecationContext cur = deprecationContext.get(); String depKey = cur.getReverseDeprecatedKeyMap().get(name); if(depKey != null) { keyInfo = cur.getDeprecatedKeyMap().get(depKey); if(keyInfo.newKeys.length > 0) { if(getProps().containsKey(depKey)) { //if deprecated key is previously set explicitly List<String> list = new ArrayList<String>(); list.addAll(Arrays.asList(keyInfo.newKeys)); list.add(depKey); altNames = list.toArray(new String[list.size()]); } else { altNames = keyInfo.newKeys; } } } return altNames; }
/** * Returns alternative names (non-deprecated keys or previously-set deprecated keys) * for a given non-deprecated key. * If the given key is deprecated, return null. * * @param name property name. * @return alternative names. */ private String[] getAlternativeNames(String name) { String altNames[] = null; DeprecatedKeyInfo keyInfo = null; DeprecationContext cur = deprecationContext.get(); String depKey = cur.getReverseDeprecatedKeyMap().get(name); if(depKey != null) { keyInfo = cur.getDeprecatedKeyMap().get(depKey); if(keyInfo.newKeys.length > 0) { if(getProps().containsKey(depKey)) { //if deprecated key is previously set explicitly List<String> list = new ArrayList<String>(); list.addAll(Arrays.asList(keyInfo.newKeys)); list.add(depKey); altNames = list.toArray(new String[list.size()]); } else { altNames = keyInfo.newKeys; } } } return altNames; }
/** * Sets all deprecated properties that are not currently set but have a * corresponding new property that is set. Useful for iterating the * properties when all deprecated properties for currently set properties * need to be present. */ public void setDeprecatedProperties() { DeprecationContext deprecations = deprecationContext.get(); Properties props = getProps(); Properties overlay = getOverlay(); for (Map.Entry<String, DeprecatedKeyInfo> entry : deprecations.getDeprecatedKeyMap().entrySet()) { String depKey = entry.getKey(); if (!overlay.contains(depKey)) { for (String newKey : entry.getValue().newKeys) { String val = overlay.getProperty(newKey); if (val != null) { props.setProperty(depKey, val); overlay.setProperty(depKey, val); break; } } } } }