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

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

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

EntityManager.manage介绍

[英]Begins management for the given entity and its children, recursively. depending on the implementation of the management context, this might push it out to one or more remote management nodes. Manage an entity.
[中]递归地开始对给定实体及其子实体的管理。根据管理上下文的实现,这可能会将其推送到一个或多个远程管理节点。管理一个实体。

代码示例

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

/**
 * Starts managing the given (unmanaged) app, setting the given brooklyn properties on the new
 * management context.
 *
 * @see #startManagement(Entity)
 * 
 * @deprecated since 0.9.0; entities are automatically managed when created via {@link Entity#addChild(EntitySpec)},
 *             or with {@link EntityManager#createEntity(EntitySpec)}. For top-level apps, use code like
 *             {@code managementContext.getEntityManager().createEntity(EntitySpec.create(...))}.
 */
@Deprecated
public static ManagementContext startManagement(Application app, BrooklynProperties props) {
  log.warn("Deprecated use of Entities.startManagement(Application, BrooklynProperties), for app "+app);
  
  if (isManaged(app)) {
    throw new IllegalStateException("Application "+app+" is already managed, so can't set brooklyn properties");
  }
  ManagementContext mgmt = new LocalManagementContext(props);
  mgmt.getEntityManager().manage(app);
  return mgmt;
}

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

/**
 * Starts managing the given (unmanaged) app, using the given management context.
 *
 * @see #startManagement(Entity)
 * 
 * @deprecated since 0.9.0; entities are automatically managed when created with 
 *             {@link EntityManager#createEntity(EntitySpec)}. For top-level apps, use code like
 *             {@code managementContext.getEntityManager().createEntity(EntitySpec.create(...))}.
 */
@Deprecated
public static ManagementContext startManagement(Application app, ManagementContext mgmt) {
  log.warn("Deprecated use of Entities.startManagement(Application, ManagementContext), for app "+app);
  
  if (isManaged(app)) {
    if (app.getManagementContext() == mgmt) {
      // no-op; app was presumably auto-managed
      return mgmt;
    } else {
      throw new IllegalStateException("Application "+app+" is already managed by "+app.getManagementContext()+", so cannot be managed by "+mgmt);
    }
  }
  mgmt.getEntityManager().manage(app);
  return mgmt;
}

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

public void attemptLegacyAutodeployment(String effectorName) {
  synchronized (this) {
    if (managementContext != null) {
      log.warn("Autodeployment suggested but not required for " + entity + "." + effectorName);
      return;
    }
    if (entity instanceof Application) {
      log.warn("Autodeployment with new management context triggered for " + entity + "." + effectorName + " -- will not be supported in future. Explicit manage call required.");
      if (initialManagementContext != null) {
        initialManagementContext.getEntityManager().manage(entity);
      } else {
        Entities.startManagement(entity);
      }
      return;
    }
  }
  if ("start".equals(effectorName)) {
    Entity e=entity;
    if (e.getParent()!=null && ((EntityInternal)e.getParent()).getManagementSupport().isDeployed()) { 
      log.warn("Autodeployment in parent's management context triggered for "+entity+"."+effectorName+" -- will not be supported in future. Explicit manage call required.");
      ((EntityInternal)e.getParent()).getManagementContext().getEntityManager().manage(entity);
      return;
    }
  }
  log.warn("Autodeployment not available for "+entity+"."+effectorName);
}

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

mgmt.getEntityManager().manage(eum);
  return mgmt;
  + "a new local management context is being created! (Not recommended unless you really know what you are doing.)");
ManagementContext mgmt = new LocalManagementContext();
mgmt.getEntityManager().manage(o);
return mgmt;

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

((EntityInternal)o).getManagementContext().getEntityManager().manage(eum);
return true;

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

EntitySpec<TestApplication> appSpec = EntitySpec.create(TestApplication.class);
final TestApplication app = emgr.createEntity(appSpec);
emgr.manage(app);
EntitySpec<?> latchEntitySpec = EntitySpec.create(EmptySoftwareProcess.class);
final Entity entity = app.createAndManageChild(latchEntitySpec);

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

EntitySpec<TestApplication> appSpec = EntitySpec.create(TestApplication.class);
TestApplication app = emgr.createEntity(appSpec);
emgr.manage(app);
EntitySpec<?> latchEntitySpec = EntitySpec.create(EmptySoftwareProcess.class);
Entity entity = app.createAndManageChild(latchEntitySpec);

相关文章