コード例 #1
0
  /**
   * @see
   *     org.geoserver.catalog.event.CatalogListener#handleModifyEvent(org.geoserver.catalog.event.CatalogModifyEvent)
   * @see #handlePostModifyEvent
   */
  public void handleModifyEvent(CatalogModifyEvent event) throws CatalogException {
    CatalogInfo source = event.getSource();
    if (source instanceof LayerInfo
        || source instanceof LayerGroupInfo
        || source instanceof FeatureTypeInfo
        || source instanceof CoverageInfo
        || source instanceof WMSLayerInfo) {
      PRE_MODIFY_EVENT.set(event);

      if (mediator.hasTileLayer(source)) {
        try {
          GeoServerTileLayer tileLayer = mediator.getTileLayer(source);
          GeoServerTileLayerInfo tileLayerInfo = tileLayer.getInfo();
          PRE_MODIFY_TILELAYER.set(tileLayerInfo);
        } catch (RuntimeException e) {
          log.info("Ignoring misconfigured tile layer info for " + source);
        }
      }
    }
  }
コード例 #2
0
  /**
   * @see
   *     org.geoserver.catalog.event.CatalogListener#handleRemoveEvent(org.geoserver.catalog.event.CatalogRemoveEvent)
   * @see GWC#removeTileLayers(List)
   */
  public void handleRemoveEvent(CatalogRemoveEvent event) throws CatalogException {
    CatalogInfo obj = event.getSource();
    if (!(obj instanceof LayerInfo || obj instanceof LayerGroupInfo)) {
      return;
    }
    if (!mediator.hasTileLayer(obj)) {
      return;
    }

    String prefixedName = null;

    if (obj instanceof LayerGroupInfo) {
      LayerGroupInfo lgInfo = (LayerGroupInfo) obj;
      prefixedName = tileLayerName(lgInfo);
    } else if (obj instanceof LayerInfo) {
      LayerInfo layerInfo = (LayerInfo) obj;
      prefixedName = tileLayerName(layerInfo);
    }

    if (null != prefixedName) {
      // notify the layer has been removed
      mediator.removeTileLayers(Arrays.asList(prefixedName));
    }
  }