热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.brooklyn.core.entity.Entities类的使用及代码示例

本文整理了Java中org.apache.brooklyn.core.entity.Entities类的一些代码示例,展示了Entities类

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

Entities介绍

[英]Convenience methods for working with entities.

Also see the various Methods classes for traits, such as StartableMethods for Startable implementations.
[中]使用实体的便捷方法。
另请参阅各种
方法类以了解特性,例如用于Startable实现的StartableMethods。

代码示例

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

@AfterMethod(alwaysRun=true)
public void tearDown() throws Exception {
if (mgmt != null) Entities.destroyAll(mgmt);
mgmt = null;
}

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

/** convenience for starting an entity, esp a new Startable instance which has been created dynamically
* (after the application is started) */
public static void start(Entity e, Collection locations) {
if (!isManaged(e) && !manage(e)) {
log.warn("Using deprecated discouraged mechanism to start management -- Entities.start(Application, Locations) -- caller should create and use the preferred management context");
startManagement(e);
}
if (e instanceof Startable) Entities.invokeEffector(e, e, Startable.START,
MutableMap.of("locations", locations)).getUnchecked();
}

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

@Override
public void run() {
Entities.unmanage(dryRunChild);
}
}

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

/** Invokes in parallel if multiple, but otherwise invokes the item directly. */
public static Task invokeEffector(Entity callingEntity, Iterable entitiesToCall,
final Effector effector, final Map parameters) {
if (Iterables.size(entitiesToCall)==1)
return invokeEffector(callingEntity, entitiesToCall.iterator().next(), effector, parameters);
else
return invokeEffectorList(callingEntity, entitiesToCall, effector, parameters);
}

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

@Override
public void run() {
log.debug("destroying app "+app+" (managed? "+isManaged(app)+"; mgmt is "+mgmt+")");
try {
destroy(app);
log.debug("destroyed app "+app+"; mgmt now "+mgmt);
} catch (Exception e) {
log.warn("problems destroying app "+app+" (mgmt now "+mgmt+", will rethrow at least one exception): "+e);
error.compareAndSet(null, e);
}
}}));
}

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

public String getNimbusHostname() {
String result = entity.getConfig(Storm.NIMBUS_HOSTNAME);
if (result != null) return result;
Entity nimbus = entity.getConfig(Storm.NIMBUS_ENTITY);
if (nimbus == null) {
log.warn("No nimbus hostname available; using 'localhost'");
return "localhost";
}
return Entities.submit(entity, DependentConfiguration.attributeWhenReady(nimbus, Attributes.HOSTNAME)).getUnchecked();
}

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

/** Invokes in parallel if multiple, but otherwise invokes the item directly. */
public static Task invokeEffector(Entity callingEntity, Iterable entitiesToCall,
final Effector effector) {
return invokeEffector(callingEntity, entitiesToCall, effector, Collections.emptyMap());
}

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

@AfterMethod(alwaysRun=true)
public void tearDown() throws Exception {
// Kills the apps before terminating the pool
for (TestApplication app : createdApps) {
Entities.destroy(app);
}
if (mgmt != null) {
Entities.destroyAll(mgmt);
mgmt = null;
}
}

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

public static void dumpInfo(Location loc) {
try {
dumpInfo(loc, new PrintWriter(System.out), "", " ");
} catch (IOException exc) {
// system.out throwing an exception is odd, so don't have IOException on signature
throw new RuntimeException(exc);
}
}
public static void dumpInfo(Location loc, Writer out) throws IOException {

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

@Override
public boolean apply(@Nullable Entity input) {
return (input != null) && Entities.isManaged(input);
}
@Override

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

/** Same as {@link #destroy(Location)} but catching all errors. */
public static void destroyCatching(Location loc) {
try {
destroy(loc);
} catch (Exception e) {
log.warn("ERROR destroying "+loc+" (ignoring): "+e, e);
Exceptions.propagateIfFatal(e);
}
}

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

@Override
public BrooklynObject apply(BrooklynObject obj) {
// entities must be deproxied
if (obj instanceof Entity) obj = Entities.deproxy((Entity)obj);
return obj;
}
}));

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

/**
* @deprecated since 0.10.0; see {@link #descendantsAndSelf(Entity, Predicate)}
*/
@Deprecated
public static Iterable descendants(Entity root, Predicate matching) {
return descendantsAndSelf(root, matching);
}

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

