public FeatureTypeInfo getFeatureTypeInfo(final Name name) { Catalog catalog = getCatalog(); FeatureTypeInfo resource = catalog.getResourceByName(name, FeatureTypeInfo.class); return resource; }
public WMSLayerInfo getWMSLayerInfo(final Name name) { Catalog catalog = getCatalog(); WMSLayerInfo resource = catalog.getResourceByName(name, WMSLayerInfo.class); return resource; }
public List<LayerGroupInfo> getLayerGroups() { Catalog catalog = getCatalog(); List<LayerGroupInfo> layerGroups = catalog.getLayerGroups(); return layerGroups; }
public ProcessStandaloneSLDVisitor(final WMS wms, final GetMapRequest request) { super(wms.getCatalog(), request.getCrs()); this.wms = wms; this.request = request; layers = new ArrayList<>(); styles = new ArrayList<>(); }
public ResourceInfo getResourceInfo(final Name name) { Catalog catalog = getCatalog(); ResourceInfo resource = catalog.getResourceByName(name, ResourceInfo.class); return resource; }
public List<LayerInfo> getLayers() { Catalog catalog = getCatalog(); return catalog.getLayers(); }
public CoverageInfo getCoverageInfo(final Name name) { Catalog catalog = getCatalog(); CoverageInfo resource = catalog.getResourceByName(name, CoverageInfo.class); return resource; }
public LayerInfo getLayerByName(String layerName) { return getCatalog().getLayerByName(layerName); }
public LayerGroupInfo getLayerGroupByName(String layerGroupName) { return getCatalog().getLayerGroupByName(layerGroupName); }
public String getNamespaceByPrefix(final String prefix) { Catalog catalog = getCatalog(); NamespaceInfo namespaceInfo = catalog.getNamespaceByPrefix(prefix); return namespaceInfo == null ? null : namespaceInfo.getURI(); }
public String getNameSpacePrefix(final String nsUri) { Catalog catalog = getCatalog(); NamespaceInfo ns = catalog.getNamespaceByURI(nsUri); return ns == null ? null : ns.getPrefix(); }
public Style getStyleByName(String styleName) throws IOException { StyleInfo styleInfo = getCatalog().getStyleByName(styleName); return styleInfo == null ? null : styleInfo.getStyle(); }
/** * Returns a list of name-ordered LayerGroupInfo, and filtered by namespace if needed * * @return LayerGroupInfo list */ private List<LayerGroupInfo> getOrderedLayerGroups() { Catalog catalog = wmsConfig.getCatalog(); // namespace filter Filter filter = Predicates.acceptAll(); addNameSpaceFilterIfNeed(filter, "workspace.name"); // order by name ASC SortBy order = asc("name"); // get list from iterator try (CloseableIterator<LayerGroupInfo> iter = catalog.list(LayerGroupInfo.class, filter, null, null, order)) { return Lists.newArrayList(iter); } }
/** * Returns a list of name-ordered LayerInfo, and filtered by namespace if needed * * @return LayerInfo list */ private List<LayerInfo> getOrderedLayers() { Catalog catalog = wmsConfig.getCatalog(); Filter filter = equal("enabled", Boolean.TRUE); // namespace filter addNameSpaceFilterIfNeed(filter, "resource.namespace.prefix"); // order by name ASC SortBy order = asc("name"); // get list: try (CloseableIterator<LayerInfo> iter = catalog.list(LayerInfo.class, filter, null, null, order)) { return Lists.newArrayList(iter); } }
if (layoutName != null && !layoutName.trim().isEmpty()) { try { GeoServerResourceLoader loader = wms.getCatalog().getResourceLoader(); Resource layouts = loader.get("layouts"); if (layouts.getType() == Type.DIRECTORY) {
try { URI uri = new URI(onlineResource); GeoServerResourceLoader resources = wms.getCatalog().getResourceLoader(); if (uri.isAbsolute()) { if (baseUrl != null && onlineResource.startsWith(baseUrl + "styles/")) {
/** * Parses the content of the given input stream to an SLD Style, provided that a valid SLD * document can be read from <code>xmlIn</code>. * * @param xmlIn where to read the SLD document from. * @return the parsed Style * @throws WmsException if a parsing error occurs */ private Style[] parseSld(Reader xmlIn) throws ServiceException { SLDParser parser = new SLDParser(styleFactory, xmlIn); EntityResolver entityResolver = wms.getCatalog().getResourcePool().getEntityResolver(); if (entityResolver != null) { parser.setEntityResolver(entityResolver); } Style[] styles = null; try { styles = parser.readXML(); } catch (RuntimeException e) { throw new ServiceException(e); } if ((styles == null) || (styles.length == 0)) { throw new ServiceException("Document contains no styles"); } return styles; } }
final Catalog catalog = wmsConfig.getCatalog();
private String getLayerName(LegendRequest legend) { if (legend.getLayer() != null) { return legend.getLayer(); } else if (legend.getLayerInfo() != null) { return legend.getLayerInfo().prefixedName(); } else if (legend.getFeatureType() != null) { Name name = legend.getFeatureType().getName(); NamespaceInfo ns = request.getWms().getCatalog().getNamespaceByURI(name.getNamespaceURI()); final String localName = name.getLocalPart(); if (ns != null) { return ns.getPrefix() + ":" + localName; } else { return localName; } } else { // should not really happen today, but who knows, may do in the future throw new ServiceException("Could not get the layer name out of " + legend); } }
protected void setLiveIconStyle(Style style, org.geotools.styling.Style sld, IconProperties properties, KmlEncodingContext context) { final Double opacity = properties.getOpacity(); final Double scale = properties.getScale(); final Double heading = properties.getHeading(); IconStyle is = style.createAndSetIconStyle(); if (opacity != null) { is.setColor(colorToHex(Color.WHITE, opacity)); } if (scale != null) { is.setScale(scale); } if (heading != null) { is.setHeading(heading); } // Get the name of the workspace WorkspaceInfo ws = context.getWms().getCatalog().getStyleByName(sld.getName()).getWorkspace(); String wsName = null; if(ws!=null) wsName = ws.getName(); Icon icon = is.createAndSetIcon(); icon.setHref(properties.href(context.getMapContent().getRequest().getBaseUrl(), wsName, sld.getName())); }