本文整理了Java中org.apache.brooklyn.api.entity.Entity.getDisplayName()
方法的一些代码示例,展示了Entity.getDisplayName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getDisplayName()
方法的具体详情如下:
包路径:org.apache.brooklyn.api.entity.Entity
类名称:Entity
方法名:getDisplayName
[英]A display name; recommended to be a concise single-line description.
[中]显示名称;建议采用简洁的单行说明。
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Override
public boolean apply(@Nullable Entity input) {
return (input != null && input.getDisplayName() != null) && input.getDisplayName().matches(regex);
}
@Override
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Override
public boolean apply(@Nullable Entity input) {
return (input != null) && Objects.equal(input.getDisplayName(), val);
}
};
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Override
public boolean apply(@Nullable Entity input) {
return (input != null) && condition.apply(input.getDisplayName());
}
@Override
代码示例来源:origin: io.brooklyn.clocker/brooklyn-clocker-docker
@Override
public boolean apply(@Nullable Entity input) {
return input.getDisplayName().toLowerCase(Locale.ENGLISH).contains(parameter.toLowerCase(Locale.ENGLISH));
}
};
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
protected static String shortName(Object x) {
if (x instanceof HasShortName) {
return ((HasShortName)x).getShortName();
}
if (x instanceof Entity) {
return ((Entity)x).getDisplayName();
}
return x.toString();
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-policy
@Override
public boolean apply(Entity input) {
return "2".equals(input.getDisplayName());
}}));
itemGroup.setContainers(containerGroup);
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
private String nameOfEntity(Entity entity) {
String name = entity.getDisplayName();
if (name.contains(entity.getId())) return name;
else return name + " ("+entity.getId()+")";
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
@Override
public void onException(Exception exception) {
log.error("Detected exception while retrieving Chef attributes from entity " + entity.getDisplayName(), exception);
for (AttributeSensor<?> attribute : chefAttributeSensors.values()) {
if (!attribute.getName().startsWith(CHEF_ATTRIBUTE_PREFIX))
continue;
entity.sensors().set(attribute, null);
}
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-rest-resources
/** walks the hierarchy (depth-first) at root (often an Application) looking for
* an entity matching the given ID or name; returns the first such entity, or null if none found
**/
public Entity searchForEntityNamed(Entity root, String entity) {
if (root.getId().equals(entity) || entity.equals(root.getDisplayName())) return root;
for (Entity child: root.getChildren()) {
Entity result = searchForEntityNamed(child, entity);
if (result!=null) return result;
}
return null;
}
代码示例来源:origin: io.brooklyn.clocker/brooklyn-clocker-docker
@Override
public String getDisplayName() {
Entity container = sensors().get(DockerContainer.CONTAINER);
if (container != null) {
return container.getDisplayName();
} else {
return "Container";
}
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-rest-resources
private List<Map<String, String>> entitiesIdAndNameAsList(Collection<? extends Entity> entities) {
List<Map<String, String>> members = Lists.newArrayList();
for (Entity entity : entities) {
if (Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.SEE_ENTITY, entity)) {
members.add(ImmutableMap.of("id", entity.getId(), "name", entity.getDisplayName()));
}
}
return members;
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-winrm
@Override
public void onException(Exception exception) {
log.error("Detected exception while retrieving Windows Performance Counters from entity " +
entity.getDisplayName(), exception);
for (WindowsPerformanceCounterPollConfig<?> config : polls) {
entity.sensors().set(Sensors.newSensor(config.getSensor().getClass(), config.getPerformanceCounterName(), config.getDescription()), null);
}
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-camp
@Test
public void testWrapsAppIfNameAtTopLevelAndOnApp() throws Exception {
String yaml = Joiner.on("\n").join(
"name: myTopLevelName",
"services:",
"- serviceType: org.apache.brooklyn.core.test.entity.TestApplication",
" name: myEntityName");
Entity app = createStartWaitAndLogApplication(yaml);
assertNull(app.getConfig(EntityManagementUtils.WRAPPER_APP_MARKER));
assertEquals(app.getDisplayName(), "myTopLevelName");
assertEquals(app.getChildren().size(), 0);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-camp
private void checkChildEntitySpec(Entity app, String entityName) {
Collection<Entity> children = app.getChildren();
Assert.assertEquals(children.size(), 1);
Entity child = Iterables.getOnlyElement(children);
Assert.assertEquals(child.getDisplayName(), entityName);
Assert.assertEquals(child.getEntityType().getName(), BasicEntity.class.getName());
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-camp
private void checkChildEntitySpec(Entity app, String entityName) {
Collection<Entity> children = app.getChildren();
Assert.assertEquals(children.size(), 1);
Entity child = Iterables.getOnlyElement(children);
Assert.assertEquals(child.getDisplayName(), entityName);
Assert.assertEquals(child.getEntityType().getName(), BasicEntity.class.getName());
}
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-camp
private void checkGrandchildEntitySpec(Entity createAndStartApplication, String entityName) {
Collection<Entity> children = createAndStartApplication.getChildren();
Assert.assertEquals(children.size(), 1);
Entity child = Iterables.getOnlyElement(children);
Collection<Entity> grandChildren = child.getChildren();
Assert.assertEquals(grandChildren.size(), 1);
Entity grandChild = Iterables.getOnlyElement(grandChildren);
Assert.assertEquals(grandChild.getDisplayName(), entityName);
Assert.assertEquals(grandChild.getEntityType().getName(), BasicEntity.class.getName());
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-camp
@Test
public void testReferenceAppYamlAsPlatformComponent() throws Exception {
Entity app = createAndStartApplication(
"services:",
"- name: Reference child name",
" type: classpath://yaml-ref-app.yaml");
Assert.assertEquals(app.getChildren().size(), 0);
Assert.assertEquals(app.getDisplayName(), "Reference child name");
//child is a proxy so equality test won't do
Assert.assertEquals(app.getEntityType().getName(), BasicApplication.class.getName());
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-camp
protected Entity setupAndCheckTestEntityInBasicYamlWith(String ...extras) throws Exception {
Entity app = createAndStartApplication(loadYaml("test-entity-basic-template.yaml", extras));
waitForApplicationTasks(app);
Entities.dumpInfo(app);
Assert.assertEquals(app.getDisplayName(), "test-entity-basic-template");
log.info("App started:");
Entities.dumpInfo(app);
Assert.assertTrue(app.getChildren().iterator().hasNext(), "Expected app to have child entity");
Entity entity = app.getChildren().iterator().next();
Assert.assertTrue(entity instanceof TestEntity, "Expected TestEntity, found " + entity.getClass());
return entity;
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testSimpleXmlPlanParse() {
EntitySpec<? extends Application> appSpec = EntityManagementUtils.createEntitySpecForApplication(mgmt,
"<root><a_kid foo=\"bar\"/></root>");
Application app = EntityManagementUtils.createStarting(mgmt, appSpec).get();
Entities.dumpInfo(app);
Assert.assertEquals(app.getDisplayName(), "root");
Entity child = Iterables.getOnlyElement(app.getChildren());
Assert.assertEquals(child.getDisplayName(), "a_kid");
Assert.assertEquals(child.config().get(ConfigKeys.newStringConfigKey("foo")), "bar");
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testAppSpecXmlPlanParse() {
EntitySpec<? extends Application> appSpec = EntityManagementUtils.createEntitySpecForApplication(mgmt,
"<root><a_kid foo=\"bar\"/></root>");
Application app = EntityManagementUtils.createStarting(mgmt, appSpec).get();
Entities.dumpInfo(app);
Assert.assertEquals(app.getDisplayName(), "root");
Entity child = Iterables.getOnlyElement(app.getChildren());
Assert.assertEquals(child.getDisplayName(), "a_kid");
Assert.assertEquals(child.config().get(ConfigKeys.newStringConfigKey("foo")), "bar");
}
内容来源于网络,如有侵权,请联系作者删除!