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 Details

    • HomeStatsServiceImpl

      public HomeStatsServiceImpl()
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet()
      Load any persisted snapshot on bean startup so that getCached() 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.PostConstruct isn't on the gemma-core classpath (dropped in the Phase 3 Jakarta cleanup) so Spring's InitializingBean provides the lifecycle slot — same pattern as AclClassIdInitializer.

      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • getCached

      public HomeStats getCached()
      Description copied from interface: HomeStatsService
      Return the most-recent snapshot, loading from disk on first access. Returns null only 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:
      getCached in interface HomeStatsService
    • refresh

      @Transactional(readOnly=true) public HomeStats refresh()
      Description copied from interface: HomeStatsService
      Recompute the snapshot from scratch (anonymous-user perspective), persist to disk, and update the in-memory cache.
      Specified by:
      refresh in interface HomeStatsService