Class ProjectLifecycleFactory<T extends ProjectLifecycle>
- java.lang.Object
-
- com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
-
- com.inductiveautomation.ignition.gateway.project.ProjectLifecycleFactory<T>
-
public abstract class ProjectLifecycleFactory<T extends ProjectLifecycle> extends AbstractLifecycle
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.function.Predicate<RuntimeProject>
PROJECT_IS_RUNNABLE
-
Constructor Summary
Constructors Constructor Description ProjectLifecycleFactory(ProjectManagerBase projectManager)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract T
createProjectLifecycle(RuntimeProject project)
Create an instance ofProjectLifecycle
that can manage runtime and lifecycle forproject
.java.util.Optional<T>
getLifecycle(java.lang.String projectName)
Get theProjectLifecycle
forprojectName
, if it exists.com.google.common.collect.ImmutableList<T>
getLifecycles()
Get an immutable copy of the currentProjectLifecycle
s.java.util.function.Predicate<RuntimeProject>
getProjectFilter()
Return aPredicate
that indicates whether a project should have aProjectLifecycle
created for it.protected abstract ResourceFilter
getResourceFilter()
Get theResourceFilter
to apply when getting matching resources this lifecycle is interested in.protected void
onShutdown()
protected void
onStartup()
void
restartAll()
We may need to restart all lifecycles of a type (such as scripting) if a module is installed, restarted or uninstalled.-
Methods inherited from class com.inductiveautomation.ignition.common.lifecycle.AbstractLifecycle
isRunning, shutdown, startup
-
-
-
-
Field Detail
-
PROJECT_IS_RUNNABLE
public static final java.util.function.Predicate<RuntimeProject> PROJECT_IS_RUNNABLE
-
-
Constructor Detail
-
ProjectLifecycleFactory
public ProjectLifecycleFactory(ProjectManagerBase projectManager)
-
-
Method Detail
-
onStartup
protected final void onStartup()
- Specified by:
onStartup
in classAbstractLifecycle
-
onShutdown
protected final void onShutdown()
- Specified by:
onShutdown
in classAbstractLifecycle
-
getLifecycle
public java.util.Optional<T> getLifecycle(java.lang.String projectName)
Get theProjectLifecycle
forprojectName
, if it exists.- Parameters:
projectName
- the project name the lifecycle belongs to.- Returns:
- the
ProjectLifecycle
forprojectName
, if it exists.
-
getLifecycles
public final com.google.common.collect.ImmutableList<T> getLifecycles()
Get an immutable copy of the currentProjectLifecycle
s.- Returns:
- an immutable copy of the current
ProjectLifecycle
s.
-
createProjectLifecycle
public abstract T createProjectLifecycle(RuntimeProject project)
Create an instance ofProjectLifecycle
that can manage runtime and lifecycle forproject
.- Parameters:
project
- theRuntimeProject
that will be run.- Returns:
- a
ProjectLifecycle
that can manage runtime and lifecycle forproject
.
-
restartAll
public void restartAll()
We may need to restart all lifecycles of a type (such as scripting) if a module is installed, restarted or uninstalled. Most LifecycleFactories will not override this.
-
getResourceFilter
protected abstract ResourceFilter getResourceFilter()
Get theResourceFilter
to apply when getting matching resources this lifecycle is interested in.- Returns:
- the
ResourceFilter
to apply when matching resources this lifecycle is interested in.
-
getProjectFilter
public java.util.function.Predicate<RuntimeProject> getProjectFilter()
Return aPredicate
that indicates whether a project should have aProjectLifecycle
created for it.For example, if the project doesn't contain any resources of a certain type then this predicate could return
false
to avoid creating a lifecycle that doesn't actually have any resources to run.Should resources of an interesting type later get added the machinery of
ProjectLifecycleFactory
ensures a lifecycle will have a chance to be created at that time.- Returns:
- a
Predicate
that indicates whether a project should have aProjectLifecycle
created for it.
-
-