Class RuntimeResourceCollection
java.lang.Object
com.inductiveautomation.ignition.common.resourcecollection.AbstractResourceCollection
com.inductiveautomation.ignition.common.resourcecollection.RuntimeResourceCollection
- All Implemented Interfaces:
ResourceCollection
A resource collection that holds an inheritance hierarchy of collections and can be easily kept up-to-date using
diffs. This is the most common way to use a resource collection (often, known as a "project") in Ignition, unless
you are trying to manipulate the collection, usually in the Designer.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
An EffectiveSnapshot is aSnapshot
of a Resource Collection and its effective resource set plus additional information about what its hierarchy was at the time the snapshot was made. -
Field Summary
Fields inherited from interface com.inductiveautomation.ignition.common.resourcecollection.ResourceCollection
GLOBAL_PROJECT_NAME, PIPELINE_PROJECT_NAME, PROJECT_NAME_PATTERN, SFC_PROJECT_NAME
-
Constructor Summary
ConstructorsConstructorDescriptionRuntimeResourceCollection
(List<NamedManifest> manifestList, Map<ResourceId, Resource> resources) -
Method Summary
Modifier and TypeMethodDescriptionapplyChange
(List<ResourceCollectionDiff.AbsoluteDiff> diffs, @Nullable Object contextObject) browse
(ResourcePath path) static RuntimeResourceCollection
createAndValidate
(List<NamedManifest> manifestList, Map<ResourceId, Resource> resources) Create aRuntimeResourceCollection
frommanifestList
andresources
and validate it before returning.diff
(RuntimeResourceCollection.EffectiveSnapshot effectiveSnapshot) Get aResourceCollectionDiff
generated by diffing anRuntimeResourceCollection.EffectiveSnapshot
fromgetEffectiveSnapshot()
with the current *effective* state of the resource collection.Get a List of all resources in this project and all parent projects.Get theResourceCollectionManifest
for this Project.getName()
getResource
(ResourcePath path) Finds the resource at the given path, using an effective view of the resources in this project chain.Gets the snapshots from the effective resource collection, in reverse order of inheritance (leaf collection first)validate()
Validate thisRuntimeResourceCollection
by following inheritable project projects until a root is found.Validate thisRuntimeResourceCollection
by following inheritable parent projects until a root is found.Methods inherited from class com.inductiveautomation.ignition.common.resourcecollection.AbstractResourceCollection
addResourceListener, getEffectiveResources, getListeners, getResources, getResourcesOfType, hasResourcesOfType, removeResourceListener, updateEffectiveState, updateEffectiveState
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.inductiveautomation.ignition.common.resourcecollection.ResourceCollection
getDescription, getParent, getResource, getSingletonResource, getTitle, isEnabled, isInheritable, isRunnable
-
Constructor Details
-
RuntimeResourceCollection
public RuntimeResourceCollection(@Nonnull List<NamedManifest> manifestList, @Nonnull Map<ResourceId, Resource> resources)
-
-
Method Details
-
createAndValidate
public static RuntimeResourceCollection createAndValidate(@Nonnull List<NamedManifest> manifestList, @Nonnull Map<ResourceId, Resource> resources) throws ResourceCollectionInvalidExceptionCreate aRuntimeResourceCollection
frommanifestList
andresources
and validate it before returning.- Parameters:
manifestList
- the list ofNamedManifest
s that comprise the hierarchy of resource collectionsresources
- theResource
s for this project.- Returns:
- a validated
RuntimeResourceCollection
. - Throws:
ResourceCollectionInvalidException
- if validation fails.- See Also:
-
validate
Validate thisRuntimeResourceCollection
by following inheritable project projects until a root is found.- Returns:
- an
Optional
containing thisRuntimeResourceCollection
instance if it was validated.
-
validateOrThrow
Validate thisRuntimeResourceCollection
by following inheritable parent projects until a root is found.- Returns:
- this
RuntimeResourceCollection
instance. - Throws:
ResourceCollectionInvalidException
- if the project hierarchy is invalid.
-
getName
- Returns:
- the name of this Project.
-
getManifest
Description copied from interface:ResourceCollection
Get theResourceCollectionManifest
for this Project.- Returns:
- the
ResourceCollectionManifest
for this Project.
-
getInheritanceStructure
- Returns:
- A list of all the resource collection manifests that comprise the inheritance chain of this collection. This list is ordered in ascending inheritance order, from leaf first to super-most collection last.
-
getAllResources
Description copied from interface:ResourceCollection
Get a List of all resources in this project and all parent projects.This includes resources belonging to parent projects in the inheritance chain if this is a "stack" of projects. This means that there may be multiple resources for any given
ResourcePath
.This project instance may not contain all resources that exist for the project on disk, depending on the
ResourceFilter
used to load it.- Returns:
- all the resources belonging to this project instance, including resources from parent projects.
-
getResource
Description copied from interface:ResourceCollection
Finds the resource at the given path, using an effective view of the resources in this project chain.- Parameters:
path
- Not null- Returns:
- The matching project resource or empty if not found.
-
browse
- Parameters:
path
- the resourcePath of the folder to browse- Returns:
- an empty optional if the given path was not found or is not browseable, otherwise its direct children
-
getSnapshots
Description copied from interface:ResourceCollection
Gets the snapshots from the effective resource collection, in reverse order of inheritance (leaf collection first)- Returns:
- A list of Snapshots, one per resource collection represented in the effective project.
-
applyChange
public ResourceCollectionDiff.EffectiveDiff applyChange(List<ResourceCollectionDiff.AbsoluteDiff> diffs) -
applyChange
public ResourceCollectionDiff.EffectiveDiff applyChange(List<ResourceCollectionDiff.AbsoluteDiff> diffs, @Nullable @Nullable Object contextObject) -
getEffectiveSnapshot
Get anRuntimeResourceCollection.EffectiveSnapshot
.This snapshot can be used with
diff(EffectiveSnapshot)
at some later time to obtain aResourceCollectionDiff
describing what has changed.- Returns:
- an effective
RuntimeResourceCollection.EffectiveSnapshot
.
-
diff
public ResourceCollectionDiff.EffectiveDiff diff(RuntimeResourceCollection.EffectiveSnapshot effectiveSnapshot) throws RuntimeResourceCollection.DiffException Get aResourceCollectionDiff
generated by diffing anRuntimeResourceCollection.EffectiveSnapshot
fromgetEffectiveSnapshot()
with the current *effective* state of the resource collection.- Parameters:
effectiveSnapshot
- anRuntimeResourceCollection.EffectiveSnapshot
fromgetEffectiveSnapshot()
.- Returns:
- a
ResourceCollectionDiff
. - Throws:
RuntimeResourceCollection.DiffException
- if the diff cannot be completed because the project hierarchy changed since the snapshot was taken.
-