/**
  * LayerInfo has been created, add a matching {@link GeoServerTileLayer}
  *
  * @see CatalogLayerEventListener#handleAddEvent
  * @see GWC#add(GeoServerTileLayer)
  */
 void createTileLayer(final LayerInfo layerInfo) {
   GWCConfig defaults = mediator.getConfig();
   if (defaults.isSane() && defaults.isCacheLayersByDefault()) {
     GridSetBroker gridSetBroker = mediator.getGridSetBroker();
     GeoServerTileLayer tileLayer = new GeoServerTileLayer(layerInfo, defaults, gridSetBroker);
     mediator.add(tileLayer);
   }
 }
 /**
  * If either a {@link LayerInfo} or {@link LayerGroupInfo} has been added to the {@link Catalog} ,
  * create a corresponding GWC TileLayer depending on the value of {@link
  * GWCConfig#isCacheLayersByDefault()}.
  *
  * @see org.geoserver.catalog.event.CatalogListener#handleAddEvent
  * @see GWC#createLayer(LayerInfo)
  * @see GWC#createLayer(LayerGroupInfo)
  */
 public void handleAddEvent(CatalogAddEvent event) throws CatalogException {
   GWCConfig config = mediator.getConfig();
   boolean sane = config.isSane();
   boolean cacheLayersByDefault = config.isCacheLayersByDefault();
   if (!cacheLayersByDefault) {
     return;
   }
   if (!sane) {
     log.info(
         "Ignoring auto-creation of tile layer for "
             + event.getSource()
             + ": global gwc settings are not sane");
   }
   Object obj = event.getSource();
   // We only handle layers here. Layer groups are initially empty
   if (obj instanceof LayerInfo) {
     log.finer("Handling add event: " + obj);
     LayerInfo layerInfo = (LayerInfo) obj;
     createTileLayer(layerInfo);
   } else if (obj instanceof LayerGroupInfo) {
     LayerGroupInfo lgi = (LayerGroupInfo) obj;
     createTileLayer(lgi);
   }
 }
 /**
  * LayerGroupInfo has been created, add a matching {@link GeoServerTileLayer}
  *
  * @see CatalogLayerEventListener#handleAddEvent
  * @see GWC#add(GeoServerTileLayer)
  */
 public void createTileLayer(LayerGroupInfo lgi) {
   GWCConfig defaults = mediator.getConfig();
   GridSetBroker gridSetBroker = mediator.getGridSetBroker();
   GeoServerTileLayer tileLayer = new GeoServerTileLayer(lgi, defaults, gridSetBroker);
   mediator.add(tileLayer);
 }