public interface ManagementContext
It may refer to several applications, and it refers to all the entities descended from those applications.
Modifier and Type | Interface and Description |
---|---|
static interface |
ManagementContext.PropertiesReloadListener
Listener for
brooklyn.properties reload events. |
Modifier and Type | Method and Description |
---|---|
void |
addPropertiesReloadListener(ManagementContext.PropertiesReloadListener listener)
Registers a listener to be notified when brooklyn.properties is reloaded
|
AccessController |
getAccessController()
For controlling access to operations - can be queried to find if an operation is allowed.
|
java.util.Collection<Application> |
getApplications()
All applications under control of this management plane
|
BrooklynCatalog |
getCatalog()
Record of configured Brooklyn entities (and templates and policies) which can be loaded
|
java.lang.ClassLoader |
getCatalogClassLoader()
Returns the class loader to be used to load items.
|
StringConfigMap |
getConfig()
Returns the ConfigMap (e.g.
|
EntitlementManager |
getEntitlementManager()
Active entitlements checker instance.
|
DownloadResolverManager |
getEntityDownloadsManager()
Returns the
DownloadResolverManager for resolving things like which URL to download an installer from. |
EntityDriverManager |
getEntityDriverManager()
Returns the
EntityDriverManager entities can use to create drivers. |
EntityManager |
getEntityManager()
Returns the
EntityManager instance for managing/querying entities. |
ExecutionContext |
getExecutionContext(Entity entity)
Returns an
ExecutionContext instance representing tasks
(from the ExecutionManager ) associated with this entity, and capable
of conveniently running such tasks which will be associated with that entity |
ExecutionContext |
getExecutionContext(Entity e,
EntityAdjunct a)
As
getExecutionContext(Entity) where there is also an adjunct |
ExecutionManager |
getExecutionManager()
Returns the
ExecutionManager instance for entities and users in this management realm
to submit tasks and to observe what tasks are occurring |
HighAvailabilityManager |
getHighAvailabilityManager() |
LocationManager |
getLocationManager() |
LocationRegistry |
getLocationRegistry()
Record of configured locations and location resolvers
|
java.lang.String |
getManagementNodeId()
UID for this
ManagementContext node (as part of a single management plane). |
Maybe<java.net.URI> |
getManagementNodeUri()
The URI that this management node's REST API is available at, or absent if the node's
API is unavailable.
|
java.lang.String |
getManagementPlaneId()
Deprecated.
since 0.11.0, use
getManagementPlaneIdMaybe() instead. |
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. |
RebindManager |
getRebindManager() |
Scratchpad |
getScratchpad()
Provides a scratchpad area for this ManagementContext.
|
ExecutionContext |
getServerExecutionContext()
Returns an
ExecutionContext within the ExecutionManager for tasks
associated to the Brooklyn node's operation (not any entities). |
SubscriptionContext |
getSubscriptionContext(Entity entity)
Returns a
SubscriptionContext instance representing subscriptions
(from the SubscriptionManager ) associated with this entity, and capable
of conveniently subscribing on behalf of that entity. |
SubscriptionContext |
getSubscriptionContext(Entity e,
EntityAdjunct a)
As
getSubscriptionContext(Entity) where there is also an adjunct |
SubscriptionContext |
getSubscriptionContext(Location location)
Returns a
SubscriptionContext instance representing subscriptions
(from the SubscriptionManager ) associated with this location, and capable
of conveniently subscribing on behalf of that location |
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) |
BrooklynTypeRegistry |
getTypeRegistry()
Record of configured classes which can be loaded
|
boolean |
isRunning()
Whether the management context has been initialized and not yet terminated.
|
boolean |
isStartupComplete()
Whether all startup tasks have completed.
|
<T extends BrooklynObject> |
lookup(<any> filter)
Finds a
BrooklynObject known in this management context
satisfying the given predicate, or null |
BrooklynObject |
lookup(java.lang.String id)
As
lookup(String, Class) but not constraining the return type |
<T extends BrooklynObject> |
lookup(java.lang.String id,
java.lang.Class<T> type)
As
#lookup(Predicate) comparing the ID of the object with the given string |
<T extends BrooklynObject> |
lookupAll(<any> filter)
As
#lookup(Predicate) but returning all such instances |
void |
reloadBrooklynProperties()
Reloads locations from
brooklyn.properties . |
void |
removePropertiesReloadListener(ManagementContext.PropertiesReloadListener listener)
Deregisters a listener from brooklyn.properties reload notifications
|
@Deprecated java.lang.String getManagementPlaneId()
getManagementPlaneIdMaybe()
instead.getManagementPlaneIdMaybe()
, but throws if not available, to prevent callers accessing prematurely.Maybe<java.lang.String> getManagementPlaneIdMaybe()
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 getManagementNodeId()
).
Returns absent while the management context is still initialising. The value is set:
java.lang.String getManagementNodeId()
ManagementContext
node (as part of a single management plane).
No two instances of ManagementContext
should ever have the same node UID.
The value of Application#getManagementContext()#getManagementNodeId()
may
change if it is rebinded to a different node,
in contrast to getManagementPlaneIdMaybe()
which is the same for all nodes in a Brooklyn plane.
This value should not be null unless the management context is a non-functional (non-deployment) instance.
Maybe<java.net.URI> getManagementNodeUri()
java.util.Collection<Application> getApplications()
EntityManager getEntityManager()
EntityManager
instance for managing/querying entities.ExecutionManager getExecutionManager()
ExecutionManager
instance for entities and users in this management realm
to submit tasks and to observe what tasks are occurringExecutionContext getServerExecutionContext()
ExecutionContext
within the ExecutionManager
for tasks
associated to the Brooklyn node's operation (not any entities).EntityDriverManager getEntityDriverManager()
EntityDriverManager
entities can use to create drivers. This
manager can also be used to programmatically customize which driver type to use
for entities in different locations.
The default strategy for choosing a driver is to use a naming convention:
DriverDependentEntity.getDriverInterface()
returns the interface that the
driver must implement; its name should end in "Driver". For example, this suffix is
replaced with "SshDriver" for SshMachineLocation, for example.DownloadResolverManager getEntityDownloadsManager()
DownloadResolverManager
for resolving things like which URL to download an installer from.
The default DownloadResolverManager
will retrieve entity.getAttribute(Attributes.DOWNLOAD_URL)
,
and substitute things like "${version}" etc.
However, additional resolvers can be registered to customize this behaviour (e.g. to always go to an
enterprise's repository).SubscriptionManager getSubscriptionManager()
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)ExecutionContext getExecutionContext(Entity entity)
ExecutionContext
instance representing tasks
(from the ExecutionManager
) associated with this entity, and capable
of conveniently running such tasks which will be associated with that entityExecutionContext getExecutionContext(Entity e, EntityAdjunct a)
getExecutionContext(Entity)
where there is also an adjunctSubscriptionContext getSubscriptionContext(Entity entity)
SubscriptionContext
instance representing subscriptions
(from the SubscriptionManager
) associated with this entity, and capable
of conveniently subscribing on behalf of that entity.
For subscriptions made using this SubscriptionContext
, the calls to
SensorEventListener.onEvent(org.apache.brooklyn.api.sensor.SensorEvent)
will be made in a task that has the CONTEXT_ENTITY
tag set to this entity (see BrooklynTaskTag).SubscriptionContext getSubscriptionContext(Entity e, EntityAdjunct a)
getSubscriptionContext(Entity)
where there is also an adjunctSubscriptionContext getSubscriptionContext(Location location)
SubscriptionContext
instance representing subscriptions
(from the SubscriptionManager
) associated with this location, and capable
of conveniently subscribing on behalf of that locationRebindManager getRebindManager()
HighAvailabilityManager getHighAvailabilityManager()
StringConfigMap getConfig()
Scratchpad getScratchpad()
Provides a scratchpad area for this ManagementContext. It can be used for storing any data useful to Brooklyn core or custom entities. Usually it's used for singleton-like objects per ManagementContext. The lifetime of he scratch area is for the duration of the ManagementContext. It's not persisted or shared between HA nodes, doesn't survive restarts.
Code using getConfig()
for the same purpose should migrate to using this method as getConfig()
will become read-only in future releases. Note that the scratchpad is not reset on reloading brooklyn.properties
unlike getConfig()
.
The returned map is thread safe, no locking is required to use it from parallel threads.
boolean isRunning()
isStartupComplete()
.boolean isStartupComplete()
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 getNodeState()
to atomically check node state,
as the preferred way to tell if a node is master.
ManagementNodeState getNodeState()
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.LocationRegistry getLocationRegistry()
BrooklynCatalog getCatalog()
BrooklynTypeRegistry getTypeRegistry()
java.lang.ClassLoader getCatalogClassLoader()
LocationManager getLocationManager()
AccessController getAccessController()
AccessController
.void reloadBrooklynProperties()
brooklyn.properties
. Any changes will apply only to newly created applicationsvoid addPropertiesReloadListener(ManagementContext.PropertiesReloadListener listener)
void removePropertiesReloadListener(ManagementContext.PropertiesReloadListener listener)
EntitlementManager getEntitlementManager()
BrooklynObject lookup(java.lang.String id)
lookup(String, Class)
but not constraining the return type<T extends BrooklynObject> T lookup(java.lang.String id, java.lang.Class<T> type)
#lookup(Predicate)
comparing the ID of the object with the given string<T extends BrooklynObject> T lookup(<any> filter)
BrooklynObject
known in this management context
satisfying the given predicate, or null<T extends BrooklynObject> java.util.Collection<T> lookupAll(<any> filter)
#lookup(Predicate)
but returning all such instances