public class LocalManagementContext extends AbstractManagementContext
ManagementContext
API.ManagementContext.PropertiesReloadListener
Modifier and Type | Field and Description |
---|---|
java.lang.Throwable |
constructionStackTrace |
EFFECTOR_TAG, EMPTY_CATALOG_URL, NON_TRANSIENT_TASK_TAG, SUB_TASK_TAG, TRANSIENT_TASK_TAG
Constructor and Description |
---|
LocalManagementContext()
Creates a LocalManagement with default BrooklynProperties.
|
LocalManagementContext(BrooklynProperties.Factory.Builder builder) |
LocalManagementContext(BrooklynProperties.Factory.Builder builder,
java.util.Map<java.lang.String,java.lang.Object> brooklynAdditionalProperties) |
LocalManagementContext(BrooklynProperties brooklynProperties)
Creates a new LocalManagementContext.
|
Modifier and Type | Method and Description |
---|---|
void |
addEntitySetListener(CollectionChangeListener<Entity> listener) |
void |
addPropertiesReloadListener(ManagementContext.PropertiesReloadListener listener)
Registers a listener to be notified when brooklyn.properties is reloaded
|
void |
clearLocationRegistry() |
void |
generateManagementPlaneId() |
AccessController |
getAccessController()
For controlling access to operations - can be queried to find if an operation is allowed.
|
LocalAccessManager |
getAccessManager() |
java.util.Collection<Application> |
getApplications()
All applications under control of this management plane
|
InternalEntityFactory |
getEntityFactory() |
LocalEntityManager |
getEntityManager()
Returns the
EntityManager instance for managing/querying entities. |
ExecutionManager |
getExecutionManager()
Returns the
ExecutionManager instance for entities and users in this management realm
to submit tasks and to observe what tasks are occurring |
InternalLocationFactory |
getLocationFactory() |
LocalLocationManager |
getLocationManager() |
java.lang.String |
getManagementPlaneId()
Deprecated.
|
Maybe<java.lang.String> |
getManagementPlaneIdMaybe()
UID for the Brooklyn management plane which this
ManagementContext node is a part of. |
ManagementNodeState |
getNodeState()
Returns node state, always reporting
ManagementNodeState.INITIALIZING if there is any transition
and ManagementNodeState.FAILED if there are any server errors. |
Maybe<OsgiManager> |
getOsgiManager() |
InternalPolicyFactory |
getPolicyFactory() |
SubscriptionManager |
getSubscriptionManager()
Returns the
SubscriptionManager instance for entities and users of this management realm
to subscribe to sensor events (and, in the case of entities, to emit sensor events) |
LocalUsageManager |
getUsageManager() |
boolean |
isManagedLocally(Entity e)
Whether the master entity record is local, and sensors and effectors can be properly accessed locally.
|
boolean |
isStartupComplete()
Whether all startup tasks have completed.
|
static void |
logAll(org.slf4j.Logger logger) |
void |
noteStartupComplete() |
void |
noteStartupTransitioning()
Exposed for services to advertise that startup tasks are again occurring
|
void |
prePreManage(Entity entity)
Registers an entity that has been created, but that has not yet begun to be managed.
|
void |
prePreManage(Location location)
Registers a location that has been created, but that has not yet begun to be managed.
|
void |
reloadBrooklynProperties()
Reloads locations from
brooklyn.properties . |
void |
removeEntitySetListener(CollectionChangeListener<Entity> listener) |
void |
removePropertiesReloadListener(ManagementContext.PropertiesReloadListener listener)
Deregisters a listener from brooklyn.properties reload notifications
|
void |
setManagementPlaneId(java.lang.String newPlaneId) |
void |
terminate() |
static int |
terminateAll()
terminates all (best effort); returns count of sessions closed; if exceptions thrown, returns negative number.
|
java.lang.String |
toString() |
errors, getBaseClassLoader, getBaseClassPathForScanning, getBrooklynProperties, getCatalog, getCatalogClassLoader, getCatalogInitialization, getConfig, getEntitlementManager, getEntityDownloadsManager, getEntityDriverManager, getExecutionContext, getExecutionContext, getExternalConfigProviderRegistry, getGarbageCollector, getHighAvailabilityManager, getLocationRegistry, getManagementNodeId, getManagementNodeUri, getRebindManager, getScratchpad, getServerExecutionContext, getStorage, getSubscriptionContext, getSubscriptionContext, getSubscriptionContext, getTotalEffectorInvocations, getTypeRegistry, invokeEffector, invokeEffectorMethodSync, isRunning, lookup, lookup, lookup, lookupAll, setBaseClassLoader, setBaseClassPathForScanning, setCatalogInitialization, setManagementNodeUri
public LocalManagementContext()
public LocalManagementContext(BrooklynProperties brooklynProperties)
brooklynProperties
- the BrooklynProperties.public LocalManagementContext(BrooklynProperties.Factory.Builder builder)
public LocalManagementContext(BrooklynProperties.Factory.Builder builder, java.util.Map<java.lang.String,java.lang.Object> brooklynAdditionalProperties)
public static void logAll(org.slf4j.Logger logger)
public static int terminateAll()
@Deprecated public java.lang.String getManagementPlaneId()
ManagementContext
ManagementContext.getManagementPlaneIdMaybe()
, but throws if not available, to prevent callers accessing prematurely.public Maybe<java.lang.String> getManagementPlaneIdMaybe()
ManagementContext
ManagementContext
node is a part of.
Each Brooklyn entity is actively managed by a unique management plane
whose ID which should not normally change for the duration of that entity,
even though the nodes in that plane might, and the plane may go down and come back up.
In other words the value of Application#getManagementContext()#getManagementPlaneId()
will generally be constant (in contrast to ManagementContext.getManagementNodeId()
).
Returns absent while the management context is still initialising. The value is set:
public void setManagementPlaneId(java.lang.String newPlaneId)
public void generateManagementPlaneId()
public void prePreManage(Entity entity)
ManagementContextInternal
This differs from the idea of "preManaged" where the entities are in the process of being managed, but where management is not yet complete.
public void prePreManage(Location location)
ManagementContextInternal
public java.util.Collection<Application> getApplications()
ManagementContext
public void addEntitySetListener(CollectionChangeListener<Entity> listener)
public void removeEntitySetListener(CollectionChangeListener<Entity> listener)
public LocalEntityManager getEntityManager()
ManagementContext
EntityManager
instance for managing/querying entities.public InternalEntityFactory getEntityFactory()
public InternalLocationFactory getLocationFactory()
public InternalPolicyFactory getPolicyFactory()
public LocalLocationManager getLocationManager()
public LocalAccessManager getAccessManager()
public LocalUsageManager getUsageManager()
public Maybe<OsgiManager> getOsgiManager()
public AccessController getAccessController()
ManagementContext
AccessController
.public SubscriptionManager getSubscriptionManager()
ManagementContext
SubscriptionManager
instance for entities and users of this management realm
to subscribe to sensor events (and, in the case of entities, to emit sensor events)public ExecutionManager getExecutionManager()
ManagementContext
ExecutionManager
instance for entities and users in this management realm
to submit tasks and to observe what tasks are occurringpublic void terminate()
terminate
in interface ManagementContextInternal
terminate
in class AbstractManagementContext
public boolean isManagedLocally(Entity e)
AbstractManagementContext
isManagedLocally
in class AbstractManagementContext
public java.lang.String toString()
toString
in class java.lang.Object
public void reloadBrooklynProperties()
ManagementContext
brooklyn.properties
. Any changes will apply only to newly created applicationspublic void clearLocationRegistry()
public void addPropertiesReloadListener(ManagementContext.PropertiesReloadListener listener)
ManagementContext
public void removePropertiesReloadListener(ManagementContext.PropertiesReloadListener listener)
ManagementContext
public void noteStartupComplete()
public void noteStartupTransitioning()
public boolean isStartupComplete()
ManagementContext
ManagementContext.isRunning()
returns true immediately after construction)
but some subsystems (e.g. persistence, OSGi, webapps, entities started at startup)
may not be available until this returns true.
Also returns false if HA state is transitioning. See ManagementContext.getNodeState()
to atomically check node state,
as the preferred way to tell if a node is master.
isStartupComplete
in interface ManagementContext
isStartupComplete
in class AbstractManagementContext
public ManagementNodeState getNodeState()
ManagementContext
ManagementNodeState.INITIALIZING
if there is any transition
and ManagementNodeState.FAILED
if there are any server errors.
If this returns ManagementNodeState.MASTER
we can guarantee the node to be in master state,
unlike HighAvailabilityManager.getNodeState()
which may return ManagementNodeState.MASTER
slightly early.