public static <T> ConfigKey<T> newConfigKey(TypeToken<T> type, String name) { return new BasicConfigKey<T>(type, name); }
public static <T> ConfigKey<T> newConfigKey(Class<T> type, String name, String description, T defaultValue) { return new BasicConfigKey<T>(type, name, description, defaultValue); }
public static <T> ConfigKey<T> newConfigKey(TypeToken<T> type, String name, String description, T defaultValue) { return new BasicConfigKey<T>(type, name, description, defaultValue); }
public final static ConfigKey<String> PASSWORD_FOR_USER(String user) { return new BasicConfigKey<String>(String.class, BASE_NAME_SECURITY+".user."+user+".password"); }
public BasicConfigKey<T> build() { return new BasicConfigKey<T>(this); } }
/** @deprecated since 0.6.0; use #PASSWORD_FOR_USER */ public final static ConfigKey<String> SECURITY_PROVIDER_EXPLICIT__PASSWORD(String user) { return new BasicConfigKey<String>(String.class, BASE_NAME+".security.explicit.user."+user); }
public static <T> ConfigKey<T> newConfigKey(Class<T> type, String name) { return new BasicConfigKey<T>(type, name); }
public static <T> ConfigKey<T> newConfigKey(TypeToken<T> type, String name, String description) { return new BasicConfigKey<T>(type, name, description); }
public final static ConfigKey<String> SECURITY_PROVIDER_EXPLICIT__PASSWORD(String user) { return new BasicConfigKey<String>(String.class, BASE_NAME+".security.explicit.user."+user); }
public static <T> ConfigKey<T> newConfigKey(Class<T> type, String name, String description) { return new BasicConfigKey<T>(type, name, description); }
/** Infers the type from the default value */ @SuppressWarnings({ "unchecked", "rawtypes" }) public static <T> ConfigKey<T> newConfigKey(String name, String description, @Nonnull T defaultValue) { return new BasicConfigKey<T>((Class)Preconditions.checkNotNull(defaultValue, "Type must be exlicit for ConfigKey if defaultValue is null").getClass(), name, description, defaultValue); }
@Override public Map<ConfigKey<?>, Object> getAllConfig() { Map<ConfigKey<?>, Object> result = new LinkedHashMap<ConfigKey<?>, Object>(); for (Object entry: entrySet()) result.put(new BasicConfigKey<Object>(Object.class, ""+((Map.Entry)entry).getKey()), ((Map.Entry)entry).getValue()); return result; }
public AttributeSensorAndConfigKey(Class<ConfigType> configType, Class<SensorType> sensorType, String name, String description, Object defaultValue) { super(sensorType, name, description); configKey = new BasicConfigKey<ConfigType>(configType, name, description, TypeCoercions.coerce(defaultValue, configType)); }
@Override public Object get(Object key) { return target.getConfig(new BasicConfigKey<Object>(Object.class, (String)key)); }
@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; }
/** removes the given prefix from the key for configuration purposes; logs warning and does nothing if there is no such prefix. * prefix will typically end with a ".". * this is useful for configuration purposes when a subsystem uses a short-name config (e.g. "user") * but in entity config or at the root (brooklyn.properties) there are longer names (e.g. "brooklyn.ssh.config.user"), * and we wish to convert from the longer names to the short-name. */ public static <T> ConfigKey<T> unprefixedKey(String prefix, ConfigKey<T> key) { String newName = key.getName(); if (newName.startsWith(prefix)) newName = newName.substring(prefix.length()); else log.warn("Cannot remove prefix "+prefix+" from key "+key+" (ignoring)"); return new BasicConfigKey<T>(key.getTypeToken(), newName, key.getDescription(), key.getDefaultValue()); }
public static <T> ConfigKey<T> newConfigKeyRenamed(String newName, ConfigKey<T> key) { return new BasicConfigKey<T>(key.getTypeToken(), newName, key.getDescription(), key.getDefaultValue()); }
@GET @Path("/{config}") @ApiOperation(value = "Fetch config value", responseClass = "Object") @ApiErrors(value = { @ApiError(code = 404, reason = "Could not find application, entity or config key") }) public String get( @ApiParam(value = "Application ID or name", required = true) @PathParam("application") String application, @ApiParam(value = "Entity ID or name", required = true) @PathParam("entity") String entityToken, @ApiParam(value = "Config key ID", required = true) @PathParam("config") String configKeyName ) { EntityLocal entity = brooklyn().getEntity(application, entityToken); ConfigKey<?> ck = entity.getEntityType().getConfigKey(configKeyName); if (ck==null) ck = new BasicConfigKey<Object>(Object.class, configKeyName); return getValueForDisplay(entity, ((AbstractEntity)entity).getConfigMap().getRawConfig(ck)); }
@Override public String get(String application, String entityToken, String configKeyName) { EntityLocal entity = brooklyn().getEntity(application, entityToken); ConfigKey<?> ck = entity.getEntityType().getConfigKey(configKeyName); if (ck==null) ck = new BasicConfigKey<Object>(Object.class, configKeyName); return getValueForDisplay(entity, ((AbstractEntity)entity).getConfigMap().getRawConfig(ck)); }