Package org.geoserver.catalog

Examples of org.geoserver.catalog.StyleHandler


            ResourceLocator locator = new ResourceLocator(){
                public URL locateResource(String spec) {
                    return null;
                }
            };           
            StyleHandler handler = Styles.handler(s.getFormat());
            StyledLayerDescriptor sld = handler.parse(r, s.getFormatVersion(), locator, null);
           
            final Style style = Styles.style(sld); // extract 1st style
            return Styles.sld(style);              // encode in generated SLD
        }
    }
View Full Code Here


            if (catalog.getStyleByName(workspace, name) != null) {
                throw new RestletException("Style " + name + " already exists.", Status.CLIENT_ERROR_FORBIDDEN);
            }

            // style format/handler
            StyleHandler styleFormat = ((StyleFormat) getFormatPostOrPut()).getHandler();

            StyleInfo sinfo = catalog.getFactory().createStyle();
            sinfo.setName(name);
            sinfo.setFilename(name + "." + styleFormat.getFileExtension());
            sinfo.setFormat(styleFormat.getFormat());
            sinfo.setFormatVersion(styleFormat.versionForMimeType(getRequest().getEntity().getMediaType().getName()));

            if (workspace != null) {
                sinfo.setWorkspace(catalog.getWorkspaceByName(workspace));
            }
View Full Code Here

    protected void onStyleFormSubmit() {
        // add the style
        Catalog catalog = getCatalog();
        StyleInfo s = (StyleInfo) styleForm.getModelObject();

        StyleHandler styleHandler = styleHandler();

        // write out the SLD before creating the style
        try {
            if (s.getFilename() == null) {
                // TODO: check that this does not overriDe any existing files
                s.setFilename(s.getName() + "."+styleHandler.getFileExtension());
            }
            catalog.getResourcePool().writeStyle(s,
                    new ByteArrayInputStream(rawStyle.getBytes()));
        } catch (IOException e) {
            throw new WicketRuntimeException(e);
        }
       
        // store in the catalog
        try {
            Version version = styleHandler.version(rawStyle);
            s.setSLDVersion(version);
            getCatalog().add(s);
        } catch (Exception e) {
            LOGGER.log(Level.SEVERE, "Error occurred saving the style", e);
            error(e);
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.StyleHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.