Пример #1
0
  public boolean get(TileObject stObj) throws StorageException {
    stObj.setLayerId(idCache.getLayerId(stObj.getLayerName()));
    stObj.setFormatId(idCache.getFormatId(stObj.getBlobFormat()));
    stObj.setGridSetIdId(idCache.getGridSetsId(stObj.getGridSetId()));
    stObj.setParamtersId(idCache.getParametersId(stObj.getParameters()));

    try {

      boolean response = wrpr.getTile(stObj);
      while (stObj.getStatus().equals(Status.LOCK)) {
        try {
          Thread.sleep(lockRetryDelay);
        } catch (InterruptedException e) {
          e.printStackTrace();
        }

        response = wrpr.getTile(stObj);
      }

      return response;

    } catch (SQLException se) {
      log.error("Failed to get tile: " + se.getMessage());
    }

    return false;
  }
Пример #2
0
  public boolean deleteByGridsetId(final String layerName, final String gridsetName)
      throws StorageException {
    long layerId = idCache.getLayerId(layerName);
    long gridSetId = idCache.getGridSetsId(gridsetName);
    try {
      wrpr.deleteLayerGridSubset(layerId, gridSetId);
      return true;
    } catch (SQLException se) {
      log.error(
          "Failed to delete layer gridset '" + layerName + "'" + "/'" + gridsetName + "'", se);
    }

    return false;
  }
Пример #3
0
  public boolean delete(TileObject stObj) throws StorageException {
    stObj.setLayerId(idCache.getLayerId(stObj.getLayerName()));
    stObj.setFormatId(idCache.getFormatId(stObj.getBlobFormat()));
    long parametersId = idCache.getParametersId(stObj.getParameters());
    stObj.setParamtersId(parametersId);

    try {
      wrpr.deleteTile(stObj);
      return true;
    } catch (SQLException se) {
      log.error("Failed to get tile: " + se.getMessage());
    }

    return false;
  }
Пример #4
0
  public boolean rename(final String oldLayerName, final String newLayerName)
      throws StorageException {
    Assert.notNull(oldLayerName, "old layer name");
    Assert.notNull(newLayerName, "new layer name");

    long layerId = idCache.getLayerId(oldLayerName);
    try {
      wrpr.renameLayer(layerId, newLayerName);
      idCache.clear();
      return true;
    } catch (SQLException se) {
      log.error("Failed to rename layer '" + oldLayerName + "' to '" + newLayerName + "'", se);
    }

    return false;
  }
Пример #5
0
  public void put(TileObject stObj) throws StorageException {
    stObj.setLayerId(idCache.getLayerId(stObj.getLayerName()));
    stObj.setFormatId(idCache.getFormatId(stObj.getBlobFormat()));
    stObj.setGridSetIdId(idCache.getGridSetsId(stObj.getGridSetId()));
    stObj.setParamtersId(idCache.getParametersId(stObj.getParameters()));

    try {
      wrpr.deleteTile(stObj);
    } catch (SQLException se) {
      log.error("Failed to delete tile: " + se.getMessage());
    }

    try {
      wrpr.putTile(stObj);
    } catch (SQLException se) {
      log.error("Failed to put tile: " + se.getMessage());
    }
  }
Пример #6
0
  public boolean expire(TileRange trObj) throws StorageException {
    long layerId = idCache.getLayerId(trObj.getLayerName());
    long formatId = idCache.getFormatId(trObj.getMimeType().getFormat());
    long parametersId = idCache.getParametersId(trObj.getParameters());
    if (-1L != parametersId) {
      trObj.setParametersId(parametersId);
    }
    long gridSetIdId = idCache.getGridSetsId(trObj.getGridSetId());

    for (int zoomLevel = trObj.getZoomStart(); zoomLevel <= trObj.getZoomStop(); zoomLevel++) {
      try {
        wrpr.expireRange(trObj, zoomLevel, layerId, formatId, parametersId, gridSetIdId);

      } catch (SQLException se) {
        log.error(se.getMessage());
      }
    }

    return true;
  }
Пример #7
0
  public boolean delete(String layerName) throws StorageException {
    long layerId = idCache.getLayerId(layerName);
    try {
      wrpr.deleteLayer(layerId);
      return true;
    } catch (SQLException se) {
      log.error("Failed to delete layer '" + layerName + "'", se);
    }

    return false;
  }
Пример #8
0
  public boolean delete(BlobStore blobStore, TileRange trObj) throws StorageException {
    long layerId = idCache.getLayerId(trObj.getLayerName());
    long formatId = idCache.getFormatId(trObj.getMimeType().getFormat());
    // FRD Set the parameters ID
    long parametersId = -1;
    if (trObj.getParametersId() != null) {
      parametersId = trObj.getParametersId();
    } else if (trObj.getParameters() != null) {
      parametersId = idCache.getParametersId(trObj.getParameters());
      if (-1L != parametersId) {
        trObj.setParametersId(parametersId);
      }
    }
    long gridSetIdId = idCache.getGridSetsId(trObj.getGridSetId());

    for (int zoomLevel = trObj.getZoomStart(); zoomLevel <= trObj.getZoomStop(); zoomLevel++) {
      wrpr.deleteRange(blobStore, trObj, zoomLevel, layerId, formatId, parametersId, gridSetIdId);
    }

    return true;
  }