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 class
RuntimeProject.DiffException
static class
RuntimeProject.EffectiveProjectSnapshot
An EffectiveProjectSnapshot is aProjectSnapshot
of a project and its effective resource set plus additional information about what its hierarchy was at the time the snapshot was made.static class
RuntimeProject.GsonAdapter
static class
RuntimeProject.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.EffectiveDiff
applyChange(java.util.List<ProjectDiff.AbsoluteDiff> diffs)
java.util.Optional<java.util.List<ProjectResource>>
browse(ResourcePath path)
static RuntimeProject
createAndValidate(java.util.List<NamedManifest> projects, java.util.Map<ProjectResourceId,ProjectResource> resources)
ProjectDiff.EffectiveDiff
diff(RuntimeProject.EffectiveProjectSnapshot effectiveSnapshot)
Get aProjectDiff
generated by diffing anRuntimeProject.EffectiveProjectSnapshot
fromgetEffectiveSnapshot()
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.EffectiveProjectSnapshot
getEffectiveSnapshot()
ProjectManifest
getManifest()
Get theProjectManifest
for this Project.java.lang.String
getName()
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 thisRuntimeProject
by following inheritable project projects until a root is found.RuntimeProject
validateOrThrow()
Validate thisRuntimeProject
by 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 ofNamedManifest
s that comprise the project hierarchy.resources
- theProjectResource
s for this project.- Returns:
- a validated
RuntimeProject
. - Throws:
ProjectInvalidException
- if validation fails.- See Also:
validateOrThrow()
-
validate
public java.util.Optional<RuntimeProject> validate()
Validate thisRuntimeProject
by following inheritable project projects until a root is found.- Returns:
- an
Optional
containing thisRuntimeProject
instance if it was validated.
-
validateOrThrow
public RuntimeProject validateOrThrow() throws ProjectInvalidException
Validate thisRuntimeProject
by following inheritable parent projects until a root is found.- Returns:
- this
RuntimeProject
instance. - 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:Project
Get theProjectManifest
for this Project.- Returns:
- the
ProjectManifest
for 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:Project
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
public java.util.Optional<ProjectResource> getResource(ResourcePath path)
Description copied from interface:Project
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
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:Project
Gets 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 aProjectDiff
describing what has changed.- Returns:
- an effective
RuntimeProject.EffectiveProjectSnapshot
.
-
diff
public ProjectDiff.EffectiveDiff diff(RuntimeProject.EffectiveProjectSnapshot effectiveSnapshot) throws RuntimeProject.DiffException
Get aProjectDiff
generated by diffing anRuntimeProject.EffectiveProjectSnapshot
fromgetEffectiveSnapshot()
with the current *effective* state of the project.- Parameters:
effectiveSnapshot
- anRuntimeProject.EffectiveProjectSnapshot
fromgetEffectiveSnapshot()
.- Returns:
- a
ProjectDiff
. - Throws:
RuntimeProject.DiffException
- if the diff cannot be completed because the project hierarchy changed since the snapshot was taken.
-
-