Class HomeStatsServiceImpl
java.lang.Object
ubic.gemma.core.analysis.report.HomeStatsServiceImpl
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, HomeStatsService
@Component("homeStatsService")
public class HomeStatsServiceImpl
extends Object
implements HomeStatsService, org.springframework.beans.factory.InitializingBean
Computes + caches the public home-page statistics snapshot. The computation runs
from the anonymous-user perspective (same security pattern as
WhatsNewServiceImpl)
so private datasets do not leak into the public counts.
Persistence: JSON file at ${gemma.appdata.home}/HomeStats/home_stats.json.
JSON, not Java serialization — survives class-shape changes across Gemma versions
and is human-readable for ops debugging.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidLoad any persisted snapshot on bean startup so thatgetCached()doesn't have to hit disk on the first REST request.Return the most-recent snapshot, loading from disk on first access.refresh()Recompute the snapshot from scratch (anonymous-user perspective), persist to disk, and update the in-memory cache.
-
Constructor Details
-
HomeStatsServiceImpl
public HomeStatsServiceImpl()
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet()Load any persisted snapshot on bean startup so thatgetCached()doesn't have to hit disk on the first REST request. A missing / unreadable file is treated as "no snapshot yet" — the daily refresher will populate it.jakarta.annotation.PostConstructisn't on the gemma-core classpath (dropped in the Phase 3 Jakarta cleanup) so Spring'sInitializingBeanprovides the lifecycle slot — same pattern asAclClassIdInitializer.- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
getCached
Description copied from interface:HomeStatsServiceReturn the most-recent snapshot, loading from disk on first access. Returnsnullonly if nothing has ever been generated AND the disk cache is missing — the REST layer should handle that as a 503 rather than synchronously building the snapshot under request load.- Specified by:
getCachedin interfaceHomeStatsService
-
refresh
Description copied from interface:HomeStatsServiceRecompute the snapshot from scratch (anonymous-user perspective), persist to disk, and update the in-memory cache.- Specified by:
refreshin interfaceHomeStatsService
-