Package org.geoserver.platform.resource

Examples of org.geoserver.platform.resource.Resource.file()


            }
        }
       
        // Write to file
        {
            OutputStream ostream = new FileOutputStream(res.file());
            try {
                ostream.write(testFile);
            } finally {
                ostream.close();
            }
View Full Code Here


    }
   
    public MonitorRequestFilter(GeoServerResourceLoader loader) throws IOException {
        Resource configFile = loader.get( Paths.path("monitoring", "filter.properties") );
        if (configFile.getType() == Type.UNDEFINED) {
            loader.copyFromClassPath("filter.properties", configFile.file(), getClass());
        }
        watcher = new FilterPropertyFileWatcher(configFile);
    }
   
    public boolean filter(HttpServletRequest req) throws IOException {
View Full Code Here

        File sampleFile = getSampleFile("Bridges");
       
        long lastTime = sampleFile.lastModified();
        long lastLength = sampleFile.length();
        long previousTime = sldResource.lastmodified();
        sldResource.file().setLastModified(lastTime + 1000);
       
        // force cleaning of samples cache, to get updates on files
        ((LegendSampleImpl)GeoServerExtensions.bean(LegendSample.class)).reloaded();
       
        TransformerBase tr = createTransformer();
View Full Code Here

        assertTrue(legendURL.hasAttribute("width"));
        assertEquals("20", legendURL.getAttribute("width"));
        assertTrue(legendURL.hasAttribute("height"));
        assertEquals("20", legendURL.getAttribute("height"));
        assertFalse(getSampleFile("Bridges").length() == lastLength);
        sldResource.file().setLastModified(previousTime);
    }
   
    /**
     * Tests that already cached icons are recreated if related
     * SLD is newer (using Catalog events).
View Full Code Here

        File sampleFile = getSampleFile("Bridges");
       
        long lastTime = sampleFile.lastModified();
        long lastLength = sampleFile.length();
        long previousTime = sldResource.lastmodified();
        sldResource.file().setLastModified(lastTime + 1000);
       
        catalog.firePostModified(catalog.getStyleByName("Bridges"));
       
        TransformerBase tr = createTransformer();
        tr.setIndentation(2);
View Full Code Here

        assertTrue(legendURL.hasAttribute("width"));
        assertEquals("20", legendURL.getAttribute("width"));
        assertTrue(legendURL.hasAttribute("height"));
        assertEquals("20", legendURL.getAttribute("height"));
        assertFalse(getSampleFile("Bridges").length() == lastLength);
        sldResource.file().setLastModified(previousTime);
    }
   
    /**
     * Tests that already cached icons are read from disk and
     * used to calculate size.
View Full Code Here

            GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class);
            Resource configFile = loader.get( "proxy/proxy.xml" );
           
            XStream xs = new XStream();
            String xml = xs.toXML(pc);
            FileWriter fw = new FileWriter(configFile.file(), false); // false means overwrite old file
            //Take the write lock on the file & lock it
            lock = configFile.lock();
            fw.write(xml);
            fw.close();
            return true;
View Full Code Here

     * @param resource The resource to copy.
     * @param location The destination to copy to.
     */
    public void copyFromClassPath( String classpathResource, String location ) throws IOException {
        Resource resource = get(Paths.convert(location));
        copyFromClassPath( classpathResource, resource.file() );
    }
   
    /**
     * Copies a resource from the classpath to a specified file.
     *
 
View Full Code Here

                if (layouts.getType() == Type.DIRECTORY ) {
                    Resource layoutConfig = layouts.get(layoutName+".xml");
                    //File layoutConfig = new File(layoutDir, layoutName + ".xml");

                    if( layoutConfig.getType() == Type.RESOURCE ){
                        File layoutConfigFile = layoutConfig.file();
                        layout = MapDecorationLayout.fromFile(layoutConfigFile, tiled);
                    } else {
                        LOGGER.log(Level.WARNING, "Unknown layout requested: " + layoutName);
                    }
                } else {
View Full Code Here

     */
    public List validateGETMAP(InputStream xml) {
        GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class);
       
        Resource schema = loader.get("data/capabilities/sld/GetMap.xsd");
        File schemaFile = schema.file();
        try {
            return validateGETMAP(xml, DataUtilities.fileToURL(schemaFile));
        } catch (Exception e) {
            ArrayList al = new ArrayList();
            al.add(new SAXException(e));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.