/** prefix generally ends with a full stop */ public static BrooklynProperties filterForPrefixAndStrip(Map<String,?> properties, String prefix) { BrooklynProperties result = BrooklynProperties.Factory.newEmpty(); for (String k: properties.keySet()) { if (k.startsWith(prefix)) { result.put(k.substring(prefix.length()), properties.get(k)); } } return result; }
public static ManagementContext newManagementContext(Map<?,?> props) { return new LocalManagementContext( BrooklynProperties.Factory.newEmpty().addFromMap(props)); }
public static BrooklynProperties loadFromFile(String file) { BrooklynProperties result = BrooklynProperties.Factory.newEmpty(); if (file!=null) result.addFrom(new File(file)); return result; }
/** @deprecated since 0.6; use {@code managementContext.getLocationRegistry().resolve(spec)} */ public static JcloudsLocation resolveWithDefaultProperties(String spec) { BrooklynProperties properties = BrooklynProperties.Factory.newDefault(); return resolveWithProperties(spec, properties); }
/** * Creates a LocalManagement with default BrooklynProperties. */ public LocalManagementContext() { this(BrooklynProperties.Factory.newDefault()); }
public static BrooklynProperties filterFor(BrooklynProperties properties, Predicate<? super String> filter) { BrooklynProperties result = BrooklynProperties.Factory.newEmpty(); for (String k: (Collection<String>)properties.keySet()) { if (filter.apply(k)) { result.put(k, properties.get(k)); } } return result; }
public static BrooklynProperties filterForPrefix(BrooklynProperties properties, String prefix) { BrooklynProperties result = BrooklynProperties.Factory.newEmpty(); for (String k: (Collection<String>)properties.keySet()) { if (k.startsWith(prefix)) { result.put(k, properties.get(k)); } } return result; }
@Override public BrooklynProperties submap(Predicate<ConfigKey<?>> filter) { BrooklynProperties result = Factory.newEmpty(); for (Object entry: entrySet()) { ConfigKey<?> k = new BasicConfigKey<Object>(Object.class, ""+((Map.Entry)entry).getKey()); if (filter.apply(k)) result.put(((Map.Entry)entry).getKey(), ((Map.Entry)entry).getValue()); } return result; }