Class ResourceCollectionLifecycle
- All Implemented Interfaces:
Lifecycle
- Direct Known Subclasses:
EventStreamProjectLifecycleFactory.Lifecycle
AbstractLifecycle that is designed to make implementing
lifecycle management for a RuntimeResourceCollection easier.
The way to use this class is to implement a subclass that is interested in a specific type or set of
types of resource. Instances of this class will then be created by a ResourceCollectionLifecycleFactory
and startup up for each relevant resource collection in the system.
Whenever the resource collection is changed, this class's listener methods will be invoked, in the following order.
onBeforeChanges(ResourceChangeContext)onResourcesDeleted(List)onResourcesCreated(List)onResourcesModified(List)onManifestChanged(ResourceCollectionManifest)onAfterChanges()
onBeforeChanges(ResourceChangeContext) and onAfterChanges() are guaranteed to be called
once for each resource collection update.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedResourceCollectionLifecycle(RuntimeResourceCollection resourceCollection) -
Method Summary
Modifier and TypeMethodDescriptionGet the filter that filters Resources provided toonResourcesCreated(List)andonResourcesModified(List).final voidinitialize(ResourceFilter resourceFilter) protected voidCalled after a series of calls to the resource modification methods is complete.protected voidonBeforeChanges(ResourceChangeContext context) Called before a series of calls to the resource modification methods begins.protected voidonManifestChanged(ResourceCollectionManifest manifest) TheResourceCollectionManifestfor the Project managed by this lifecycle has changed.protected abstract voidonResourcesCreated(List<Resource> resources) Resources matching the interests of this lifecycle were created.protected abstract voidonResourcesDeleted(List<ResourceId> resourceIds) Resources matching the interests of this lifecycle were deleted.protected abstract voidonResourcesModified(List<Resource> resources) Resources matching the interests of this lifecycle were modified.protected final voidprotected abstract voidonShutdown(List<ResourceId> resourceIds) Shut down thisResourceCollectionLifecycle.protected final voidprotected abstract voidStart thisResourceCollectionLifecycle.Methods inherited from class com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
isRunning, shutdown, startup
-
Constructor Details
-
ResourceCollectionLifecycle
-
-
Method Details
-
initialize
-
onStartup
protected final void onStartup()- Specified by:
onStartupin classAbstractLifecycle
-
onShutdown
protected final void onShutdown()- Specified by:
onShutdownin classAbstractLifecycle
-
getResourceCollection
-
onStartup
Start thisResourceCollectionLifecycle.- Parameters:
resources- initial list of resources that match the scope and type interests of this lifecycle.
-
onShutdown
Shut down thisResourceCollectionLifecycle.- Parameters:
resourceIds- list ofResourceIds that match the scope and type interests of this lifecycle.
-
getResourceChangeFilter
Get the filter that filters Resources provided toonResourcesCreated(List)andonResourcesModified(List).- Returns:
- the filter
-
onBeforeChanges
Called before a series of calls to the resource modification methods begins. -
onAfterChanges
protected void onAfterChanges()Called after a series of calls to the resource modification methods is complete. -
onManifestChanged
TheResourceCollectionManifestfor the Project managed by this lifecycle has changed.- Parameters:
manifest- the updatedResourceCollectionManifest.
-
onResourcesCreated
Resources matching the interests of this lifecycle were created.This is a chance for subclasses to do something of interest with these new resources, e.g. "run" them.
- Parameters:
resources-Resources matching the interests of this lifecycle.
-
onResourcesModified
Resources matching the interests of this lifecycle were modified.This is a chance for subclasses to do something of interest with these modified resources, e.g. stop "running" something based on the old resource and start "running" something based on the newly modified resource.
- Parameters:
resources-Resources matching the interests of this lifecycle.
-
onResourcesDeleted
Resources matching the interests of this lifecycle were deleted.This is a chance for subclasses to do something of interest with these deleted resources, e.g. stop "running" something based on the resource.
- Parameters:
resourceIds-ResourceIds matching the interests of this lifecycle.
-