/** * Get summary info about Styles in a workspace. * * @return summary info about Styles as a {@link RESTStyleList} * @since GeoServer 2.2 */ public RESTStyleList getStyles(String workspace) { String url = "/rest/workspaces/"+workspace+"/styles.xml"; if (LOGGER.isDebugEnabled()) { LOGGER.debug("### Retrieving Styles list from " + url); } String response = HTTPUtils.get(gsBaseUrl + url, gsuser, gspass); return RESTStyleList.build(response); }
public RESTStyleList getStyles() { RESTStyleList styleList = null; final Element stylesRoot = layerElem.getChild("styles"); if (stylesRoot != null) { styleList = new RESTStyleList(stylesRoot); } return styleList; }
/** * Parses the style in workspace. * * @param reader the reader * @param styleMap the style map * @param count the count * @param workspaceName the workspace name * @return the int */ private int parseStyleInWorkspace( GeoServerRESTReader reader, Map<String, List<StyleWrapper>> styleMap, int count, String workspaceName) { List<StyleWrapper> styleList; if (workspaceName != null) { RESTStyleList geoServerWorkspaceStyleList = reader.getStyles(workspaceName); styleList = new ArrayList<>(); for (String style : geoServerWorkspaceStyleList.getNames()) { StyleWrapper newStyleWrapper = new StyleWrapper(workspaceName, style); styleList.add(newStyleWrapper); if (parentObj != null) { parentObj.readStylesProgress(connection, count, count); } count++; } styleMap.put(workspaceName, styleList); } return count; }
assertEquals(SECOND_STYLE, layer.getStyles().get(0).getName()); RESTStyle style = restManager.getReader().getStyle(STYLE); assertEquals(STYLE + ".sld", style.getFileName());
/** * Parses the style in default workspace. * * @param reader the reader * @param count the count * @param styleList the style list * @return the int */ private int parseStyleInDefaultWorkspace( GeoServerRESTReader reader, int count, List<StyleWrapper> styleList) { // Read styles not in a workspace RESTStyleList geoServerStyleList = reader.getStyles(); for (String style : geoServerStyleList.getNames()) { StyleWrapper newStyleWrapper = new StyleWrapper(DEFAULT_WORKSPACE_NAME, style); styleList.add(newStyleWrapper); if (parentObj != null) { parentObj.readStylesProgress(connection, count, count); } count++; } return count; }
@CliCommand(value = "style list", help = "List style.") public String list( @CliOption(key = "workspace", mandatory = false, help = "The workspace") String workspace ) throws Exception { GeoServerRESTReader reader = new GeoServerRESTReader(geoserver.getUrl(), geoserver.getUser(), geoserver.getPassword()); RESTStyleList styleList = workspace != null ? this.getStyles(workspace) : reader.getStyles(); List<String> names = styleList.getNames(); Collections.sort(names); StringBuilder builder = new StringBuilder(); for (String name : names) { builder.append(name + OsUtils.LINE_SEPARATOR); } return builder.toString(); }
/** * Get summary info about all Styles. * * @return summary info about Styles as a {@link RESTStyleList} */ public RESTStyleList getStyles() { String url = "/rest/styles.xml"; if (LOGGER.isDebugEnabled()) { LOGGER.debug("### Retrieving Styles list from " + url); } String response = HTTPUtils.get(gsBaseUrl + url, gsuser, gspass); return RESTStyleList.build(response); }
public static RESTStyleList build(String response) { Element elem = JDOMBuilder.buildElement(response); return elem == null? null : new RESTStyleList(elem); }
List<String> names = styles.getNames(); Iterator<String> iterator = names.iterator();
private RESTStyleList getStyles(String workspace) throws Exception { String url = "/rest/workspaces/" + URLUtil.encode(workspace) + "/styles.xml"; return RESTStyleList.build(HTTPUtils.get(geoserver.getUrl() + url, geoserver.getUser(), geoserver.getPassword())); }