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
ConstructorsModifierConstructorDescriptionprotected
ResourceCollectionLifecycle
(RuntimeResourceCollection resourceCollection) -
Method Summary
Modifier and TypeMethodDescriptionGet the filter that filters Resources provided toonResourcesCreated(List)
andonResourcesModified(List)
.final void
initialize
(ResourceFilter resourceFilter) protected void
Called after a series of calls to the resource modification methods is complete.protected void
onBeforeChanges
(ResourceChangeContext context) Called before a series of calls to the resource modification methods begins.protected void
onManifestChanged
(ResourceCollectionManifest manifest) TheResourceCollectionManifest
for the Project managed by this lifecycle has changed.protected abstract void
onResourcesCreated
(List<Resource> resources) Resources matching the interests of this lifecycle were created.protected abstract void
onResourcesDeleted
(List<ResourceId> resourceIds) Resources matching the interests of this lifecycle were deleted.protected abstract void
onResourcesModified
(List<Resource> resources) Resources matching the interests of this lifecycle were modified.protected final void
protected abstract void
onShutdown
(List<ResourceId> resourceIds) Shut down thisResourceCollectionLifecycle
.protected final void
protected abstract void
Start 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:
onStartup
in classAbstractLifecycle
-
onShutdown
protected final void onShutdown()- Specified by:
onShutdown
in 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 ofResourceId
s 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
TheResourceCollectionManifest
for 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
-Resource
s 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
-Resource
s 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
-ResourceId
s matching the interests of this lifecycle.
-