@Test
public void testInvokeEffectorListWithEmptyUsingUnmanagedContext() throws Exception {
// Previously this threw the IllegalStateException directly, because DynamicTasks called
// ((EntityInternal)entity).getManagementSupport().getExecutionContext();
// (so it successfully called getManagementSupport, and then hit the exception.
// Now it calls ((EntityInternal)entity).getExecutionContext(), so the exception happens in
// the entity-proxy and is thus wrapped.
TestEntity entity = app.addChild(EntitySpec.create(TestEntity.class));
Entities.unmanage(entity);
try {
Entities.invokeEffectorList(entity, ImmutableList.of(), Startable.STOP).get(Duration.THIRTY_SECONDS);
Asserts.shouldHaveFailedPreviously();
} catch (Exception e) {
IllegalStateException e2 = Exceptions.getFirstThrowableOfType(e, IllegalStateException.class);
if (e2 == null) throw e;
Asserts.expectedFailureContains(e2, "no longer managed");
}
}

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

public static Task> invokeEffectorListWithMap(Entity callingEntity, Iterable entitiesToCall,
final Effector effector, final Map parameters) {
return invokeEffectorList(callingEntity, entitiesToCall, effector, parameters);
}

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

@Test
public void testStartManagementOfEntityIsNoop() throws Exception {
Entity app2 = mgmt.getEntityManager().createEntity(EntitySpec.create(TestApplication.class));
assertTrue(Entities.isManaged(app2));

Entities.startManagement(app2);
assertTrue(Entities.isManaged(app2));
listener.assertEventsEqualsEventually(ImmutableList.of(new ChangeEvent(ChangeType.ADDED, app2)));
}

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

@Test
public void testStartManagementFailsIfAppDeleted() throws Exception {
TestApplication app2 = mgmt.getEntityManager().createEntity(EntitySpec.create(TestApplication.class));
Entities.unmanage(app2);

try {
Entities.startManagement(app2, mgmt);
fail("Managed deleted app "+app2+" in "+mgmt);
} catch (IllegalStateException e) {
if (!(e.toString().contains("No concrete entity known"))) throw e;
}
}

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

@Test
public void testManageIsNoop() throws Exception {
TestEntity child = mgmt.getEntityManager().createEntity(EntitySpec.create(TestEntity.class)
.parent(app));

Entities.manage(child);
assertTrue(Entities.isManaged(child));
listener.assertEventsEqualsEventually(ImmutableList.of(new ChangeEvent(ChangeType.ADDED, child)));
}

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

private void runTestGeneratesCorrectDownloadUrl(String version, String expectedUrl) throws Exception {
// TODO Using BrooklynNodeImpl directly, because want to instantiate a BroolynNodeSshDriver.
// Really want to make that easier to test, without going through "wrong" code path for creating entity.
BrooklynNode entity = app.addChild(EntitySpec.create(BrooklynNode.class)
.configure(BrooklynNode.SUGGESTED_VERSION, version));
BrooklynNodeImpl entityImpl = (BrooklynNodeImpl) Entities.deproxy(entity);
ConfigToAttributes.apply(entity);
BrooklynNodeSshDriver driver = new BrooklynNodeSshDriver(entityImpl, loc);
DownloadResolver resolver = Entities.newDownloader(driver);
List urls = resolver.getTargets();
System.out.println("urls=" + urls);
assertTrue(urls.contains(expectedUrl), "urls=" + urls);
}

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

@Test
@SuppressWarnings("deprecation")
public void testDescendantsFilteredByType() throws Exception {
Asserts.assertEqualsIgnoringOrder(Entities.descendantsAndSelf(app, TestEntity.class), ImmutableList.of(entity, entity2));
Asserts.assertEqualsIgnoringOrder(Entities.descendants(app, TestEntity.class), ImmutableList.of(entity, entity2));
}

