Brooklyn

brooklyn.entity.basic
[Java] Class Entities

java.lang.Object
  brooklyn.entity.basic.Entities

public class Entities

Convenience methods for working with entities.

Also see the various *Methods classes for traits, such as StartableMethods for Startable implementations.


Method Summary
static Supplier attributeSupplier(Entity entity, AttributeSensor sensor)

static Supplier attributeSupplier(EntityAndAttribute tuple)

static Supplier attributeSupplierWhenReady(EntityAndAttribute tuple)

static Supplier attributeSupplierWhenReady(Entity entity, AttributeSensor sensor)

static void destroy(Entity e)

stops, destroys, and unmanages the given entity -- does as many as are valid given the type and state

static void destroyAll(ManagementContext mgmt)

stops, destroys, and unmanages all apps in the given context, and then terminates the management context

static void destroyAll(Application app)

static void destroyAllCatching(ManagementContext mgmt)

as destroyAll(ManagementContext) but catching all errors

static void destroyCatching(Entity entity)

as destroy(Entity) but catching all errors

static void dumpInfo(java.lang.Iterable entities)

static void dumpInfo(Entity e)

static void dumpInfo(Entity e, java.io.Writer out)

static void dumpInfo(Entity e, java.lang.String currentIndentation, java.lang.String tab)

static void dumpInfo(Entity e, java.io.Writer out, java.lang.String currentIndentation, java.lang.String tab)

static void dumpInfo(Location loc)

static void dumpInfo(Location loc, java.io.Writer out)

static void dumpInfo(Location loc, java.lang.String currentIndentation, java.lang.String tab)

static void dumpInfo(Location loc, java.io.Writer out, java.lang.String currentIndentation, java.lang.String tab)

static void dumpInfo(Policy pol)

static void dumpInfo(Policy pol, java.io.Writer out)

static void dumpInfo(Policy pol, java.lang.String currentIndentation, java.lang.String tab)

static void dumpInfo(Policy pol, java.io.Writer out, java.lang.String currentIndentation, java.lang.String tab)

static java.lang.String getRequiredUrlConfig(Entity entity, ConfigKey urlKey)

as getRequiredUrlConfig(Entity, ConfigKey)

static java.lang.String getRequiredUrlConfig(Entity entity, HasConfigKey urlKey)

static Task invokeEffector(EntityLocal callingEntity, Entity entityToCall, Effector effector, java.util.Map parameters)

static Task invokeEffector(EntityLocal callingEntity, Entity entityToCall, Effector effector)

static Task invokeEffector(EntityLocal callingEntity, java.lang.Iterable entitiesToCall, Effector effector, java.util.Map parameters)

convenience - invokes in parallel if multiple, but otherwise invokes the item directly

static Task invokeEffector(EntityLocal callingEntity, java.lang.Iterable entitiesToCall, Effector effector)

convenience - invokes in parallel if multiple, but otherwise invokes the item directly

static Task invokeEffectorList(EntityLocal callingEntity, java.lang.Iterable entitiesToCall, Effector effector, java.util.Map parameters)

Invokes an Effector on multiple entities, with the named arguments from the parameters java.util.Map using the context of the provided Entity.

static Task invokeEffectorList(EntityLocal callingEntity, java.lang.Iterable entitiesToCall, Effector effector)

static Task invokeEffectorListWithArgs(EntityLocal callingEntity, java.lang.Iterable entitiesToCall, Effector effector, java.lang.Object... args)

static Task invokeEffectorListWithMap(EntityLocal callingEntity, java.lang.Iterable entitiesToCall, Effector effector, java.util.Map parameters)

static Task invokeEffectorWithArgs(EntityLocal callingEntity, Entity entityToCall, Effector effector, java.lang.Object... args)

static Task invokeEffectorWithMap(EntityLocal callingEntity, Entity entityToCall, Effector effector, java.util.Map parameters)

@deprecated since 0.6.0 use invokeEffector

static void invokeStopOnShutdown(Entity entity)

static boolean isAncestor(Entity descendant, Entity potentialAncestor)

static boolean isDescendant(Entity ancestor, Entity potentialDescendant)

note, it is usually preferred to use isAncestor() and swap the order, it is a cheaper method

static boolean isManaged(Entity e)

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) )

static boolean isSecret(java.lang.String name)

static boolean isTrivial(java.lang.Object v)

static boolean manage(Entity e)

static void manage(Location loc, ManagementContext managementContext)

Registers the given location (and all its children) with the management context.

static DownloadResolver newDownloader(EntityDriver driver)

