@Override public List<String> getNamedMaps() { return KEYS.get(); }
private void propertyChangedInternal() { load(); propertyChanged(); }
/** * Create the dynamic list property. The guava Splitter used is created as * <code>Splitter.onPattern(delimiterRegex).omitEmptyStrings().trimResults()</code>. The default * list value will be taken from the passed in list argument. */ public DynamicListProperty(String propName, List<T> defaultValue, String delimiterRegex) { setup(propName, defaultValue, delimiterRegex); }
/** * Create the dynamic list property. The guava Splitter used is created as * <code>Splitter.onPattern(delimiterRegex).omitEmptyStrings().trimResults()</code>. The default * list value will be transformed from list of strings after splitting. If defaultValue string is * null, the default list value will be an empty list. */ public DynamicListProperty(String propName, String defaultValue, String delimiterRegex) { this.splitter = Splitter.onPattern(delimiterRegex).omitEmptyStrings().trimResults(); setup(propName, transform(split(defaultValue)), splitter); }
protected List<T> transform(List<String> stringValues) { List<T> list = new ArrayList<T>(stringValues.size()); for (String s : stringValues) { list.add(from(s)); } return Collections.unmodifiableList(list); }
private void setup(String propName, List<T> defaultValue, Splitter splitter) { // Make a defensive copy of the default value. Would prefer to use an ImmutableList, but that // does not allow for null values in the List. this.defaultValues = (defaultValue == null ? null : Collections.unmodifiableList(new ArrayList<T>(defaultValue))); this.splitter = splitter; delegate = DynamicPropertyFactory.getInstance().getStringProperty(propName, null); load(); Runnable callback = new Runnable() { @Override public void run() { propertyChangedInternal(); } }; delegate.addCallback(callback); }
/** * Create the dynamic list property. The guava Splitter used is created as * <code>Splitter.onPattern(delimiterRegex).omitEmptyStrings().trimResults()</code>. The default * list value will be transformed from list of strings after splitting. If defaultValue string is * null, the default list value will be an empty list. */ public DynamicListProperty(String propName, String defaultValue, String delimiterRegex) { this.splitter = Splitter.onPattern(delimiterRegex).omitEmptyStrings().trimResults(); setup(propName, transform(split(defaultValue)), splitter); }
protected List<T> transform(List<String> stringValues) { List<T> list = new ArrayList<T>(stringValues.size()); for (String s : stringValues) { list.add(from(s)); } return Collections.unmodifiableList(list); }
private void setup(String propName, List<T> defaultValue, Splitter splitter) { // Make a defensive copy of the default value. Would prefer to use an ImmutableList, but that // does not allow for null values in the List. this.defaultValues = (defaultValue == null ? null : Collections.unmodifiableList(new ArrayList<T>(defaultValue))); this.splitter = splitter; delegate = DynamicPropertyFactory.getInstance().getStringProperty(propName, null); load(); Runnable callback = new Runnable() { @Override public void run() { propertyChangedInternal(); } }; delegate.addCallback(callback); }
@Override public List<T> getValue() { return get(); }
private void propertyChangedInternal() { load(); propertyChanged(); }
/** * Create the dynamic list property using the splitter and default list value passed in * from the arguments. */ public DynamicListProperty(String propName, List<T> defaultValue, Splitter splitter) { setup(propName, defaultValue, splitter); }
@Override public List<T> getValue() { return get(); }
/** * Create the dynamic list property using the splitter and default list value passed in * from the arguments. */ public DynamicListProperty(String propName, List<T> defaultValue, Splitter splitter) { setup(propName, defaultValue, splitter); }
public static List<String> getStringList(String property) { final DynamicListProperty<String> listProperty = new DynamicStringListProperty(property, ""); return listProperty.get(); }
/** * Create the dynamic list property. The guava Splitter used is created as * <code>Splitter.onPattern(delimiterRegex).omitEmptyStrings().trimResults()</code>. The default * list value will be taken from the passed in list argument. */ public DynamicListProperty(String propName, List<T> defaultValue, String delimiterRegex) { setup(propName, defaultValue, delimiterRegex); }
@Override protected void populateContext(Agent agent, Instance instance, ConfigItem item, ArchiveContext context) { context.getData().put("data", map.getMap(name)); if (instance != null) { return; } Client client = new Client(Agent.class, agent.getId()); ConfigUpdateRequest request = new ConfigUpdateRequest(client).withDeferredTrigger(true); for (String itemName : REQUIRED.get()) { if (!statusManager.isAssigned(client, itemName)) { log.info("Adding missing [{}] to agent [{}]", itemName, agent.getId()); request.addItem(itemName); } } if (request.getItems().size() > 0) { statusManager.updateConfig(request); } }
private void setup(String propName, List<T> defaultValue, String delimiterRegex) { setup(propName, defaultValue, Splitter.onPattern(delimiterRegex).omitEmptyStrings().trimResults()); }