public abstract class AbstractManagementContext extends java.lang.Object implements ManagementContextInternal
ManagementContext.PropertiesReloadListener
EFFECTOR_TAG, EMPTY_CATALOG_URL, NON_TRANSIENT_TASK_TAG, SUB_TASK_TAG, TRANSIENT_TASK_TAG
Constructor and Description |
---|
AbstractManagementContext(BrooklynProperties brooklynProperties) |
AbstractManagementContext(BrooklynProperties brooklynProperties,
DataGridFactory datagridFactory) |
Modifier and Type | Method and Description |
---|---|
abstract void |
addEntitySetListener(CollectionChangeListener<Entity> listener) |
java.util.List<java.lang.Throwable> |
errors()
Object which allows adding, removing, and clearing errors.
|
java.lang.ClassLoader |
getBaseClassLoader()
Optional class-loader that this management context should use as its base,
as the first-resort in the catalog, and for scanning (if scanning the default in the catalog).
|
java.lang.Iterable<java.net.URL> |
getBaseClassPathForScanning() |
BrooklynProperties |
getBrooklynProperties() |
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.
|
CatalogInitialization |
getCatalogInitialization() |
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. |
ExecutionContext |
getExecutionContext(Entity e)
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 |
BrooklynGarbageCollector |
getGarbageCollector() |
HighAvailabilityManager |
getHighAvailabilityManager() |
LocationRegistry |
getLocationRegistry()
Record of configured locations and location resolvers
|
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.
|
RebindManager |
getRebindManager() |
ExecutionContext |
getServerExecutionContext()
Returns an
ExecutionContext within the ExecutionManager for tasks
associated to the Brooklyn node's operation (not any entities). |
BrooklynStorage |
getStorage() |
SubscriptionContext |
getSubscriptionContext(Entity e)
Returns a
SubscriptionContext instance representing subscriptions
(from the SubscriptionManager ) associated with this entity, and capable
of conveniently subscribing on behalf of that entity |
long |
getTotalEffectorInvocations() |
<T> Task<T> |
invokeEffector(Entity entity,
Effector<T> eff,
java.util.Map parameters) |
<T> T |
invokeEffectorMethodSync(Entity entity,
Effector<T> eff,
java.lang.Object args)
Method for entity to make effector happen with correct semantics (right place, right task context),
when a method is called on that entity.
|
abstract boolean |
isManagedLocally(Entity e)
Whether the master entity record is local, and sensors and effectors can be properly accessed locally.
|
boolean |
isRunning()
Whether the management context has been initialized and not yet terminated.
|
boolean |
isStartupComplete()
Whether all startup tasks have completed.
|
BrooklynObject |
lookup(java.lang.String id)
As
ManagementContext.lookup(String, Class) but not constraining the return type |
<T extends BrooklynObject> |
lookup(java.lang.String id,
java.lang.Class<T> type)
Finds an entity with the given ID known at this management context
|
abstract void |
removeEntitySetListener(CollectionChangeListener<Entity> listener) |
abstract <T> Task<T> |
runAtEntity(java.util.Map flags,
Entity entity,
java.util.concurrent.Callable<T> c)
Deprecated.
since 0.6.0 use effectors (or support
runAtEntity(Entity, Effector, Map) if something else is needed);
(Callable with Map flags is too open-ended, bothersome to support, and not used much) |
void |
setBaseClassLoader(java.lang.ClassLoader cl)
See
getBaseClassLoader() . |
void |
setBaseClassPathForScanning(java.lang.Iterable<java.net.URL> urls)
Optional mechanism for setting the classpath which should be scanned by the catalog, if the catalog
is scanning the default classpath.
|
void |
setCatalogInitialization(CatalogInitialization catalogInitialization) |
void |
setManagementNodeUri(java.net.URI uri) |
void |
terminate() |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAccessManager, getEntityFactory, getLocationFactory, getOsgiManager, getPolicyFactory, getUsageManager, prePreManage, prePreManage
addPropertiesReloadListener, getAccessController, getApplications, getEntityManager, getExecutionManager, getLocationManager, getManagementNodeId, getManagementPlaneId, getSubscriptionManager, reloadBrooklynProperties, removePropertiesReloadListener
public AbstractManagementContext(BrooklynProperties brooklynProperties)
public AbstractManagementContext(BrooklynProperties brooklynProperties, DataGridFactory datagridFactory)
public void terminate()
terminate
in interface ManagementContextInternal
public boolean isRunning()
ManagementContext
ManagementContext.isStartupComplete()
.isRunning
in interface ManagementContext
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 see ManagementContext.isStartupComplete()
.
isStartupComplete
in interface ManagementContext
public BrooklynStorage getStorage()
getStorage
in interface ManagementContextInternal
public RebindManager getRebindManager()
getRebindManager
in interface ManagementContext
public HighAvailabilityManager getHighAvailabilityManager()
getHighAvailabilityManager
in interface ManagementContext
public long getTotalEffectorInvocations()
getTotalEffectorInvocations
in interface ManagementContextInternal
public ExecutionContext getExecutionContext(Entity e)
ManagementContext
ExecutionContext
instance representing tasks
(from the ExecutionManager
) associated with this entity, and capable
of conveniently running such tasks which will be associated with that entitygetExecutionContext
in interface ManagementContext
public ExecutionContext getServerExecutionContext()
ManagementContext
ExecutionContext
within the ExecutionManager
for tasks
associated to the Brooklyn node's operation (not any entities).getServerExecutionContext
in interface ManagementContext
public SubscriptionContext getSubscriptionContext(Entity e)
ManagementContext
SubscriptionContext
instance representing subscriptions
(from the SubscriptionManager
) associated with this entity, and capable
of conveniently subscribing on behalf of that entitygetSubscriptionContext
in interface ManagementContext
public EntityDriverManager getEntityDriverManager()
ManagementContext
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.getEntityDriverManager
in interface ManagementContext
public DownloadResolverManager getEntityDownloadsManager()
ManagementContext
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).getEntityDownloadsManager
in interface ManagementContext
public EntitlementManager getEntitlementManager()
ManagementContext
getEntitlementManager
in interface ManagementContext
public <T> Task<T> invokeEffector(Entity entity, Effector<T> eff, java.util.Map parameters)
invokeEffector
in interface ManagementContextInternal
public <T> T invokeEffectorMethodSync(Entity entity, Effector<T> eff, java.lang.Object args) throws java.util.concurrent.ExecutionException
invokeEffectorMethodSync
in interface ManagementContextInternal
java.util.concurrent.ExecutionException
public abstract boolean isManagedLocally(Entity e)
@Deprecated public abstract <T> Task<T> runAtEntity(java.util.Map flags, Entity entity, java.util.concurrent.Callable<T> c)
runAtEntity(Entity, Effector, Map)
if something else is needed);
(Callable with Map flags is too open-ended, bothersome to support, and not used much)public abstract void addEntitySetListener(CollectionChangeListener<Entity> listener)
addEntitySetListener
in interface ManagementContextInternal
public abstract void removeEntitySetListener(CollectionChangeListener<Entity> listener)
removeEntitySetListener
in interface ManagementContextInternal
public StringConfigMap getConfig()
ManagementContext
getConfig
in interface ManagementContext
public BrooklynProperties getBrooklynProperties()
getBrooklynProperties
in interface ManagementContextInternal
public LocationRegistry getLocationRegistry()
ManagementContext
getLocationRegistry
in interface ManagementContext
public BrooklynCatalog getCatalog()
ManagementContext
getCatalog
in interface ManagementContext
public java.lang.ClassLoader getCatalogClassLoader()
ManagementContext
getCatalogClassLoader
in interface ManagementContext
public java.lang.ClassLoader getBaseClassLoader()
getBaseClassLoader
in interface ManagementContextInternal
public void setBaseClassLoader(java.lang.ClassLoader cl)
getBaseClassLoader()
. Only settable once and must be invoked before catalog is loaded.public void setBaseClassPathForScanning(java.lang.Iterable<java.net.URL> urls)
This should normally be invoked early in the server startup. Setting it after the catalog is loaded will not take effect without an explicit internal call to do so. Once set, it can be changed prior to catalog loading but it cannot be changed once the catalog is loaded.
ClasspathHelper.forJavaClassPath() is often a good argument to pass, and is used internally in some places when no items are found on the catalog.
setBaseClassPathForScanning
in interface ManagementContextInternal
public java.lang.Iterable<java.net.URL> getBaseClassPathForScanning()
getBaseClassPathForScanning
in interface ManagementContextInternal
setBaseClassPathForScanning(Iterable)
public BrooklynGarbageCollector getGarbageCollector()
public void setManagementNodeUri(java.net.URI uri)
setManagementNodeUri
in interface ManagementContextInternal
public Maybe<java.net.URI> getManagementNodeUri()
ManagementContext
getManagementNodeUri
in interface ManagementContext
public CatalogInitialization getCatalogInitialization()
getCatalogInitialization
in interface ManagementContextInternal
public void setCatalogInitialization(CatalogInitialization catalogInitialization)
setCatalogInitialization
in interface ManagementContextInternal
public BrooklynObject lookup(java.lang.String id)
ManagementContext
ManagementContext.lookup(String, Class)
but not constraining the return typelookup
in interface ManagementContext
public <T extends BrooklynObject> T lookup(java.lang.String id, java.lang.Class<T> type)
ManagementContext
lookup
in interface ManagementContext
public java.util.List<java.lang.Throwable> errors()
ManagementContextInternal
errors
in interface ManagementContextInternal