Brooklyn

brooklyn.policy.basic
[Java] Class AbstractEntityAdjunct

java.lang.Object
  brooklyn.policy.basic.AbstractEntityAdjunct
All Implemented Interfaces:
Configurable, EntityAdjunct

public abstract class AbstractEntityAdjunct

Common functionality for policies and enrichers


Field Summary
protected SubscriptionTracker _subscriptionTracker

not for direct access; refer to as 'subscriptionTracker' via getter so that it is initialized

protected AdjunctType adjunctType

protected ConfigMapImpl configsInternal

The config values of this entity.

protected EntityLocal entity

protected ExecutionContext execution

protected java.lang.String id

protected java.util.Map leftoverProperties

protected java.lang.String name

 
Constructor Summary
AbstractEntityAdjunct()

AbstractEntityAdjunct(java.util.Map flags)

 
Method Summary
protected boolean check(Entity producer)

protected void configure()

will set fields from flags, and put the remaining ones into the 'leftovers' map.

void configure(java.util.Map flags)

void destroy()

protected void doReconfigureConfig(ConfigKey key, java.lang.Object val)

protected AdjunctType getAdjunctType()

java.util.Map getAllConfig()

protected java.util.Collection getAllSubscriptions()

Unsubscribes and clears all managed subscriptions; is called by the owning entity when a policy is removed and should always be called by any subclasses overriding this method

java.lang.Object getConfig(ConfigKey key)

ConfigMap getConfigMap()

for inspection only

java.lang.String getId()

protected ManagementContext getManagementContext()

java.lang.String getName()

protected SubscriptionTracker getSubscriptionTracker()

@see SubscriptionContext#subscribe(Entity, Sensor, SensorEventListener)

void init()

boolean isDestroyed()

protected boolean isLegacyConstruction()

boolean isRunning()

java.lang.Object setConfig(ConfigKey key, java.lang.Object val)

void setEntity(EntityLocal entity)

void setId(java.lang.String id)

void setManagementContext(ManagementContext managementContext)

void setName(java.lang.String name)

protected SubscriptionHandle subscribe(Entity producer, Sensor sensor, SensorEventListener listener)

@see SubscriptionContext#subscribe(Entity, Sensor, SensorEventListener)

protected SubscriptionHandle subscribeToChildren(Entity producerParent, Sensor sensor, SensorEventListener listener)

returns false if deleted, throws exception if invalid state, otherwise true.

protected SubscriptionHandle subscribeToMembers(Group producerGroup, Sensor sensor, SensorEventListener listener)

@see SubscriptionContext#subscribe(Entity, Sensor, SensorEventListener)

java.lang.String toString()

protected boolean unsubscribe(Entity producer)

protected boolean unsubscribe(Entity producer, SubscriptionHandle handle)

@return a list of all subscription handles

 
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

_subscriptionTracker

protected SubscriptionTracker _subscriptionTracker
not for direct access; refer to as 'subscriptionTracker' via getter so that it is initialized


adjunctType

protected final AdjunctType adjunctType


configsInternal

protected final ConfigMapImpl configsInternal
The config values of this entity. Updating this map should be done via getConfig/setConfig.


entity

protected EntityLocal entity


execution

protected ExecutionContext execution


id

@SetFromFlag
protected java.lang.String id


leftoverProperties

protected java.util.Map leftoverProperties


name

@SetFromFlag
protected java.lang.String name


 
Constructor Detail

AbstractEntityAdjunct

public AbstractEntityAdjunct()


AbstractEntityAdjunct

public AbstractEntityAdjunct(java.util.Map flags)


 
Method Detail

check

protected boolean check(Entity producer)


configure

protected void configure()
will set fields from flags, and put the remaining ones into the 'leftovers' map. can be subclassed for custom initialization but note the following.

if you require fields to be initialized you must do that in this method. You must *not* rely on field initializers because they may not run until *after* this method (this method is invoked by the constructor in this class, so initializers in subclasses will not have run when this overridden method is invoked.)


configure

@SuppressWarnings("unchecked")
public void configure(java.util.Map flags)


destroy

public void destroy()


doReconfigureConfig

protected void doReconfigureConfig(ConfigKey key, java.lang.Object val)


getAdjunctType

protected AdjunctType getAdjunctType()


getAllConfig

public java.util.Map getAllConfig()


getAllSubscriptions

protected java.util.Collection getAllSubscriptions()
Unsubscribes and clears all managed subscriptions; is called by the owning entity when a policy is removed and should always be called by any subclasses overriding this method


getConfig

public java.lang.Object getConfig(ConfigKey key)


getConfigMap

protected AdjunctType getAdjunctType() {
public ConfigMap getConfigMap()
for inspection only


getId

public java.lang.String getId()


getManagementContext

protected ManagementContext getManagementContext()


getName

public String getId() { return id; }
public java.lang.String getName()


getSubscriptionTracker

protected SubscriptionTracker getSubscriptionTracker()
See Also:
SubscriptionContext#subscribe(Entity, Sensor, SensorEventListener)#subscribe(Entity, Sensor, SensorEventListener)


init

public void init()


isDestroyed

public boolean isDestroyed()


isLegacyConstruction

protected boolean isLegacyConstruction()


isRunning

.add("running", isRunning())
public boolean isRunning()


setConfig

// TODO make immutable
public java.lang.Object setConfig(ConfigKey key, java.lang.Object val)


setEntity

public void setEntity(EntityLocal entity)


setId

public void setId(java.lang.String id)


setManagementContext

public void setManagementContext(ManagementContext managementContext)


setName

public void setName(java.lang.String name)


subscribe

protected SubscriptionHandle subscribe(Entity producer, Sensor sensor, SensorEventListener listener)
See Also:
SubscriptionContext#subscribe(Entity, Sensor, SensorEventListener)#subscribe(Entity, Sensor, SensorEventListener)


subscribeToChildren

protected SubscriptionHandle subscribeToChildren(Entity producerParent, Sensor sensor, SensorEventListener listener)
returns false if deleted, throws exception if invalid state, otherwise true. okay if entity is not yet managed.


subscribeToMembers

protected SubscriptionHandle subscribeToMembers(Group producerGroup, Sensor sensor, SensorEventListener listener)
See Also:
SubscriptionContext#subscribe(Entity, Sensor, SensorEventListener)#subscribe(Entity, Sensor, SensorEventListener)


toString

public java.lang.String toString()


unsubscribe

protected boolean unsubscribe(Entity producer)


unsubscribe

protected boolean unsubscribe(Entity producer, SubscriptionHandle handle)
Returns:
a list of all subscription handles


 

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