Java Code Examples for org.apache.brooklyn.api.policy.PolicySpec#getParameters()
The following examples show how to use
org.apache.brooklyn.api.policy.PolicySpec#getParameters() .
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: CatalogTransformer.java From brooklyn-server with Apache License 2.0 | 6 votes |
public static CatalogPolicySummary catalogPolicySummary(BrooklynRestResourceUtils b, RegisteredType item, UriBuilder ub) { final Set<PolicyConfigSummary> config = Sets.newLinkedHashSet(); PolicySpec<?> spec = null; try{ spec = b.getTypeRegistry().createSpec(item, null, PolicySpec.class); AtomicInteger priority = new AtomicInteger(); for (SpecParameter<?> input: spec.getParameters()) { config.add(ConfigTransformer.of(input).uiIncrementAndSetPriorityIfPinned(priority).transformLegacyPolicyConfig()); } }catch (Exception e) { Exceptions.propagateIfFatal(e); log.trace("Unable to create policy spec for "+item+": "+e, e); } return new CatalogPolicySummary(item.getSymbolicName(), item.getVersion(), item.getContainingBundle(), item.getDisplayName(), spec!=null ? spec.getType().getName() : item.getSuperTypes().toString(), CatalogItemType.POLICY.toString(), RegisteredTypes.getImplementationDataStringForSpec(item), item.getDescription(), tidyIconLink(b, item, item.getIconUrl(), ub), config, item.getTags(), item.isDeprecated(), makeLinks(item, ub)); }
Example 2
Source File: CatalogTransformer.java From brooklyn-server with Apache License 2.0 | 6 votes |
/** @deprecated since 0.12.0 use {@link RegisteredType} methods instead */ @Deprecated public static CatalogPolicySummary catalogPolicySummary(BrooklynRestResourceUtils b, CatalogItem<? extends Policy,PolicySpec<?>> item, UriBuilder ub) { final Set<PolicyConfigSummary> config = Sets.newLinkedHashSet(); try{ final PolicySpec<?> spec = (PolicySpec<?>) b.getCatalog().peekSpec(item); AtomicInteger priority = new AtomicInteger(); for (SpecParameter<?> input: spec.getParameters()) { config.add(ConfigTransformer.of(input).uiIncrementAndSetPriorityIfPinned(priority).transformLegacyPolicyConfig()); } }catch (Exception e) { Exceptions.propagateIfFatal(e); log.trace("Unable to create policy spec for "+item+": "+e, e); } return new CatalogPolicySummary(item.getSymbolicName(), item.getVersion(), item.getContainingBundle(), item.getDisplayName(), item.getJavaType(), item.getCatalogItemType().toString(), item.getPlanYaml(), item.getDescription(), tidyIconLink(b, item, item.getIconUrl(), ub), config, item.tags().getTags(), item.isDeprecated(), makeLinks(item, ub)); }