Class RuntimeProject
- java.lang.Object
-
- com.inductiveautomation.ignition.common.project.AbstractProject
-
- com.inductiveautomation.ignition.common.project.RuntimeProject
-
- All Implemented Interfaces:
Project,java.io.Serializable
public class RuntimeProject extends AbstractProject
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRuntimeProject.DiffExceptionstatic classRuntimeProject.EffectiveProjectSnapshotAn EffectiveProjectSnapshot is aProjectSnapshotof a project and its effective resource set plus additional information about what its hierarchy was at the time the snapshot was made.static classRuntimeProject.GsonAdapterstatic classRuntimeProject.RuntimeProjectBuilder
-
Field Summary
-
Fields inherited from interface com.inductiveautomation.ignition.common.project.Project
GLOBAL_PROJECT_NAME, PIPELINE_PROJECT_NAME, PROJECT_NAME_PATTERN, SFC_PROJECT_NAME
-
-
Constructor Summary
Constructors Constructor Description RuntimeProject(java.util.List<NamedManifest> projects, java.util.Map<ProjectResourceId,ProjectResource> resources)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ProjectDiff.EffectiveDiffapplyChange(java.util.List<ProjectDiff.AbsoluteDiff> diffs)java.util.Optional<java.util.List<ProjectResource>>browse(ResourcePath path)static RuntimeProjectcreateAndValidate(java.util.List<NamedManifest> projects, java.util.Map<ProjectResourceId,ProjectResource> resources)ProjectDiff.EffectiveDiffdiff(RuntimeProject.EffectiveProjectSnapshot effectiveSnapshot)Get aProjectDiffgenerated by diffing anRuntimeProject.EffectiveProjectSnapshotfromgetEffectiveSnapshot()with the current *effective* state of the project.java.util.Map<ProjectResourceId,ProjectResource>getAllResources()Get a List of all resources in this project and all parent projects.RuntimeProject.EffectiveProjectSnapshotgetEffectiveSnapshot()ProjectManifestgetManifest()Get theProjectManifestfor this Project.java.lang.StringgetName()java.util.List<NamedManifest>getProjectInheritanceStructure()java.util.List<ProjectSnapshot>getProjectSnapshots()Gets the snapshots from the effective project, in order of project inheritance (leaf project last)java.util.Optional<ProjectResource>getResource(ResourcePath path)Finds the resource at the given path, using an effective view of the resources in this project chain.java.util.Optional<RuntimeProject>validate()Validate thisRuntimeProjectby following inheritable project projects until a root is found.RuntimeProjectvalidateOrThrow()Validate thisRuntimeProjectby following inheritable parent projects until a root is found.-
Methods inherited from class com.inductiveautomation.ignition.common.project.AbstractProject
addProjectResourceListener, getEffectiveResources, getListeners, getResources, getResourcesOfType, hasResourcesOfType, removeProjectResourceListener, 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.project.Project
getDescription, getParent, getResource, getSingletonResource, getTitle, isEnabled, isInheritable, isRunnable
-
-
-
-
Constructor Detail
-
RuntimeProject
public RuntimeProject(@Nonnull java.util.List<NamedManifest> projects, @Nonnull java.util.Map<ProjectResourceId,ProjectResource> resources)
-
-
Method Detail
-
createAndValidate
public static RuntimeProject createAndValidate(@Nonnull java.util.List<NamedManifest> projects, @Nonnull java.util.Map<ProjectResourceId,ProjectResource> resources) throws ProjectInvalidException
- Parameters:
projects- the list ofNamedManifests that comprise the project hierarchy.resources- theProjectResources for this project.- Returns:
- a validated
RuntimeProject. - Throws:
ProjectInvalidException- if validation fails.- See Also:
validateOrThrow()
-
validate
public java.util.Optional<RuntimeProject> validate()
Validate thisRuntimeProjectby following inheritable project projects until a root is found.- Returns:
- an
Optionalcontaining thisRuntimeProjectinstance if it was validated.
-
validateOrThrow
public RuntimeProject validateOrThrow() throws ProjectInvalidException
Validate thisRuntimeProjectby following inheritable parent projects until a root is found.- Returns:
- this
RuntimeProjectinstance. - Throws:
ProjectInvalidException- if the project hierarchy is invalid.
-
getName
public java.lang.String getName()
- Returns:
- the name of this Project.
-
getManifest
public ProjectManifest getManifest()
Description copied from interface:ProjectGet theProjectManifestfor this Project.- Returns:
- the
ProjectManifestfor this Project.
-
getProjectInheritanceStructure
public java.util.List<NamedManifest> getProjectInheritanceStructure()
- Returns:
- A list of all of the projects and their manifests that comprise the inheritance chain of this project. This list is ordered in ascending inheritance order, from leaf project first to super-most project last.
-
getAllResources
public java.util.Map<ProjectResourceId,ProjectResource> getAllResources()
Description copied from interface:ProjectGet 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
public java.util.Optional<ProjectResource> getResource(ResourcePath path)
Description copied from interface:ProjectFinds 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
public java.util.Optional<java.util.List<ProjectResource>> browse(@Nonnull ResourcePath path)
- 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
-
getProjectSnapshots
public java.util.List<ProjectSnapshot> getProjectSnapshots()
Description copied from interface:ProjectGets the snapshots from the effective project, in order of project inheritance (leaf project last)- Returns:
- A list of ProjectSnapshots, one per project represented in the effective project.
-
applyChange
public ProjectDiff.EffectiveDiff applyChange(java.util.List<ProjectDiff.AbsoluteDiff> diffs)
-
getEffectiveSnapshot
public RuntimeProject.EffectiveProjectSnapshot getEffectiveSnapshot()
Get anRuntimeProject.EffectiveProjectSnapshot.This snapshot can be used with
diff(EffectiveProjectSnapshot)at some later time to obtain aProjectDiffdescribing what has changed.- Returns:
- an effective
RuntimeProject.EffectiveProjectSnapshot.
-
diff
public ProjectDiff.EffectiveDiff diff(RuntimeProject.EffectiveProjectSnapshot effectiveSnapshot) throws RuntimeProject.DiffException
Get aProjectDiffgenerated by diffing anRuntimeProject.EffectiveProjectSnapshotfromgetEffectiveSnapshot()with the current *effective* state of the project.- Parameters:
effectiveSnapshot- anRuntimeProject.EffectiveProjectSnapshotfromgetEffectiveSnapshot().- Returns:
- a
ProjectDiff. - Throws:
RuntimeProject.DiffException- if the diff cannot be completed because the project hierarchy changed since the snapshot was taken.
-
-