推荐阅读
  • 标题: ... [详细]
  • 本文整理了Java中java.lang.NoSuchMethodError.getMessage()方法的一些代码示例,展示了NoSuchMethodErr ... [详细]
  • Nginx使用(server参数配置)
    本文介绍了Nginx的使用,重点讲解了server参数配置,包括端口号、主机名、根目录等内容。同时,还介绍了Nginx的反向代理功能。 ... [详细]
  • 目录实现效果:实现环境实现方法一:基本思路主要代码JavaScript代码总结方法二主要代码总结方法三基本思路主要代码JavaScriptHTML总结实 ... [详细]
  • 本文介绍了在Mac上搭建php环境后无法使用localhost连接mysql的问题,并通过将localhost替换为127.0.0.1或本机IP解决了该问题。文章解释了localhost和127.0.0.1的区别,指出了使用socket方式连接导致连接失败的原因。此外,还提供了相关链接供读者深入了解。 ... [详细]
  • XML介绍与使用的概述及标签规则
    本文介绍了XML的基本概念和用途,包括XML的可扩展性和标签的自定义特性。同时还详细解释了XML标签的规则,包括标签的尖括号和合法标识符的组成,标签必须成对出现的原则以及特殊标签的使用方法。通过本文的阅读,读者可以对XML的基本知识有一个全面的了解。 ... [详细]
  • Postgresql备份和恢复的方法及命令行操作步骤
    本文介绍了使用Postgresql进行备份和恢复的方法及命令行操作步骤。通过使用pg_dump命令进行备份,pg_restore命令进行恢复,并设置-h localhost选项,可以完成数据的备份和恢复操作。此外,本文还提供了参考链接以获取更多详细信息。 ... [详细]
  • 本文讨论了在shiro java配置中加入Shiro listener后启动失败的问题。作者引入了一系列jar包,并在web.xml中配置了相关内容,但启动后却无法正常运行。文章提供了具体引入的jar包和web.xml的配置内容,并指出可能的错误原因。该问题可能与jar包版本不兼容、web.xml配置错误等有关。 ... [详细]
  • Java如何导入和导出Excel文件的方法和步骤详解
    本文详细介绍了在SpringBoot中使用Java导入和导出Excel文件的方法和步骤,包括添加操作Excel的依赖、自定义注解等。文章还提供了示例代码,并将代码上传至GitHub供访问。 ... [详细]
  • springboot启动不了_Spring Boot + MyBatis 多模块搭建教程
    作者:枫本非凡来源:www.cnblogs.comorzlinp9717399.html一、前言1、创建父工程最近公司项目准备开始重构,框 ... [详细]
  • 本文介绍了禅道作为一款国产开源免费的测试管理工具的特点和功能,并提供了禅道的搭建和调试方法。禅道是一款B/S结构的项目管理工具,可以实现组织管理、后台管理、产品管理、项目管理和测试管理等功能。同时,本文还介绍了其他软件测试相关工具,如功能自动化工具和性能自动化工具,以及白盒测试工具的使用。通过本文的阅读,读者可以了解禅道的基本使用方法和优势,从而更好地进行测试管理工作。 ... [详细]
  • 本文介绍了解决java开源项目apache commons email简单使用报错的方法,包括使用正确的JAR包和正确的代码配置,以及相关参数的设置。详细介绍了如何使用apache commons email发送邮件。 ... [详细]
  • 本文讨论了在Spring 3.1中,数据源未能自动连接到@Configuration类的错误原因,并提供了解决方法。作者发现了错误的原因,并在代码中手动定义了PersistenceAnnotationBeanPostProcessor。作者删除了该定义后,问题得到解决。此外,作者还指出了默认的PersistenceAnnotationBeanPostProcessor的注册方式,并提供了自定义该bean定义的方法。 ... [详细]
  • 使用在线工具jsonschema2pojo根据json生成java对象
    本文介绍了使用在线工具jsonschema2pojo根据json生成java对象的方法。通过该工具,用户只需将json字符串复制到输入框中,即可自动将其转换成java对象。该工具还能解析列表式的json数据,并将嵌套在内层的对象也解析出来。本文以请求github的api为例,展示了使用该工具的步骤和效果。 ... [详细]
  • 本文介绍了Web学习历程记录中关于Tomcat的基本概念和配置。首先解释了Web静态Web资源和动态Web资源的概念,以及C/S架构和B/S架构的区别。然后介绍了常见的Web服务器,包括Weblogic、WebSphere和Tomcat。接着详细讲解了Tomcat的虚拟主机、web应用和虚拟路径映射的概念和配置过程。最后简要介绍了http协议的作用。本文内容详实,适合初学者了解Tomcat的基础知识。 ... [详细]
author-avatar
H-蔡鸿晖_515
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有