Class PerspectiveProjectCacheImpl
- java.lang.Object
-
- com.inductiveautomation.perspective.gateway.cache.PerspectiveProjectCacheImpl
-
- All Implemented Interfaces:
PerspectiveProjectCache
public class PerspectiveProjectCacheImpl extends java.lang.Object implements PerspectiveProjectCache
-
-
Constructor Summary
Constructors Constructor Description PerspectiveProjectCacheImpl(GatewayContext gatewayContext, ComponentRegistry componentRegistry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<PerspectiveProject>
get(java.lang.String projectName)
Fetch thePerspectiveProject
with the given name from the cache.java.util.List<PerspectiveProjectDisplayData>
getAll()
Fetches allPerspectiveProject
on the gateway and returns them as a list ofPerspectiveProjectDisplayData
java.util.Optional<ProjectUpdateResponse>
getDiff(java.lang.String projectName, RuntimeProject.EffectiveProjectSnapshot snapshot)
java.util.List<PerspectiveProjectDisplayData>
getDisplayable()
Fetches all Runnable and displayablePerspectiveProjects
on the gateway and returns them as a list ofPerspectiveProjectDisplayData
com.google.common.eventbus.EventBus
getEventBus()
Fetch theEventBus
for thisPerspectiveProjectCache
.void
shutdown()
void
startup()
-
-
-
Constructor Detail
-
PerspectiveProjectCacheImpl
public PerspectiveProjectCacheImpl(GatewayContext gatewayContext, ComponentRegistry componentRegistry)
-
-
Method Detail
-
startup
public void startup()
-
shutdown
public void shutdown()
-
getEventBus
@Nonnull public com.google.common.eventbus.EventBus getEventBus()
Description copied from interface:PerspectiveProjectCache
Fetch theEventBus
for thisPerspectiveProjectCache
. Interested parties maySubscribe
to receiveProjectUpdatedEvents
when projects are updated, andProjectDeletedEvents
when projects are deleted.- Specified by:
getEventBus
in interfacePerspectiveProjectCache
- Returns:
- The event bus
-
get
@Nonnull public java.util.Optional<PerspectiveProject> get(java.lang.String projectName)
Description copied from interface:PerspectiveProjectCache
Fetch thePerspectiveProject
with the given name from the cache. If the cache does not have the entry, it will attempt to load from theProjectManager
or another source of record. If the ProjectManager does not have the entry, Optional.empty is returned since this means the project does not exist.- Specified by:
get
in interfacePerspectiveProjectCache
- Returns:
- An
Optional
containing the PerspectiveProject with the given name or an empty Optional if it does not exist or a problem occurred fetching it
-
getAll
@Nonnull public java.util.List<PerspectiveProjectDisplayData> getAll()
Description copied from interface:PerspectiveProjectCache
Fetches allPerspectiveProject
on the gateway and returns them as a list ofPerspectiveProjectDisplayData
- Specified by:
getAll
in interfacePerspectiveProjectCache
-
getDisplayable
@Nonnull public java.util.List<PerspectiveProjectDisplayData> getDisplayable()
Description copied from interface:PerspectiveProjectCache
Fetches all Runnable and displayablePerspectiveProjects
on the gateway and returns them as a list ofPerspectiveProjectDisplayData
- Specified by:
getDisplayable
in interfacePerspectiveProjectCache
-
getDiff
public java.util.Optional<ProjectUpdateResponse> getDiff(java.lang.String projectName, RuntimeProject.EffectiveProjectSnapshot snapshot)
- Specified by:
getDiff
in interfacePerspectiveProjectCache
- Parameters:
projectName
- Name of the (leaf) project to diff.snapshot
- The effective snapshot of the copy of the project that you already have.- Returns:
- A perspective project diff containing the things that have changed since the given snapshot was generated. Empty optional if the project doesn't exist.
-
-