Package org.geoserver.config

Examples of org.geoserver.config.GeoServerDataDirectory


        //create a class template loader to delegate to
        if (caller != null) {
            classTemplateLoader = new ClassTemplateLoader(caller, "");
        }
       
        dd = new GeoServerDataDirectory(rl);
    }
View Full Code Here


    /**
     * Retrieves the GeoServer data directory
     * @return
     */
    private String getDataDirectory() {
        GeoServerDataDirectory dd = getGeoServerApplication().getBeanOfType(GeoServerDataDirectory.class);
        return dd.root().getAbsolutePath();
    }
View Full Code Here

     * @param rl The geoserver resource loader
     *
     * @throws IOException
     */
    public GeoServerTemplateLoader(Class caller, GeoServerResourceLoader rl) throws IOException {
        this(caller, new GeoServerDataDirectory(rl));
    }
View Full Code Here

            LOGGER.log(Level.WARNING, "Failed to put legend layout file in the data directory, the legend decoration will not appear", e);
        }
    }

    private void ensureLegendDecoration() throws IOException {
        GeoServerDataDirectory dd = GeoServerApplication.get().getBeanOfType(GeoServerDataDirectory.class);
        File layouts = dd.findOrCreateDir("layouts");
        File legend = new File(layouts, "css-legend.xml");
        if(!legend.exists()) {
            String legendLayout = IOUtils.toString(OpenLayersMapPanel.class.getResourceAsStream("css-legend.xml"));
            FileUtils.writeStringToFile(legend, legendLayout);
        }
View Full Code Here

        }
    }
    public File findStyleFile(StyleInfo style) {
        try {
            GeoServerDataDirectory datadir =
                new GeoServerDataDirectory(getCatalog().getResourceLoader());
            return datadir.findStyleSldFile(style);
        } catch (IOException ioe) {
            throw new WicketRuntimeException(ioe);
        }
    }
View Full Code Here

    public LayerInfo getLayer() { return this.layer; }
   
    public String cssText2sldText(String css, StyleInfo styleInfo) {
        try {
            GeoServerDataDirectory datadir =
                new GeoServerDataDirectory(getCatalog().getResourceLoader());
            File styleDir;
            if(styleInfo == null || styleInfo.getWorkspace() == null) {
                styleDir= datadir.findStyleDir();
            } else {
                File ws = datadir.findOrCreateWorkspaceDir(styleInfo.getWorkspace());
                styleDir = new File(ws, "styles");
                if(!styleDir.exists()) {
                    styleDir.mkdir();
                }
            }
View Full Code Here

                       File file = DataUtilities.urlToFile(target);
                       File styles = null;
                       File graphicFile = null;
                      
                       if (file.isAbsolute()) {
                           GeoServerDataDirectory dataDir = (GeoServerDataDirectory) GeoServerExtensions
                                   .bean("dataDirectory");
                           // we grab the canonical path to make sure we can compare them, no
                           // relative parts in them and so on
                           styles = dataDir.findOrCreateStyleDir().getCanonicalFile();
                           graphicFile = file.getCanonicalFile();
                           file = graphicFile;
                           if (file.getAbsolutePath().startsWith(styles.getAbsolutePath())) {
                               // ok, part of the styles directory, extract only the relative path
                               file = new File(file.getAbsolutePath().substring(
View Full Code Here

       
        return attributes;
    }
   
    void handleSchemaOverride( List<AttributeTypeInfo> atts, FeatureTypeInfo ft ) throws IOException {
        GeoServerDataDirectory dd = new GeoServerDataDirectory(catalog.getResourceLoader());
        File schemaFile = dd.findSuppResourceFile(ft, "schema.xsd");
        if (schemaFile == null) {
            schemaFile = dd.findSuppLegacyResourceFile(ft, "schema.xsd");
            if ( schemaFile == null ) {
                //check for the old style schema.xml
                File oldSchemaFile = dd.findSuppResourceFile(ft, "schema.xml");
                if ( oldSchemaFile == null ) {
                    oldSchemaFile = dd.findSuppLegacyResourceFile(ft, "schema.xml");
                }
                if ( oldSchemaFile != null ) {
                    schemaFile = new File( oldSchemaFile.getParentFile(), "schema.xsd");
                    BufferedWriter out =
                        new BufferedWriter(new OutputStreamWriter( new FileOutputStream( schemaFile ) ) );
View Full Code Here

            }
        }
    }

    GeoServerDataDirectory dataDir() {
        return new GeoServerDataDirectory(catalog.getResourceLoader());
    }
View Full Code Here

            if (workspace != null) {
                sinfo.setWorkspace(catalog.getWorkspaceByName(workspace));
            }

            // ensure that a existing resource does not already exist, because we may not want to overwrite it
            GeoServerDataDirectory dataDir = new GeoServerDataDirectory(catalog.getResourceLoader());
            if (dataDir.style(sinfo).getType() != Resource.Type.UNDEFINED) {
                String msg = "Style resource " + sinfo.getFilename() + " already exists.";
                throw new RestletException(msg, Status.CLIENT_ERROR_FORBIDDEN);
            }

            ResourcePool resourcePool = catalog.getResourcePool();
View Full Code Here

TOP

Related Classes of org.geoserver.config.GeoServerDataDirectory

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.