Interface PerspectiveProjectCache
-
- All Known Implementing Classes:
PerspectiveProjectCacheImpl
public interface PerspectiveProjectCache
The PerspectiveProjectCache manages a cache of the latestProjectConfig
and concatenated css classes compiled from the style resource JSON sources on a per project version basis. The cache is keyed by the name of theProject
which contains the style resources. Interested parties can add and remove listeners of a project's config and style resource changes by subscribing to the event bus (seegetEventBus()
).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Optional<PerspectiveProject>
get(java.lang.String name)
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
.
-
-
-
Method Detail
-
getEventBus
@Nonnull com.google.common.eventbus.EventBus getEventBus()
Fetch theEventBus
for thisPerspectiveProjectCache
. Interested parties maySubscribe
to receiveProjectUpdatedEvents
when projects are updated, andProjectDeletedEvents
when projects are deleted.- Returns:
- The event bus
-
get
@Nonnull java.util.Optional<PerspectiveProject> get(java.lang.String name)
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.- 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 java.util.List<PerspectiveProjectDisplayData> getAll()
Fetches allPerspectiveProject
on the gateway and returns them as a list ofPerspectiveProjectDisplayData
-
getDisplayable
@Nonnull java.util.List<PerspectiveProjectDisplayData> getDisplayable()
Fetches all Runnable and displayablePerspectiveProjects
on the gateway and returns them as a list ofPerspectiveProjectDisplayData
-
getDiff
java.util.Optional<ProjectUpdateResponse> getDiff(java.lang.String projectName, RuntimeProject.EffectiveProjectSnapshot snapshot)
- 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.
-
-