Skip to content

Commit

Permalink
Merge pull request #464 from stuartwoodman/AUS-4065-Build-KnownLayers…
Browse files Browse the repository at this point in the history
…-After-CSW-Caching

AUS-4065 Build KnownLayers after CSW caching
  • Loading branch information
laughing0li authored Dec 6, 2023
2 parents 98d8384 + 2748592 commit e8dab77
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import org.auscope.portal.core.services.responses.csw.CSWRecordTransformerFactory;
import org.auscope.portal.core.util.FileIOUtil;
import org.objenesis.strategy.StdInstantiatorStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;

import com.esotericsoftware.kryo.Kryo;

Expand Down Expand Up @@ -84,6 +86,11 @@ public class CSWCacheService {
/** If true, this class will force the usage of HTTP GetMethods instead of POST methods (where possible). Useful workaround for some CSW services */
protected boolean forceGetMethods = false;
protected Date lastCacheUpdate;

// KnownLayerService needs to be informed when indexing is finished, must be @Lazy loaded to avoid circular dependencies
@Autowired
@Lazy
private KnownLayerService knownLayerService;

/**
* Creates a new instance of a CSWKeywordCacheService. This constructor is normally autowired by the spring framework.
Expand Down Expand Up @@ -257,6 +264,10 @@ private synchronized void updateFinished(Map<String, Set<CSWRecord>> newKeywordC
this.keywordsByRegistry = newKeywordByEndpointCache;
}
saveCacheToFile();

// Inform KnownLayerService that there are potentially new CSWRecords
knownLayerService.updateKnownLayersCache();

this.updateRunning = false;
this.lastCacheUpdate = new Date();

Expand Down

0 comments on commit e8dab77

Please sign in to comment.