/** * Builds a layer for a coverage. * * <p>The resulting object is not added to the catalog, it must be done by the calling code * after the fact. */ public LayerInfo buildLayer(CoverageInfo coverage) throws IOException { LayerInfo layer = buildLayer((ResourceInfo) coverage); layer.setDefaultStyle(getDefaultStyle(coverage)); return layer; }
private StyleInfo getResourceDefaultStyle(ResourceInfo resource, StyleInfo removedStyle) { StyleInfo style = null; try { style = new CatalogBuilder(catalog).getDefaultStyle(resource); } catch (IOException e) { // we fall back on the default style (since we cannot roll back the // entire operation, no transactions in the catalog) LOGGER.log( Level.WARNING, "Could not find default style for resource " + resource + ", using Point style", e); } if (style == null || style.equals(removedStyle)) { return catalog.getStyleByName(StyleInfo.DEFAULT_POINT); } return style; }
/** * Builds a layer wrapping a WMS layer resource * * <p>The resulting object is not added to the catalog, it must be done by the calling code * after the fact. */ public LayerInfo buildLayer(WMSLayerInfo wms) throws IOException { LayerInfo layer = buildLayer((ResourceInfo) wms); layer.setDefaultStyle(getDefaultStyle(wms)); return layer; }
/** * Builds a layer for a feature type. * * <p>The resulting object is not added to the catalog, it must be done by the calling code * after the fact. */ public LayerInfo buildLayer(FeatureTypeInfo featureType) throws IOException { // also create a layer for the feautre type LayerInfo layer = buildLayer((ResourceInfo) featureType); StyleInfo style = getDefaultStyle(featureType); layer.setDefaultStyle(style); return layer; }
+ layer.prefixedName() + " is missing the default style, assigning one automatically"); StyleInfo style = new CatalogBuilder(this).getDefaultStyle(layer.getResource()); layer.setDefaultStyle(style); } catch (IOException e) {