public class DslComponent extends BrooklynDslDeferredSupplier<Entity> implements DslFunctionSource
Modifier and Type | Class and Description |
---|---|
static class |
DslComponent.Scope |
ImmediateSupplier.ImmediateUnsupportedException, ImmediateSupplier.ImmediateValueNotAvailableException
Constructor and Description |
---|
DslComponent(DslComponent.Scope scope)
Resolve in scope relative to the current
BrooklynTaskTags#getTargetOrContextEntity) target or context entity
(where the scope defines an unambiguous relationship that will resolve to a single
component - e.g. |
DslComponent(DslComponent.Scope scope,
DeferredSupplier<?> componentIdSupplier) |
DslComponent(DslComponent.Scope scope,
java.lang.String componentId)
Resolve componentId in scope relative to the current
BrooklynTaskTags#getTargetOrContextEntity) target or context entity. |
DslComponent(DslComponent scopeComponent,
DslComponent.Scope scope)
Resolve in scope relative to
scopeComponent entity
(where the scope defines an unambiguous relationship that will resolve to a single
component - e.g. |
DslComponent(DslComponent scopeComponent,
DslComponent.Scope scope,
DeferredSupplier<?> componentIdSupplier)
Resolve componentId in scope relative to scopeComponent.
|
DslComponent(DslComponent scopeComponent,
DslComponent.Scope scope,
java.lang.String componentId)
Resolve componentId in scope relative to scopeComponent.
|
DslComponent(java.lang.String componentId)
Deprecated.
since 0.10.0; pass the
DslComponent.Scope explicitly. |
Modifier and Type | Method and Description |
---|---|
DslComponent |
ancestor(java.lang.Object id) |
BrooklynDslDeferredSupplier<?> |
attributeWhenReady(java.lang.Object sensorNameOrSupplier) |
DslComponent |
child(java.lang.Object id) |
DslComponent |
component(java.lang.Object id)
Deprecated.
|
DslComponent |
component(java.lang.String scope,
java.lang.Object id) |
BrooklynDslDeferredSupplier<?> |
config(java.lang.Object keyNameOrSupplier) |
DslComponent |
descendant(java.lang.Object id) |
DslComponent |
entity(java.lang.Object id) |
BrooklynDslDeferredSupplier<?> |
entityId() |
boolean |
equals(java.lang.Object obj) |
Maybe<Entity> |
getImmediately()
Gets the value promptly, or returns
Maybe.absent() if the value requires blocking,
or throws ImmediateSupplier.ImmediateUnsupportedException if it cannot be determined whether the value requires blocking or not. |
DslComponent.Scope |
getScope() |
int |
hashCode() |
BrooklynDslDeferredSupplier<java.lang.Object> |
location() |
BrooklynDslDeferredSupplier<java.lang.Object> |
location(java.lang.Object index) |
static DslComponent |
newInstance(DslComponent.Scope scope,
java.lang.Object componentId)
Checks the type of
componentId to create the right kind of DslComponent
(based on whether the componentId is already resolved. |
static DslComponent |
newInstance(DslComponent scopeComponent,
DslComponent.Scope scope,
java.lang.Object componentId)
Checks the type of
componentId to create the right kind of DslComponent
(based on whether the componentId is already resolved. |
Task<Entity> |
newTask() |
DslComponent |
parent() |
DslComponent |
root() |
DslComponent |
scopeRoot() |
DslComponent |
self() |
BrooklynDslDeferredSupplier<Sensor<?>> |
sensor(java.lang.Object sensorIndicator) |
DslComponent |
sibling(java.lang.Object id) |
java.lang.Object |
template(java.lang.Object template) |
java.lang.Object |
template(java.lang.Object template,
java.util.Map<?,?> substitutions) |
java.lang.String |
toString() |
get
@Deprecated public DslComponent(java.lang.String componentId)
DslComponent.Scope
explicitly.DslComponent.Scope.GLOBAL
scope.public DslComponent(DslComponent.Scope scope)
BrooklynTaskTags#getTargetOrContextEntity) target or context
entity
(where the scope defines an unambiguous relationship that will resolve to a single
component - e.g. "parent").public DslComponent(DslComponent scopeComponent, DslComponent.Scope scope)
scopeComponent
entity
(where the scope defines an unambiguous relationship that will resolve to a single
component - e.g. "parent").public DslComponent(DslComponent.Scope scope, java.lang.String componentId)
BrooklynTaskTags#getTargetOrContextEntity) target or context
entity.public DslComponent(DslComponent.Scope scope, DeferredSupplier<?> componentIdSupplier)
public DslComponent(DslComponent scopeComponent, DslComponent.Scope scope, java.lang.String componentId)
public DslComponent(DslComponent scopeComponent, DslComponent.Scope scope, DeferredSupplier<?> componentIdSupplier)
public static DslComponent newInstance(DslComponent scopeComponent, DslComponent.Scope scope, java.lang.Object componentId)
componentId
to create the right kind of DslComponent
(based on whether the componentId is already resolved. Accepts either a String
or a
DeferredSupplier
.public static DslComponent newInstance(DslComponent.Scope scope, java.lang.Object componentId)
componentId
to create the right kind of DslComponent
(based on whether the componentId is already resolved. Accepts either a String
or a
DeferredSupplier
.public DslComponent.Scope getScope()
public final Maybe<Entity> getImmediately()
ImmediateSupplier
Maybe.absent()
if the value requires blocking,
or throws ImmediateSupplier.ImmediateUnsupportedException
if it cannot be determined whether the value requires blocking or not.
The Maybe.absent()
returned here indicates that a value definitively is pending, just it is not yet available,
and an attempt to Maybe.get()
it should throw an ImmediateSupplier.ImmediateValueNotAvailableException
;
it can be created with ImmediateSupplier.ImmediateValueNotAvailableException.newAbsentWithExceptionSupplier()
to
avoid creating traces (or simply with Maybe.absent(new ImmediateValueNotAvailableException(...))
).
This is in contrast with this method throwing a ImmediateSupplier.ImmediateUnsupportedException
which should be done
if the presence of an eventual value cannot even be determined in a non-blocking way.
Implementations of this method should typically catch the former exception if encountered and return a
Maybe.absent()
wrapping it, whereas ImmediateSupplier.ImmediateUnsupportedException
instances should be propagated.
getImmediately
in interface ImmediateSupplier<Entity>
public Task<Entity> newTask()
newTask
in interface TaskFactory<Task<Entity>>
newTask
in class BrooklynDslDeferredSupplier<Entity>
public DslComponent entity(java.lang.Object id)
public DslComponent child(java.lang.Object id)
public DslComponent sibling(java.lang.Object id)
public DslComponent descendant(java.lang.Object id)
public DslComponent ancestor(java.lang.Object id)
public DslComponent root()
public DslComponent scopeRoot()
@Deprecated public DslComponent component(java.lang.Object id)
public DslComponent self()
public DslComponent parent()
public DslComponent component(java.lang.String scope, java.lang.Object id)
public BrooklynDslDeferredSupplier<?> entityId()
public BrooklynDslDeferredSupplier<?> attributeWhenReady(java.lang.Object sensorNameOrSupplier)
public BrooklynDslDeferredSupplier<?> config(java.lang.Object keyNameOrSupplier)
public BrooklynDslDeferredSupplier<Sensor<?>> sensor(java.lang.Object sensorIndicator)
public BrooklynDslDeferredSupplier<java.lang.Object> location()
public BrooklynDslDeferredSupplier<java.lang.Object> location(java.lang.Object index)
public java.lang.Object template(java.lang.Object template)
public java.lang.Object template(java.lang.Object template, java.util.Map<?,?> substitutions)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object