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 thePerspectiveProjectwith the given name from the cache.java.util.List<PerspectiveProjectDisplayData>getAll()Fetches allPerspectiveProjecton the gateway and returns them as a list ofPerspectiveProjectDisplayDatajava.util.Optional<ProjectUpdateResponse>getDiff(java.lang.String projectName, RuntimeProject.EffectiveProjectSnapshot snapshot)java.util.List<PerspectiveProjectDisplayData>getDisplayable()Fetches all Runnable and displayablePerspectiveProjectson the gateway and returns them as a list ofPerspectiveProjectDisplayDatacom.google.common.eventbus.EventBusgetEventBus()Fetch theEventBusfor thisPerspectiveProjectCache.voidshutdown()voidstartup()
-
-
-
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:PerspectiveProjectCacheFetch theEventBusfor thisPerspectiveProjectCache. Interested parties maySubscribeto receiveProjectUpdatedEventswhen projects are updated, andProjectDeletedEventswhen projects are deleted.- Specified by:
getEventBusin interfacePerspectiveProjectCache- Returns:
- The event bus
-
get
@Nonnull public java.util.Optional<PerspectiveProject> get(java.lang.String projectName)
Description copied from interface:PerspectiveProjectCacheFetch thePerspectiveProjectwith the given name from the cache. If the cache does not have the entry, it will attempt to load from theProjectManageror 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:
getin interfacePerspectiveProjectCache- Returns:
- An
Optionalcontaining 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:PerspectiveProjectCacheFetches allPerspectiveProjecton the gateway and returns them as a list ofPerspectiveProjectDisplayData- Specified by:
getAllin interfacePerspectiveProjectCache
-
getDisplayable
@Nonnull public java.util.List<PerspectiveProjectDisplayData> getDisplayable()
Description copied from interface:PerspectiveProjectCacheFetches all Runnable and displayablePerspectiveProjectson the gateway and returns them as a list ofPerspectiveProjectDisplayData- Specified by:
getDisplayablein interfacePerspectiveProjectCache
-
getDiff
public java.util.Optional<ProjectUpdateResponse> getDiff(java.lang.String projectName, RuntimeProject.EffectiveProjectSnapshot snapshot)
- Specified by:
getDiffin 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.
-
-