Brooklyn

brooklyn.entity.dns
[Java] Class AbstractGeoDnsServiceImpl

java.lang.Object
  brooklyn.entity.basic.AbstractEntity
      brooklyn.entity.dns.AbstractGeoDnsServiceImpl
All Implemented Interfaces:
AbstractGeoDnsService

public abstract class AbstractGeoDnsServiceImpl
extends AbstractEntity

Field Summary
protected java.util.Set entitiesWithoutGeoInfo

protected java.util.Set entitiesWithoutHostname

protected Entity targetEntityProvider

protected java.util.Map targetHosts

 
Fields inherited from class AbstractEntity
EFFECTOR_ADDED, EFFECTOR_CHANGED, EFFECTOR_REMOVED, LOG, POLICY_ADDED, POLICY_REMOVED, SENSOR_ADDED, SENSOR_REMOVED, _subscriptionTracker, managementSupport, tempWorkings
 
Constructor Summary
AbstractGeoDnsServiceImpl()

 
Method Summary
protected boolean addTargetHost(Entity entity)

Adds this host, if it is absent or if its hostname has changed.

protected void beginPoll()

void destroy()

protected void endPoll()

should set up so these hosts are targeted, and setServiceState appropriately

java.lang.String getHostname()

java.util.Map getTargetHosts()

protected HostGeoInfo inferHostGeoInfo(java.lang.String hostname, java.lang.String ip)

protected java.lang.String inferHostname(Entity entity)

protected java.lang.String inferIp(Entity entity)

void onManagementBecomingMaster()

void onManagementNoLongerMaster()

protected void reconfigureService(java.util.Collection targetHosts)

protected void refreshGroupMembership()

protected boolean removeTargetHost(Entity e, boolean doUpdate)

remove if host removed

void setServiceState(Lifecycle state)

void setTargetEntityProvider(Entity entityProvider)

protected void update()

 
Methods inherited from class AbstractEntity
addChild, addChild, addEnricher, addGroup, addLocations, addPolicy, clearLocations, clearParent, configure, configure, configure, configure, configure, configure, destroy, emit, emitInternal, equals, finalize, firstLocation, getAllAttributes, getAllConfig, getApplication, getApplicationId, getAttribute, getAttributeByNameParts, getChildren, getConfig, getConfig, getConfig, getConfig, getConfigMap, getCreationTime, getDisplayName, getEffector, getEnrichers, getEntityManager, getEntityType, getEntityTypeName, getExecutionContext, getGroups, getIconUrl, getId, getLocations, getManagementContext, getManagementSupport, getMutableEntityType, getParent, getPolicies, getProxy, getProxyIfAvailable, getRebindSupport, getSubscriptionContext, getSubscriptionTracker, hashCode, init, invalidateReferences, invoke, invoke, invoke, isLegacyConstruction, onManagementBecomingMaster, onManagementNoLongerMaster, onManagementStarted, onManagementStarting, onManagementStopped, refreshInheritedConfig, removeAllEnrichers, removeAllPolicies, removeAttribute, removeChild, removeEnricher, removeLocations, removePolicy, setApplication, setAttribute, setAttribute, setAttributeWithoutPublishing, setConfig, setConfig, setConfig, setConfig, setConfig, setConfig, setConfigEvenIfOwned, setConfigEvenIfOwned, setConfigIfValNonNull, setConfigIfValNonNull, setDisplayName, setManagementContext, setParent, setProxy, subscribe, subscribeToChildren, subscribeToMembers, toMetadataRecord, toString, toStringHelper, unsubscribe, unsubscribe
 

Field Detail

entitiesWithoutGeoInfo

protected java.util.Set entitiesWithoutGeoInfo


entitiesWithoutHostname

protected java.util.Set entitiesWithoutHostname


targetEntityProvider

@SetFromFlag
protected Entity targetEntityProvider


targetHosts

protected java.util.Map targetHosts


 
Constructor Detail

AbstractGeoDnsServiceImpl

public AbstractGeoDnsServiceImpl()


 
Method Detail

addTargetHost

protected boolean addTargetHost(Entity entity)
Adds this host, if it is absent or if its hostname has changed. For whether to use hostname or ip, see config and attributes AbstractGeoDnsService#USE_HOSTNAMES#USE_HOSTNAMES, Attributes#HOSTNAME#HOSTNAME and Attributes#ADDRESS#ADDRESS (via inferHostname(Entity) and inferIp(Entity). Note that the "hostname" could infact be an IP address, if inferHostname(Entity) returns an IP!

The "hostname" is always preferred for inferring the geo info, if it is available. The USE_HOSTNAMES==false is just used to say whether to fall back to IP if that is not available (and whether to switch the the geo-info so it refs the IP instead of the hostname). TODO in a future release, we may change this to explicitly set the sensor(s) to look at on the entity, and be stricter about using them in order.

Returns:
true if host is added or changed


beginPoll

protected void beginPoll()


destroy

public void setServiceState(Lifecycle state) {
public void destroy()


endPoll

protected void endPoll()
should set up so these hosts are targeted, and setServiceState appropriately


getHostname

if (targetEntityProvider == null)
public java.lang.String getHostname()


getTargetHosts

super.onManagementBecomingMaster();
public java.util.Map getTargetHosts()


inferHostGeoInfo

protected HostGeoInfo inferHostGeoInfo(java.lang.String hostname, java.lang.String ip)


inferHostname

protected java.lang.String inferHostname(Entity entity)


inferIp

protected java.lang.String inferIp(Entity entity)


onManagementBecomingMaster

endPoll();
public void onManagementBecomingMaster()


onManagementNoLongerMaster

public void destroy() {
public void onManagementNoLongerMaster()


reconfigureService

protected void reconfigureService(java.util.Collection targetHosts)


refreshGroupMembership

protected void refreshGroupMembership()


removeTargetHost

protected boolean removeTargetHost(Entity e, boolean doUpdate)
remove if host removed


setServiceState

@Override
public void setServiceState(Lifecycle state)


setTargetEntityProvider

protected void beginPoll() {
public void setTargetEntityProvider(Entity entityProvider)


update

protected void update()


 

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