|
Brooklyn | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD |
java.lang.Objectgroovy.lang.GroovyObjectSupport
brooklyn.entity.basic.AbstractEntity
abstract class AbstractEntity extends groovy.lang.GroovyObjectSupport
Default Entity implementation. Provides several common fields (name, id); a map config which contains arbitrary config data; sensors and effectors; policies; managementContext.
Fields in config can be accessed (get and set) without referring to config, (through use of propertyMissing). Note that config is typically inherited by children, whereas the fields are not. (Attributes cannot be so accessed, nor are they inherited.)
Field Summary | |
---|---|
protected static Logger |
LOG
|
static BasicNotificationSensor |
SENSOR_ADDED
|
static BasicNotificationSensor |
SENSOR_REMOVED
|
protected SubscriptionTracker |
_subscriptionTracker
|
protected EntityReference |
application
|
protected AttributeMap |
attributesInternal
The sensor-attribute values of this entity. |
protected ConfigMap |
configsInternal
The config values of this entity. |
protected ExecutionContext |
execution
|
protected ManagementContext |
managementContext
|
java.lang.Object |
managementData
Field for use only by management plane, to record remote destination when proxied. |
protected SubscriptionContext |
subscription
|
protected java.util.Map |
tempWorkings
For temporary data, e.g. timestamps etc for calculating real attribute values, such as when calculating averages over time etc. |
Property Summary | |
---|---|
java.lang.String |
displayName
|
java.util.Collection |
enrichers
|
EntityCollectionReference |
groups
|
java.lang.String |
id
|
java.util.Collection |
locations
|
EntityCollectionReference |
ownedChildren
|
EntityReference |
owner
|
java.util.Collection |
policies
|
java.util.Map |
presentationAttributes
|
boolean |
previouslyOwned
|
Constructor Summary | |
AbstractEntity(Entity owner)
|
|
AbstractEntity(java.util.Map flags = [:], Entity owner = null)
|
Method Summary | |
---|---|
void
|
addEnricher(AbstractEnricher enricher)
|
void
|
addGroup(Group e)
Adds this as a member of the given group, registers with application if necessary |
Entity
|
addOwnedChild(Entity child)
Adds the given entity as a member of this group and this group as one of the groups of the child; returns argument passed in, for convenience. |
void
|
addPolicy(AbstractPolicy policy)
|
protected void
|
assertNotYetOwned()
|
void
|
clearOwner()
|
Entity
|
configure(java.util.Map flags = [:])
sets fields from flags; can be overridden if needed, subclasses should set custom fields before _invoking_ this super (and they nearly always should invoke the super) |
Entity
|
configure(ConfigKey key, java.lang.Object value)
Sets a config key value, and returns this Entity instance for use in fluent-API style coding. |
void
|
destroy()
Should be invoked at end-of-life to clean up the item. |
void
|
emit(Sensor sensor, java.lang.Object val)
|
void
|
emitInternal(Sensor sensor, java.lang.Object val)
|
Location
|
firstLocation()
|
java.util.Map
|
getAllConfig()
|
Application
|
getApplication()
Returns the application, looking it up if not yet known (registering if necessary) |
java.lang.String
|
getApplicationId()
|
java.lang.Object
|
getAttribute(AttributeSensor attribute)
|
java.lang.Object
|
getAttributeByNameParts(java.util.List nameParts)
|
java.lang.Object
|
getConfig(ConfigKey key)
|
java.lang.Object
|
getConfig(HasConfigKey key)
|
java.lang.Object
|
getConfig(HasConfigKey key, java.lang.Object defaultValue)
|
java.lang.Object
|
getConfig(ConfigKey key, java.lang.Object defaultValue)
|
ConfigMap
|
getConfigMap()
|
Effector
|
getEffector(java.lang.String effectorName)
Convenience for finding named effector in getEffectors() java.util.Map. |
java.util.Collection
|
getEnrichers()
|
EntityType
|
getEntityType()
|
ExecutionContext
|
getExecutionContext()
|
java.util.Collection
|
getGroups()
|
java.util.Collection
|
getLocations()
|
ManagementContext
|
getManagementContext()
|
protected EntityDynamicType
|
getMutableEntityType()
|
java.util.Collection
|
getOwnedChildren()
|
Entity
|
getOwner()
|
java.util.Collection
|
getPolicies()
|
SubscriptionContext
|
getSubscriptionContext()
|
protected SubscriptionTracker
|
getSubscriptionTracker()
|
boolean
|
hasEverBeenManaged()
|
void
|
invalidate()
For use by management plane, to invalidate all fields (e.g. when an entity is changing to being proxied) |
Task
|
invoke(java.util.Map parameters = [:], Effector eff)
Invoke an Effector directly. |
Task
|
invoke(Effector eff, java.util.Map parameters)
Additional form supplied for when the parameter map needs to be made explicit. |
Task
|
invokeFromJava(java.util.Map parameters = [:], Effector eff)
TODO Calling the above groovy method from java gives compilation error due to use of generics This method will be removed once that is resolved in groovy (or when this is converted to pure java). |
java.lang.Object
|
invokeMethod(java.lang.String name, java.lang.Object args)
Called by groovy for all method invocations; pass-through for everything but effectors; effectors get wrapped in a new task (parented by current task if there is one). |
void
|
onManagementBecomingMaster()
Invoked by ManagementContext when this entity becomes managed at a particular management node, including the initial management started and subsequent management node master-change for this entity. |
void
|
onManagementNoLongerMaster()
Invoked by ManagementContext when this entity becomes mastered at a particular management node, including the final management end and subsequent management node master-change for this entity. |
void
|
refreshInheritedConfig()
|
void
|
refreshInheritedConfigOfChildren()
|
boolean
|
removeAllEnrichers()
|
boolean
|
removeAllPolicies()
|
void
|
removeAttribute(AttributeSensor attribute)
|
boolean
|
removeEnricher(AbstractEnricher enricher)
|
boolean
|
removeOwnedChild(Entity child)
|
boolean
|
removePolicy(AbstractPolicy policy)
|
protected void
|
setApplication(Application app)
|
java.lang.Object
|
setAttribute(AttributeSensor attribute, java.lang.Object val)
|
java.lang.Object
|
setAttribute(AttributeSensorAndConfigKey configuredSensor)
sets the value of the given attribute sensor from the config key value herein, if the config key resolves to a non-null value as a sensor |
void
|
setBeingManaged()
|
java.lang.Object
|
setConfig(ConfigKey key, java.lang.Object val)
|
java.lang.Object
|
setConfig(HasConfigKey key, java.lang.Object val)
|
protected java.lang.Object
|
setConfigEvenIfOwned(ConfigKey key, java.lang.Object val)
|
protected java.lang.Object
|
setConfigEvenIfOwned(HasConfigKey key, java.lang.Object val)
|
protected void
|
setConfigIfValNonNull(ConfigKey key, java.lang.Object val)
|
protected void
|
setConfigIfValNonNull(HasConfigKey key, java.lang.Object val)
|
AbstractEntity
|
setOwner(Entity entity)
Adds this as a member of the given group, registers with application if necessary |
SubscriptionHandle
|
subscribe(Entity producer, Sensor sensor, SensorEventListener listener)
@see EntityLocal#subscribe |
SubscriptionHandle
|
subscribeToChildren(Entity parent, Sensor sensor, SensorEventListener listener)
@see EntityLocal#subscribeToChildren |
SubscriptionHandle
|
subscribeToMembers(Group group, Sensor sensor, SensorEventListener listener)
@see EntityLocal#subscribeToMembers |
java.lang.String
|
toString()
Default String representation is simplified name of class, together with selected fields. |
java.util.Collection
|
toStringFieldsToInclude()
override this, adding to the collection, to supply fields whose value, if not null, should be included in the toString |
protected boolean
|
unsubscribe(Entity producer)
Unsubscribes the given producer. |
protected boolean
|
unsubscribe(Entity producer, SubscriptionHandle handle)
Unsubscribes the given handle. |
Methods inherited from class groovy.lang.GroovyObjectSupport | |
---|---|
groovy.lang.GroovyObjectSupport#setProperty(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#getProperty(java.lang.String), groovy.lang.GroovyObjectSupport#getMetaClass(), groovy.lang.GroovyObjectSupport#setMetaClass(groovy.lang.MetaClass), groovy.lang.GroovyObjectSupport#invokeMethod(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#wait(), groovy.lang.GroovyObjectSupport#wait(long), groovy.lang.GroovyObjectSupport#wait(long, int), groovy.lang.GroovyObjectSupport#equals(java.lang.Object), groovy.lang.GroovyObjectSupport#toString(), groovy.lang.GroovyObjectSupport#hashCode(), groovy.lang.GroovyObjectSupport#getClass(), groovy.lang.GroovyObjectSupport#notify(), groovy.lang.GroovyObjectSupport#notifyAll() |
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() |
Field Detail |
---|
protected static final Logger LOG
public static BasicNotificationSensor SENSOR_ADDED
public static BasicNotificationSensor SENSOR_REMOVED
protected SubscriptionTracker _subscriptionTracker
protected EntityReference application
protected final AttributeMap attributesInternal
protected final ConfigMap configsInternal
protected ExecutionContext execution
protected ManagementContext managementContext
public java.lang.Object managementData
protected SubscriptionContext subscription
protected final java.util.Map tempWorkings
Property Detail |
---|
java.lang.String displayName
java.util.Collection enrichers
final EntityCollectionReference groups
final java.lang.String id
java.util.Collection locations
final EntityCollectionReference ownedChildren
EntityReference owner
java.util.Collection policies
java.util.Map presentationAttributes
boolean previouslyOwned
Constructor Detail |
---|
AbstractEntity(Entity owner)
AbstractEntity(java.util.Map flags = [:], Entity owner = null)
Method Detail |
---|
@Override void addEnricher(AbstractEnricher enricher)
@Override void addGroup(Group e)
@Override Entity addOwnedChild(Entity child)
@Override void addPolicy(AbstractPolicy policy)
protected void assertNotYetOwned()
void clearOwner()
Entity configure(java.util.Map flags = [:])
note that it is usually preferred to use the SetFromFlag annotation on relevant fields so they get set automatically by this method and overriding it is unnecessary
Entity configure(ConfigKey key, java.lang.Object value)
void destroy()
@Override void emit(Sensor sensor, java.lang.Object val)
@Override void emitInternal(Sensor sensor, java.lang.Object val)
Location firstLocation()
java.util.Map getAllConfig()
@Override Application getApplication()
@Override java.lang.String getApplicationId()
@Override java.lang.Object getAttribute(AttributeSensor attribute)
java.lang.Object getAttributeByNameParts(java.util.List nameParts)
@Override java.lang.Object getConfig(ConfigKey key)
@Override java.lang.Object getConfig(HasConfigKey key)
@Override java.lang.Object getConfig(HasConfigKey key, java.lang.Object defaultValue)
@Override java.lang.Object getConfig(ConfigKey key, java.lang.Object defaultValue)
ConfigMap getConfigMap()
Effector getEffector(java.lang.String effectorName)
@Override java.util.Collection getEnrichers()
@Override EntityType getEntityType()
ExecutionContext getExecutionContext()
@Override java.util.Collection getGroups()
@Override java.util.Collection getLocations()
@Override ManagementContext getManagementContext()
protected EntityDynamicType getMutableEntityType()
@Override java.util.Collection getOwnedChildren()
@Override Entity getOwner()
@Override java.util.Collection getPolicies()
SubscriptionContext getSubscriptionContext()
protected SubscriptionTracker getSubscriptionTracker()
boolean hasEverBeenManaged()
void invalidate()
Task invoke(java.util.Map parameters = [:], Effector eff)
Task invoke(Effector eff, java.util.Map parameters)
Task invokeFromJava(java.util.Map parameters = [:], Effector eff)
java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args)
void onManagementBecomingMaster()
void onManagementNoLongerMaster()
void refreshInheritedConfig()
void refreshInheritedConfigOfChildren()
@Override boolean removeAllEnrichers()
@Override boolean removeAllPolicies()
@Override void removeAttribute(AttributeSensor attribute)
@Override boolean removeEnricher(AbstractEnricher enricher)
@Override boolean removeOwnedChild(Entity child)
@Override boolean removePolicy(AbstractPolicy policy)
protected void setApplication(Application app)
@Override java.lang.Object setAttribute(AttributeSensor attribute, java.lang.Object val)
java.lang.Object setAttribute(AttributeSensorAndConfigKey configuredSensor)
returns old value
void setBeingManaged()
@Override java.lang.Object setConfig(ConfigKey key, java.lang.Object val)
@Override java.lang.Object setConfig(HasConfigKey key, java.lang.Object val)
protected java.lang.Object setConfigEvenIfOwned(ConfigKey key, java.lang.Object val)
protected java.lang.Object setConfigEvenIfOwned(HasConfigKey key, java.lang.Object val)
protected void setConfigIfValNonNull(ConfigKey key, java.lang.Object val)
protected void setConfigIfValNonNull(HasConfigKey key, java.lang.Object val)
AbstractEntity setOwner(Entity entity)
SubscriptionHandle subscribe(Entity producer, Sensor sensor, SensorEventListener listener)
SubscriptionHandle subscribeToChildren(Entity parent, Sensor sensor, SensorEventListener listener)
SubscriptionHandle subscribeToMembers(Group group, Sensor sensor, SensorEventListener listener)
@Override java.lang.String toString()
java.util.Collection toStringFieldsToInclude()
protected boolean unsubscribe(Entity producer)
protected boolean unsubscribe(Entity producer, SubscriptionHandle handle)
Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.