Java Code Examples for org.apache.brooklyn.util.core.config.ConfigBag#isEmpty()
The following examples show how to use
org.apache.brooklyn.util.core.config.ConfigBag#isEmpty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Startable.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public Void call(ConfigBag parameters) { if (!parameters.isEmpty()) { log.warn("Parameters "+parameters+" not supported for call to "+entity()+" - "+Tasks.current()); } return new MethodEffector<Void>(Startable.class, "stop").call(entity(), parameters.getAllConfig()); }
Example 2
Source File: AddChildrenEffector.java From brooklyn-server with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public List<String> call(ConfigBag params) { params = getMergedParams(effector, params); String blueprint = blueprintBase; if (!params.isEmpty()) { Map<?,?> m = ((Map<?,?>)Iterables.getOnlyElement( Yamls.parseAll(blueprint) )); if ( m.containsKey("brooklyn.config") ) { Map<?,?> cfg1 = (Map<?,?>) m.get("brooklyn.config"); Map<Object,Object> cfgMergeFlat = MutableMap.<Object,Object>copyOf(cfg1).add(params.getAllConfig()); if (cfgMergeFlat.size() < cfg1.size() + params.size()) { // there are quite complex merging strategies, but we need type info to apply them log.warn("Adding blueprint where same config key is supplied in blueprint and as parameters; preferring parameter (no merge), but behaviour may change. Recommended to use distinct keys."); } ((Map<Object,Object>)m).put("brooklyn.config", cfgMergeFlat); blueprint = toJson(m); } else { if (isJsonNotYaml(blueprint)) { ((Map<Object,Object>)m).put("brooklyn.config", params.getAllConfig()); blueprint = toJson(m); } else { blueprint = blueprint+"\n"+"brooklyn.config: "+ toJson(params.getAllConfig()); } } } log.debug(this+" adding children to "+entity()+":\n"+blueprint); CreationResult<List<Entity>, List<String>> result = EntityManagementUtils.addChildren(entity(), blueprint, autostart); log.debug(this+" added children to "+entity()+": "+result.get()); return result.task().getUnchecked(); }
Example 3
Source File: Startable.java From brooklyn-server with Apache License 2.0 | 4 votes |
@Override public Void call(ConfigBag parameters) { if (!parameters.isEmpty()) { log.warn("Parameters "+parameters+" not supported for call to "+entity()+" - "+Tasks.current()); } return new MethodEffector<Void>(Startable.class, "restart").call(entity(), parameters.getAllConfig()); }