Package org.geoserver.platform.resource

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


     * Master password provider root
     * @deprecated Use {@link #masterPasswordProvider()}
     */
    public File getMasterPasswordProviderRoot() throws IOException {
        Resource resource = get("security/masterpw");
        return resource.dir();
    }

    /**
     * Lists all available role service configurations.
     */
 
View Full Code Here


           
            if( wcs.getType() != Type.DIRECTORY ){
                return; // nothing to cleanup
            }
           
            File wcsTemp = wcs.dir();
            // ok, now scan for existing files there and clean up those that are too old
            long now = System.currentTimeMillis();
            for(File f : wcsTemp.listFiles()) {
                if(now - f.lastModified() > (expirationDelay * 1000)){
                    f.delete();
View Full Code Here

        // write the coverage to temporary storage in the data dir
        File wcsStore = null;
        try {
            GeoServerResourceLoader loader = geoServer.getCatalog().getResourceLoader();
            Resource wcs = loader.get("temp/wcs");
            wcsStore = wcs.dir();
//            File temp = GeoserverDataDirectory.findCreateConfigDir("temp");
//            wcsStore = new File(temp, "wcs");
//            if(!wcsStore.exists())
//                wcsStore.mkdir();
        } catch(Exception e) {
View Full Code Here

    @Theory
    public void theoryHaveDir(String path) throws Exception {
        Resource res = getResource(path);
        assumeThat(res, directory());
       
        File result = res.dir();
       
        assertThat(result, notNullValue());
    }
   
    @Theory
View Full Code Here

    public void theoryDirectoriesHaveFileWithSameNamedChildren(String path) throws Exception {
        Resource res = getResource(path);
       
        assumeThat(res, is(directory()));
       
        File dir = res.dir();
       
        Collection<Resource> resChildren = res.list();
        String[] fileChildrenNames = dir.list();
       
        String[] resChildrenNames = new String[resChildren.size()];
View Full Code Here

    public void theoryAddingFileToDirectoryAddsResource(String path) throws Exception {
        Resource res = getResource(path);
       
        assumeThat(res, is(directory()));
       
        File dir = res.dir();
       
        File file = new File(dir, "newFileCreatedDirectly");
       
        assumeTrue(file.createNewFile());
       
View Full Code Here

    public static File handleBinUpload(String datasetName, String extension,
            Request request) throws IOException, ConfigurationException {
        GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class);
        Resource data = loader.get("data");
       
        final File dir = data.dir(); // find or create
        return handleBinUpload( datasetName + "." + extension, null, dir, request );
    }

    /**
     * Reads content from the body of a request and writes it to a file in the given directory.
View Full Code Here

    public static File handleURLUpload(String datasetName, String workSpace, String extension, Request request) throws IOException, ConfigurationException {
        // Get the dir where to write and create a file there
       
        GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class);
        Resource data = loader.get("data");
        final File dir = data.dir(); // find or create
        return handleURLUpload(datasetName + "." + extension, workSpace, dir, request);
    }
   
    /**
     * Reads a url from the body of a request, reads the contents of the url and writes it to a file.
View Full Code Here

     */
    public static File unpackZippedDataset(String storeName, File zipFile) throws IOException, ConfigurationException {
        GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class);
        String outputPath = Paths.path("data",Paths.convert(storeName));
        Resource directory = loader.get(outputPath);
        File outputDirectory = directory.dir(); // find or create
        unzipFile(zipFile, outputDirectory, null, null, null, null, false);
        return outputDirectory;
    }

    /**
 
View Full Code Here

     * @param location The components of the path that make up the location of the directory to
     *  find or create.
     */
    public File findOrCreateDirectory( String... location ) throws IOException {
        Resource directory = get( Paths.path(location) );       
        return directory.dir(); // will create directory as needed
    }
   
    /**
     * Performs a directory lookup, creating the file if it does not exist.
     *
 
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.