public class EntityManagementUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
EntityManagementUtils.CreationResult<T,U>
container for operation which creates something and which wants to return both
the items created and any pending create/start task
|
Modifier and Type | Field and Description |
---|---|
static ConfigKey<java.lang.Boolean> |
WRAPPER_APP_MARKER
A marker config value which indicates that an
Application entity was created automatically,
needed because a plan might give multiple top-level entities or a non-Application top-level entity,
in a context where Brooklyn requires an Application at the root. |
Constructor and Description |
---|
EntityManagementUtils() |
Modifier and Type | Method and Description |
---|---|
static EntityManagementUtils.CreationResult<java.util.List<Entity>,java.util.List<java.lang.String>> |
addChildren(Entity parent,
java.lang.String yaml,
java.lang.Boolean start) |
static EntityManagementUtils.CreationResult<java.util.List<Entity>,java.util.List<java.lang.String>> |
addChildrenStarting(Entity parent,
java.lang.String yaml) |
static java.util.List<Entity> |
addChildrenUnstarted(Entity parent,
java.lang.String yaml)
adds entities from the given yaml, under the given parent; but does not start them
|
static boolean |
canUnwrapApplication(EntitySpec<? extends Application> wrapperApplication)
As
canUnwrapEntity(EntitySpec)
but additionally requiring that the wrapped item is an Application ,
for use when the context requires an Application ie a root of a spec. |
static boolean |
canUnwrapEntity(EntitySpec<? extends Entity> spec)
Returns true if the spec is for a wrapper app with no important settings, wrapping a single child entity.
|
static EntitySpec<? extends Application> |
createEntitySpecForApplication(ManagementContext mgmt,
java.lang.String plan) |
static EntitySpec<? extends Application> |
createEntitySpecForApplication(ManagementContext mgmt,
java.lang.String format,
java.lang.String plan) |
static <T extends Application> |
createStarting(ManagementContext mgmt,
EntitySpec<T> appSpec) |
static EntityManagementUtils.CreationResult<? extends Application,java.lang.Void> |
createStarting(ManagementContext mgmt,
java.lang.String appSpec) |
static <T extends Application> |
createUnstarted(ManagementContext mgmt,
EntitySpec<T> spec)
creates an application from the given app spec, managed by the given management context
|
static <T extends Application> |
createUnstarted(ManagementContext mgmt,
EntitySpec<T> spec,
<any> entityId)
As
createUnstarted(ManagementContext, EntitySpec) , but uses the given entity id (if present). |
static Application |
createUnstarted(ManagementContext mgmt,
java.lang.String plan)
as
createUnstarted(ManagementContext, EntitySpec) but for a string plan (e.g. |
static boolean |
isWrapperApp(EntitySpec<?> spec) |
static EntitySpec<? extends Application> |
newWrapperApp() |
static <T extends Application> |
start(T app) |
static EntitySpec<? extends Application> |
unwrapApplication(EntitySpec<? extends Application> wrapperApplication)
Unwraps a wrapped
Application if appropriate. |
static EntitySpec<? extends Entity> |
unwrapEntity(EntitySpec<? extends Entity> wrapperApplication)
Unwraps a single
Entity if appropriate. |
public static final ConfigKey<java.lang.Boolean> WRAPPER_APP_MARKER
Application
entity was created automatically,
needed because a plan might give multiple top-level entities or a non-Application top-level entity,
in a context where Brooklyn requires an Application
at the root.
Typically when such a wrapper app wraps another Application
(or where we are looking for a single Entity
, or a list to add, and they are so wrapped)
it will be unwrapped.
See newWrapperApp()
and unwrapApplication(EntitySpec)
.
public static <T extends Application> T createUnstarted(ManagementContext mgmt, EntitySpec<T> spec)
public static <T extends Application> T createUnstarted(ManagementContext mgmt, EntitySpec<T> spec, <any> entityId)
createUnstarted(ManagementContext, EntitySpec)
, but uses the given entity id (if present).public static Application createUnstarted(ManagementContext mgmt, java.lang.String plan)
createUnstarted(ManagementContext, EntitySpec)
but for a string plan (e.g. camp yaml)public static EntitySpec<? extends Application> createEntitySpecForApplication(ManagementContext mgmt, java.lang.String plan)
public static EntitySpec<? extends Application> createEntitySpecForApplication(ManagementContext mgmt, java.lang.String format, java.lang.String plan)
public static <T extends Application> EntityManagementUtils.CreationResult<T,java.lang.Void> createStarting(ManagementContext mgmt, EntitySpec<T> appSpec)
public static EntityManagementUtils.CreationResult<? extends Application,java.lang.Void> createStarting(ManagementContext mgmt, java.lang.String appSpec)
public static <T extends Application> EntityManagementUtils.CreationResult<T,java.lang.Void> start(T app)
public static EntityManagementUtils.CreationResult<java.util.List<Entity>,java.util.List<java.lang.String>> addChildren(Entity parent, java.lang.String yaml, java.lang.Boolean start)
public static java.util.List<Entity> addChildrenUnstarted(Entity parent, java.lang.String yaml)
public static EntityManagementUtils.CreationResult<java.util.List<Entity>,java.util.List<java.lang.String>> addChildrenStarting(Entity parent, java.lang.String yaml)
public static EntitySpec<? extends Entity> unwrapEntity(EntitySpec<? extends Entity> wrapperApplication)
Entity
if appropriate. See WRAPPER_APP_MARKER
.
Also see canUnwrapEntity(EntitySpec)
to test whether it will unwrap.public static EntitySpec<? extends Application> unwrapApplication(EntitySpec<? extends Application> wrapperApplication)
Application
if appropriate.
This is like canUnwrapEntity(EntitySpec)
with an additional check that the wrapped child is an Application
.
See WRAPPER_APP_MARKER
for an overview.
Also see canUnwrapApplication(EntitySpec)
to test whether it will unwrap.public static EntitySpec<? extends Application> newWrapperApp()
public static boolean canUnwrapApplication(EntitySpec<? extends Application> wrapperApplication)
canUnwrapEntity(EntitySpec)
but additionally requiring that the wrapped item is an Application
,
for use when the context requires an Application
ie a root of a spec.WRAPPER_APP_MARKER
public static boolean canUnwrapEntity(EntitySpec<? extends Entity> spec)
Application
;
see canUnwrapApplication(EntitySpec)
if that is required).
Note callers will normally use one of unwrapEntity(EntitySpec)
or unwrapApplication(EntitySpec)
.
for an overview
public static boolean isWrapperApp(EntitySpec<?> spec)