本文整理了Java中brooklyn.entity.basic.Entities.manage()
方法的一些代码示例,展示了Entities.manage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entities.manage()
方法的具体详情如下:
包路径:brooklyn.entity.basic.Entities
类名称:Entities
方法名:manage
[英]brings this entity under management iff its ancestor is managed, returns true in that case; otherwise returns false in the expectation that the ancestor will become managed, or throws exception if it has no parent or a non-application root (will throw if e is an Application; see also #startManagement(Entity) )
[中]将该实体置于管理之下,如果其祖先被管理,则在这种情况下返回true;否则返回false,期望祖先将被管理,或者如果它没有父级或非应用程序根,则抛出异常(如果e是应用程序,则抛出异常;另请参见#startManagement(Entity))
代码示例来源:origin: io.brooklyn/brooklyn-core
/**
* @deprecated since 0.6; use {@link #addNode(Location)}, so can take that location into account when configuring node
*/
protected Entity addNode() {
Map<?,?> creation = Maps.newLinkedHashMap(getCustomChildFlags());
if (LOG.isDebugEnabled()) LOG.debug("Creating and adding a node to cluster {}({}) with properties {}", new Object[] {this, getId(), creation});
Entity entity = createNode(null, creation);
Entities.manage(entity);
addMember(entity);
return entity;
}
代码示例来源:origin: io.brooklyn/brooklyn-core
@Override
public void addLocations(Collection<? extends Location> newLocations) {
synchronized (locations) {
List<Location> oldLocations = locations.get();
Set<Location> truelyNewLocations = Sets.newLinkedHashSet(newLocations);
truelyNewLocations.removeAll(oldLocations);
if (truelyNewLocations.size() > 0) {
locations.set(ImmutableList.<Location>builder().addAll(oldLocations).addAll(truelyNewLocations).build());
}
}
if (getManagementSupport().isDeployed()) {
for (Location newLocation : newLocations) {
// Location is now reachable, so manage it
// TODO will not be required in future releases when creating locations always goes through LocationManager.createLocation(LocationSpec).
Entities.manage(newLocation, getManagementContext());
}
}
getManagementSupport().getEntityChangeListener().onLocationsChanged();
}
代码示例来源:origin: io.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<? extends Location> locations) {
if (!isManaged(e) && !manage(e)) {
log.warn("Using 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((EntityLocal)e, e, Startable.START,
MutableMap.of("locations", locations)).getUnchecked();
}
代码示例来源:origin: io.brooklyn/brooklyn-software-messaging
public RabbitQueue createQueue(Map properties) {
RabbitQueue result = addChild(EntitySpec.create(RabbitQueue.class).configure(properties));
Entities.manage(result);
result.create();
return result;
}
代码示例来源:origin: io.brooklyn/brooklyn-software-messaging
@Override
public ActiveMQQueue createQueue(Map properties) {
ActiveMQQueue result = addChild(EntitySpec.create(ActiveMQQueue.class).configure(properties));
Entities.manage(result);
result.create();
return result;
}
代码示例来源:origin: io.brooklyn/brooklyn-software-messaging
public QpidTopic createTopic(Map properties) {
QpidTopic result = addChild(EntitySpec.create(QpidTopic.class).configure(properties));
Entities.manage(result);
result.create();
return result;
}
代码示例来源:origin: io.brooklyn/brooklyn-software-messaging
public KafkaTopic createTopic(Map<?, ?> properties) {
KafkaTopic result = addChild(EntitySpec.create(KafkaTopic.class).configure(properties));
Entities.manage(result);
result.create();
return result;
}
代码示例来源:origin: io.brooklyn/brooklyn-software-messaging
public QpidQueue createQueue(Map properties) {
QpidQueue result = addChild(EntitySpec.create(QpidQueue.class).configure(properties));
Entities.manage(result);
result.create();
return result;
}
代码示例来源:origin: io.brooklyn/brooklyn-software-messaging
@Override
public ActiveMQTopic createTopic(Map properties) {
ActiveMQTopic result = addChild(EntitySpec.create(ActiveMQTopic.class).configure(properties));
Entities.manage(result);
result.create();
return result;
}
代码示例来源:origin: io.brooklyn/brooklyn-software-messaging
if (Entities.isManaged(this)) Entities.manage(zookeeper);
setAttribute(ZOOKEEPER, zookeeper);
if (Entities.isManaged(this)) Entities.manage(cluster);
setAttribute(CLUSTER, cluster);
代码示例来源:origin: io.brooklyn/brooklyn-software-webapp
if (Entities.isManaged(this)) Entities.manage(cluster);
setAttribute(CLUSTER, cluster);
if (Entities.isManaged(this)) Entities.manage(controller);
setAttribute(CONTROLLER, controller);
代码示例来源:origin: io.brooklyn/brooklyn-core
if (isQuarantineEnabled()) {
Group quarantineGroup = addChild(EntitySpec.create(BasicGroup.class).displayName("quarantine"));
Entities.manage(quarantineGroup);
setAttribute(QUARANTINE_GROUP, quarantineGroup);
代码示例来源:origin: io.brooklyn/brooklyn-core
protected Entity addCluster(Location location) {
String locationName = elvis(location.getLocationProperty("displayName"), location.getDisplayName(), null);
Map creation = Maps.newLinkedHashMap();
creation.putAll(getCustomChildFlags());
if (truth(getDisplayNamePrefix()) || truth(getDisplayNameSuffix())) {
String displayName = "" + elvis(getDisplayNamePrefix(), "") + elvis(locationName, "unnamed") + elvis(getDisplayNameSuffix(),"");
creation.put("displayName", displayName);
}
logger.info("Creating entity in fabric {} at {}{}", new Object[] {this, location,
(creation!=null && !creation.isEmpty() ? ", properties "+creation : "") });
Entity entity = createCluster(location, creation);
if (locationName != null) {
if (entity.getDisplayName()==null)
((EntityLocal)entity).setDisplayName(entity.getEntityType().getSimpleName() +" ("+locationName+")");
else if (!entity.getDisplayName().contains(locationName))
((EntityLocal)entity).setDisplayName(entity.getDisplayName() +" ("+locationName+")");
}
if (entity.getParent()==null) entity.setParent(this);
Entities.manage(entity);
addMember(entity);
fabricSizeEnricher.addProducer(entity);
return entity;
}
代码示例来源:origin: io.brooklyn/brooklyn-software-nosql
@Override
public void start(Collection<? extends Location> locations) {
master = addChild(EntitySpec.create(RedisStore.class));
Entities.manage(master);
master.start(locations);
slaves = addChild(EntitySpec.create(DynamicCluster.class)
.configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(RedisSlave.class).configure(RedisSlave.MASTER, master)));
slaves.start(locations);
setAttribute(Startable.SERVICE_UP, calculateServiceUp());
}
内容来源于网络,如有侵权,请联系作者删除!