static DownloadResolver newDownloader(EntityDriver driver, java.util.Map properties)

static ManagementContext newManagementContext()

static ManagementContext newManagementContext(BrooklynProperties props)

static ManagementContext newManagementContext(java.util.Map props)

static java.util.Map sanitize(java.util.Map input)

static java.util.List sortConfigKeys(java.util.Set configs)

static java.util.Map sortMap(java.util.Map map)

static java.util.List sortSensors(java.util.Set sensors)

static void start(Entity e, java.util.Collection locations)

convenience for starting an entity, esp a new Startable instance which has been created dynamically (after the application is started)

static ManagementContext startManagement(Entity e)

brings this entity under management, creating a local management context if necessary (assuming root is an application).

static ManagementContext startManagement(Application app, ManagementContext mgmt)

Starts managing the given (unmanaged) app, using the given management context.

static ManagementContext startManagement(Application app, BrooklynProperties props)

static java.lang.Object submit(Entity entity, TaskFactory taskFactory)

static java.lang.Object submit(Entity entity, java.lang.Object task)

submits a task to run at the entity

static void unmanage(Entity entity)

static void warnOnIgnoringConfig(Entity entity, ConfigKey key)

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Method Detail

attributeSupplier

public static Supplier attributeSupplier(Entity entity, AttributeSensor sensor)


attributeSupplier

public static Supplier attributeSupplier(EntityAndAttribute tuple)


attributeSupplierWhenReady

public static Supplier attributeSupplierWhenReady(EntityAndAttribute tuple)


attributeSupplierWhenReady

}
public static Supplier attributeSupplierWhenReady(Entity entity, AttributeSensor sensor)


destroy

public static void destroy(Entity e)
stops, destroys, and unmanages the given entity -- does as many as are valid given the type and state


destroyAll

public static void destroyAll(ManagementContext mgmt)
stops, destroys, and unmanages all apps in the given context, and then terminates the management context


destroyAll

public static boolean isManaged(Entity e) {
public static void destroyAll(Application app)


destroyAllCatching

public static void destroyAllCatching(ManagementContext mgmt)
as destroyAll(ManagementContext) but catching all errors


destroyCatching

public static void destroyCatching(Entity entity)
as destroy(Entity) but catching all errors


dumpInfo

public static void dumpInfo(java.lang.Iterable entities)


dumpInfo

public static void dumpInfo(Entity e)


dumpInfo

public static void dumpInfo(Entity e, java.io.Writer out)


dumpInfo

public static void dumpInfo(Entity e, java.lang.String currentIndentation, java.lang.String tab)


dumpInfo

public static void dumpInfo(Entity e, java.io.Writer out, java.lang.String currentIndentation, java.lang.String tab)


dumpInfo

public static void dumpInfo(Location loc)


dumpInfo

public static void dumpInfo(Location loc, java.io.Writer out)


dumpInfo

public static void dumpInfo(Location loc, java.lang.String currentIndentation, java.lang.String tab)


dumpInfo

keyO instanceof HasConfigKey ? ((HasConfigKey)keyO).getConfigKey().getName() :
public static void dumpInfo(Location loc, java.io.Writer out, java.lang.String currentIndentation, java.lang.String tab)


dumpInfo

public static void dumpInfo(Policy pol)


dumpInfo

public static void dumpInfo(Policy pol, java.io.Writer out)


dumpInfo

public static void dumpInfo(Policy pol, java.lang.String currentIndentation, java.lang.String tab)


dumpInfo

public static void dumpInfo(Policy pol, java.io.Writer out, java.lang.String currentIndentation, java.lang.String tab)


getRequiredUrlConfig

public static java.lang.String getRequiredUrlConfig(Entity entity, ConfigKey urlKey)
as getRequiredUrlConfig(Entity, ConfigKey)


getRequiredUrlConfig

public static java.lang.String getRequiredUrlConfig(Entity entity, HasConfigKey urlKey)


invokeEffector

public static Task invokeEffector(EntityLocal callingEntity, Entity entityToCall, Effector effector, java.util.Map parameters)


invokeEffector

public static Task invokeEffector(EntityLocal callingEntity, Entity entityToCall, Effector effector)


invokeEffector

public static Task invokeEffector(EntityLocal callingEntity, java.lang.Iterable entitiesToCall, Effector effector, java.util.Map parameters)
convenience - invokes in parallel if multiple, but otherwise invokes the item directly


invokeEffector

public static Task invokeEffector(EntityLocal callingEntity, java.lang.Iterable entitiesToCall, Effector effector)
convenience - invokes in parallel if multiple, but otherwise invokes the item directly


invokeEffectorList

public static Task invokeEffectorList(EntityLocal callingEntity, java.lang.Iterable entitiesToCall, Effector effector, java.util.Map parameters)
Invokes an Effector on multiple entities, with the named arguments from the parameters java.util.Map using the context of the provided Entity.

Intended for use only from the callingEntity.

Returns a ParallelTask containing the results from each tasks invocation. Calling java.util.concurrent.Future#get() get() on this will block until all tasks are complete, and will throw an exception if any task resulted in an error.

Returns:
ParallelTask containing results from each invocation


invokeEffectorList

public static Task invokeEffectorList(EntityLocal callingEntity, java.lang.Iterable entitiesToCall, Effector effector)


invokeEffectorListWithArgs

final Effector effector, Object ...args) {
public static Task invokeEffectorListWithArgs(EntityLocal callingEntity, java.lang.Iterable entitiesToCall, Effector effector, java.lang.Object... args)


invokeEffectorListWithMap

public static Task invokeEffectorListWithMap(EntityLocal callingEntity, java.lang.Iterable entitiesToCall, Effector effector, java.util.Map parameters)


invokeEffectorWithArgs

}
public static Task invokeEffectorWithArgs(EntityLocal callingEntity, Entity entityToCall, Effector effector, java.lang.Object... args)


