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 classstatic classAn EffectiveSnapshot is aSnapshotof 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 RuntimeResourceCollectioncreateAndValidate(List<NamedManifest> manifestList, Map<ResourceId, Resource> resources) Create aRuntimeResourceCollectionfrommanifestListandresourcesand validate it before returning.diff(RuntimeResourceCollection.EffectiveSnapshot effectiveSnapshot) Get aResourceCollectionDiffgenerated by diffing anRuntimeResourceCollection.EffectiveSnapshotfromgetEffectiveSnapshot()with the current *effective* state of the resource collection.Get a List of all resources in this project and all parent projects.Get theResourceCollectionManifestfor 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 thisRuntimeResourceCollectionby following inheritable project projects until a root is found.Validate thisRuntimeResourceCollectionby 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, updateEffectiveStateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 aRuntimeResourceCollectionfrommanifestListandresourcesand validate it before returning.- Parameters:
manifestList- the list ofNamedManifests that comprise the hierarchy of resource collectionsresources- theResources for this project.- Returns:
- a validated
RuntimeResourceCollection. - Throws:
ResourceCollectionInvalidException- if validation fails.- See Also:
-
validate
Validate thisRuntimeResourceCollectionby following inheritable project projects until a root is found.- Returns:
- an
Optionalcontaining thisRuntimeResourceCollectioninstance if it was validated.
-
validateOrThrow
Validate thisRuntimeResourceCollectionby following inheritable parent projects until a root is found.- Returns:
- this
RuntimeResourceCollectioninstance. - Throws:
ResourceCollectionInvalidException- if the project hierarchy is invalid.
-
getName
- Returns:
- the name of this Project.
-
getManifest
Description copied from interface:ResourceCollectionGet theResourceCollectionManifestfor this Project.- Returns:
- the
ResourceCollectionManifestfor 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:ResourceCollectionGet 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
ResourceFilterused to load it.- Returns:
- all the resources belonging to this project instance, including resources from parent projects.
-
getResource
Description copied from interface:ResourceCollectionFinds 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:ResourceCollectionGets 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 aResourceCollectionDiffdescribing what has changed.- Returns:
- an effective
RuntimeResourceCollection.EffectiveSnapshot.
-
diff
public ResourceCollectionDiff.EffectiveDiff diff(RuntimeResourceCollection.EffectiveSnapshot effectiveSnapshot) throws RuntimeResourceCollection.DiffException Get aResourceCollectionDiffgenerated by diffing anRuntimeResourceCollection.EffectiveSnapshotfromgetEffectiveSnapshot()with the current *effective* state of the resource collection.- Parameters:
effectiveSnapshot- anRuntimeResourceCollection.EffectiveSnapshotfromgetEffectiveSnapshot().- Returns:
- a
ResourceCollectionDiff. - Throws:
RuntimeResourceCollection.DiffException- if the diff cannot be completed because the project hierarchy changed since the snapshot was taken.
-