org.apache.brooklyn.api.mgmt.EntityManager.createEnricher()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中org.apache.brooklyn.api.mgmt.EntityManager.createEnricher()方法的一些代码示例,展示了EntityManager.createEnricher()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EntityManager.createEnricher()方法的具体详情如下:
包路径:org.apache.brooklyn.api.mgmt.EntityManager
类名称:EntityManager
方法名:createEnricher

EntityManager.createEnricher介绍

[英]Creates a new enricher (not managed; not associated with any entity).
[中]创建新的enricher(非托管;不与任何实体关联)。

代码示例

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

@Override
public <T extends Enricher> T createEnricher(EnricherSpec<T> spec) {
  if (isInitialManagementContextReal()) {
    return initialManagementContext.getEntityManager().createEnricher(spec);
  } else {
    throw new IllegalStateException("Non-deployment context "+this+" (with no initial management context supplied) is not valid for this operation.");
  }
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

@Override
public <T extends Enricher> T add(EnricherSpec<T> spec) {
  T enricher = getManagementContext().getEntityManager().createEnricher(spec);
  add(enricher);
  return enricher;
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-core

@Test
public void testExceptionWhenEnricherHasInvalidConfig() {
  try {
    mgmt.getEntityManager().createEnricher(EnricherSpec.create(EnricherWithConfigConstraint.class)
        .configure(EnricherWithConfigConstraint.PATTERN, "123.123.256.10"));
    fail("Expected exception when creating enricher with invalid config");
  } catch (Exception e) {
    Throwable t = Exceptions.getFirstThrowableOfType(e, ConstraintViolationException.class);
    assertNotNull(t, "Original exception was: " + Exceptions.collapseText(e));
  }
}

相关文章