示例#1
0
 @Override
 public void handleRemoveEvent(CatalogRemoveEvent event) throws CatalogException {
   if (event.getSource() instanceof StyleInfo) {
     // invalidate removed styles (is this needed?)
     invalidateStyleSample((StyleInfo) event.getSource());
   }
 }
  /**
   * @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));
    }
  }