public static Map<String, Sensor<?>> getDefinedSensors(Class<? extends Entity> entityClass) { return getDefinedEntityType(entityClass).getSensors(); }
public static EntityDynamicType getDefinedEntityType(Class<? extends Entity> entityClass) { return (EntityDynamicType) BrooklynTypes.getDefinedBrooklynType(entityClass); }
private Map<?,?> convertFlagsToKeys(Class<? extends Entity> javaType, Map<?, ?> config) { if (config==null || config.isEmpty() || javaType==null) return config; Map<String, ConfigKey<?>> configKeys = BrooklynTypes.getDefinedConfigKeys(javaType); Map<Object,Object> result = new LinkedHashMap<Object,Object>(); for (Map.Entry<?,?> entry: config.entrySet()) { log.debug("Setting key {} to {} for REST creation of {}", new Object[] { entry.getKey(), entry.getValue(), javaType}); Object key = configKeys.get(entry.getKey()); if (key==null) { log.warn("Unrecognised config key {} passed to {}; will be treated as flag (and likely ignored)", entry.getKey(), javaType); key = entry.getKey(); } result.put(key, entry.getValue()); } return result; }
if (RegisteredTypes.isSubtypeOf(item, Entity.class)) { assertTrue(spec instanceof EntitySpec, "Not an EntitySpec: " + spec); BrooklynTypes.getDefinedEntityType(((EntitySpec<?>)spec).getType()); match++; BrooklynTypes.getDefinedBrooklynType(((PolicySpec<?>)spec).getType()); match++; BrooklynTypes.getDefinedBrooklynType(((LocationSpec<?>)spec).getType()); match++;
protected synchronized Map<String, Sensor<?>> getStaticSensorKeys() { if (staticSensorKeys==null) { @SuppressWarnings("unchecked") Class<? extends Entity> clazz = (Class<? extends Entity>) getTypeClass(); staticSensorKeys = (clazz == null) ? BrooklynTypes.getDefinedSensors(getType()) : BrooklynTypes.getDefinedSensors(clazz); } return staticSensorKeys; }
@SuppressWarnings("unchecked") public static Map<String, Sensor<?>> getDefinedSensors(String entityTypeName) { try { return getDefinedSensors((Class<? extends Entity>) new ClassLoaderUtils(BrooklynTypes.class).loadClass(entityTypeName)); } catch (ClassNotFoundException e) { throw Exceptions.propagate(e); } }
populateBrooklynObjectMementoBuilder(entity, builder); EntityDynamicType definedType = BrooklynTypes.getDefinedEntityType(entity.getClass());
public static Map<String, ConfigKey<?>> getDefinedConfigKeys(Class<? extends BrooklynObject> brooklynClass) { return getDefinedBrooklynType(brooklynClass).getConfigKeys(); }
protected synchronized Map<String, ConfigKey<?>> getStaticConfigKeys() { if (staticConfigKeys==null) { @SuppressWarnings("unchecked") Class<? extends Entity> clazz = (Class<? extends Entity>) getTypeClass(); staticConfigKeys = (clazz == null) ? BrooklynTypes.getDefinedConfigKeys(getType()) : BrooklynTypes.getDefinedConfigKeys(clazz); } return staticConfigKeys; }
EntityDynamicType typeMap = BrooklynTypes.getDefinedEntityType(spec.getType()); EntityType type = typeMap.getSnapshot();
static List<SpecParameter<?>> collectParameters(Class<?> c) { MutableList<WeightedParameter> parameters = MutableList.<WeightedParameter>of(); if (BrooklynObject.class.isAssignableFrom(c)) { @SuppressWarnings("unchecked") Class<? extends BrooklynObject> brooklynClass = (Class<? extends BrooklynObject>) c; BrooklynDynamicType<?, ?> dynamicType = BrooklynTypes.getDefinedBrooklynType(brooklynClass); BrooklynType type = dynamicType.getSnapshot(); for (ConfigKey<?> x: type.getConfigKeys()) { WeightedParameter fieldConfig = getFieldConfig(x, dynamicType.getConfigKeyField(x.getName())); parameters.appendIfNotNull(fieldConfig); } Collections.sort(parameters, new WeightedParameterComparator()); return FluentIterable.from(parameters) .transform(new SpecParameterTransformer()).toList(); } else { return ImmutableList.of(); } }
@SuppressWarnings("unchecked") public static Map<String, ConfigKey<?>> getDefinedConfigKeys(String brooklynTypeName) { try { return getDefinedConfigKeys((Class<? extends BrooklynObject>) new ClassLoaderUtils(BrooklynTypes.class).loadClass(brooklynTypeName)); } catch (ClassNotFoundException e) { throw Exceptions.propagate(e); } }
AbstractBrooklynObjectSpec<?, ?> spec = catalog.peekSpec(item); if (spec instanceof EntitySpec) { BrooklynTypes.getDefinedEntityType(((EntitySpec<?>)spec).getType());
public static Map<String,Object> toItemDescriptor(Class<? extends BrooklynObject> clazz, boolean headingsOnly) { BrooklynDynamicType<?, ?> dynamicType = BrooklynTypes.getDefinedBrooklynType(clazz); BrooklynType type = dynamicType.getSnapshot(); ConfigKey<?> version = dynamicType.getConfigKey(BrooklynConfigKeys.SUGGESTED_VERSION.getName());
EntityDynamicType typeMap = BrooklynTypes.getDefinedEntityType(spec.getType()); EntityType type = typeMap.getSnapshot();