Changeset 08faf7d


Ignore:
Timestamp:
Aug 21, 2017 10:01:12 AM (4 weeks ago)
Author:
www-data <www-data@…>
Branches:
master
Children:
58763c7
Parents:
e87a9d5
git-author:
Bang Pham Huu <b.phamhuu@…> (08/18/17 16:12:46)
git-committer:
www-data <www-data@…> (08/21/17 10:01:12)
Message:

ticket:502 - Coverages's extents for wcs_client should be created only when wcs_client sends request instead of initializing it when Petascope starts

Summary:
wcs_client needs coverages's extents to display on WebWorldWind? via /GetCoverageExtents? request. Before, it was created when Petascope starts.
This leads to a problem as when Tomcat restarts, rasdaman.war is deployed and secoredb is not deployed yet, and Petascope cannot fetch CRSs's metadata from SECORE, thus, petascope cannot start.
Therefore, coverages's extents should only be created after Petascope started successfully when wcs_client sends WCS GetCapabilities? request.

Test Plan: This was tested in a test server which has this problem and Petascope could not start.

Reviewers: dmisev

Differential Revision: http://codereview.rasdaman.org/D453

Location:
applications/petascope
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • applications/petascope/petascope_core/src/main/java/org/rasdaman/config/ConfigManager.java

    re87a9d5 r08faf7d  
    133133    /* ***** SECORE configuration ***** */
    134134    public static List<String> SECORE_URLS;
    135     // NOTE: time to read CRS from SECORE can be slow when Tomcat restarts and SECORE is initializing, so petascope should wait longer.
    136135    public static final int CRSRESOLVER_CONN_TIMEOUT = 10000;
    137136    public static final int CRSRESOLVER_READ_TIMEOUT = 10000;
  • applications/petascope/petascope_core/src/main/java/org/rasdaman/repository/service/CoverageRepostioryService.java

    r0631145c r08faf7d  
    4848import petascope.util.CrsUtil;
    4949import org.rasdaman.repository.interfaces.CoverageRepository;
    50 import org.springframework.transaction.annotation.Propagation;
    5150import petascope.core.AxisTypes;
    5251import petascope.core.BoundingBox;
    5352import petascope.core.Pair;
    5453import petascope.util.CrsProjectionUtil;
    55 import petascope.util.ListUtil;
    5654
    5755/**
     
    102100     */
    103101    private void initCoveragesCache() throws PetascopeException, SecoreException {
    104         this.readAllCoveragesBasicMetatata();
    105         // After reading all coverages's basic metadata, then create the XY axes's extent in EPSG:4326 for WCS_Client to display in a map
    106         this.createAllCoveragesExtents();
     102        this.readAllCoveragesBasicMetatata();       
    107103        log.debug("Initialized all the coverages's metadata to cache.");
    108104    }
     
    204200     * @return List<Pair<Coverage, Boolean>>
    205201     */
    206     public List<Pair<Coverage, Boolean>> readAllCoveragesBasicMetatata() {
     202    public List<Pair<Coverage, Boolean>> readAllCoveragesBasicMetatata() throws PetascopeException, SecoreException {       
    207203        long start = System.currentTimeMillis();
    208204
     
    258254     * @throws petascope.exceptions.SecoreException
    259255     */
    260     private void createAllCoveragesExtents() throws PetascopeException, SecoreException {
     256    public void createAllCoveragesExtents() throws PetascopeException, SecoreException {
    261257        long start = System.currentTimeMillis();
    262258        for (String coverageId : coveragesCacheMap.keySet()) {
    263             this.createCoverageExtents(coverageId);
     259            this.createCoverageExtent(coverageId);
    264260        }
    265261
     
    272268     * (EnvelopeByAxis). The XY axes' BoundingBox is reprojected to EPSG:4326.
    273269     */
    274     private void createCoverageExtents(String coverageId) throws PetascopeException, SecoreException {
     270    private void createCoverageExtent(String coverageId) throws PetascopeException, SecoreException {
    275271        // Tranformed XY extents to EPSG:4326 (Long, Lat for OpenLayers)
    276272        BoundingBox boundingBox = new BoundingBox();
     
    397393        coveragesCacheMap.put(coverageId, new Pair(coverage, false));
    398394        // Also insert/update the coverage's extent in cache as the bounding box of XY axes can be extended by WCST_Import.
    399         this.createCoverageExtents(coverageId);
     395        this.createCoverageExtent(coverageId);
    400396
    401397        log.debug("Coverage '" + coverageId + "' is persisted in database.");
  • applications/petascope/petascope_main/src/main/java/org/rasdaman/BeanApplicationConfiguration.java

    r7d15c94 r08faf7d  
    2525import org.springframework.context.annotation.Bean;
    2626import org.springframework.context.annotation.Configuration;
    27 import org.springframework.transaction.annotation.EnableTransactionManagement;
    2827import org.springframework.web.filter.HiddenHttpMethodFilter;
    2928import org.springframework.web.servlet.config.annotation.CorsRegistry;
  • applications/petascope/petascope_main/src/main/java/petascope/controller/GetCoveragesExtentsController.java

    r1ede013 r08faf7d  
    3434import org.rasdaman.repository.service.CoverageRepostioryService;
    3535import org.slf4j.LoggerFactory;
    36 import org.springframework.stereotype.Controller;
     36import org.springframework.beans.factory.annotation.Autowired;
    3737import org.springframework.web.bind.annotation.RequestMapping;
    3838import org.springframework.web.bind.annotation.RequestMethod;
     
    6060
    6161    private static org.slf4j.Logger log = LoggerFactory.getLogger(GetCoveragesExtentsController.class);
     62   
     63    @Autowired
     64    CoverageRepostioryService coverageRepostioryService;
    6265
    6366    @RequestMapping(value = OWS + "/" + GET_COVERAGE_EXTENTS, method = RequestMethod.POST)
     
    8689     * @throws WCSException
    8790     */
    88     private Response handle(Map<String, String[]> kvpParameters) throws WCSException {
     91    private Response handle(Map<String, String[]> kvpParameters) throws WCSException, PetascopeException, SecoreException {
    8992        // Default load all coverages's extents
    9093        String coverageId = null;
     
    99102                // Return all coverages's extents
    100103                List<CoverageExtent> coveragesExtents = new ArrayList<>();
     104                       
     105                // This GetCoverageExtents request is sent from wcs_client after WCS GetCapabilities request, then all the coverages's metadata should be ready
     106                // then create the XY axes's extent in EPSG:4326 for WCS_Client to display in WebWorldWind
     107                coverageRepostioryService.createAllCoveragesExtents();
     108               
    101109                for (Map.Entry<String, BoundingBox> entry : CoverageRepostioryService.coveragesExtentsCacheMap.entrySet()) {
    102110                    coveragesExtents.add(new CoverageExtent(entry.getKey(), entry.getValue()));
Note: See TracChangeset for help on using the changeset viewer.