invokeEffectorWithMap

ableList.of(entityToCall), effector, parameters);
public static Task invokeEffectorWithMap(EntityLocal callingEntity, Entity entityToCall, Effector effector, java.util.Map parameters)
deprecated:
since 0.6.0 use invokeEffector


invokeStopOnShutdown

public static void invokeStopOnShutdown(Entity entity)


isAncestor

public static boolean isAncestor(Entity descendant, Entity potentialAncestor)


isDescendant

public static boolean isDescendant(Entity ancestor, Entity potentialDescendant)
note, it is usually preferred to use isAncestor() and swap the order, it is a cheaper method


isManaged

public static boolean isManaged(Entity e)
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) )


isSecret

public static boolean isSecret(java.lang.String name)


isTrivial

public static boolean isTrivial(java.lang.Object v)


manage

public static boolean manage(Entity e)


manage

public static void manage(Location loc, ManagementContext managementContext)
Registers the given location (and all its children) with the management context.
throws:
IllegalStateException if the parent location is not already managed
deprecated:
in 0.6.0; use LocationManager#createLocation(LocationSpec)#createLocation(LocationSpec) instead.
Since:
0.6.0 (added only for backwards compatibility, where locations are being created directly).


newDownloader

public static DownloadResolver newDownloader(EntityDriver driver)


newDownloader

public static DownloadResolver newDownloader(EntityDriver driver, java.util.Map properties)


newManagementContext

public static ManagementContext newManagementContext()


newManagementContext

public static ManagementContext newManagementContext(BrooklynProperties props)


newManagementContext

public static ManagementContext newManagementContext(java.util.Map props)


sanitize

public static java.util.Map sanitize(java.util.Map input)


sortConfigKeys

});
public static java.util.List sortConfigKeys(java.util.Set configs)


sortMap

public static java.util.Map sortMap(java.util.Map map)


sortSensors

});
public static java.util.List sortSensors(java.util.Set sensors)


start

public static void start(Entity e, java.util.Collection locations)
convenience for starting an entity, esp a new Startable instance which has been created dynamically (after the application is started)


startManagement

public static ManagementContext startManagement(Entity e)
brings this entity under management, creating a local management context if necessary (assuming root is an application). returns existing management context if there is one (non-deployment), or new local mgmt context if not, or throwing exception if root is not an application

callers are recommended to use manage(Entity) instead unless they know a plain-vanilla non-root management context is sufficient (e.g. in tests)

this method may change, but is provided as a stop-gap to prevent ad-hoc things being done in the code which are even more likely to break!


startManagement

public static ManagementContext startManagement(Application app, ManagementContext mgmt)
Starts managing the given (unmanaged) app, using the given management context.
See Also:
startManagement(Entity)


startManagement

public static ManagementContext startManagement(Application app, BrooklynProperties props)


submit

public static java.lang.Object submit(Entity entity, TaskFactory taskFactory)


submit

public static java.lang.Object submit(Entity entity, java.lang.Object task)
submits a task to run at the entity


unmanage

public static void unmanage(Entity entity)


warnOnIgnoringConfig

public static void warnOnIgnoringConfig(Entity entity, ConfigKey key)


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.