Package org.geoserver.importer

Examples of org.geoserver.importer.FileData


        List<FileData> files = m.getFiles();
        assertEquals(4,files.size());

        for (int i = 0; i < files.size(); i++) {
            FileData fd = files.get(i);
            assertTrue(fd instanceof Granule);

            Granule g = (Granule) fd;

            //TODO: comparison fails on build server
View Full Code Here


        @Override
        protected ResourceReference load() {
            DataIcon icon = null;
            if (data instanceof FileData) {
                FileData df = (FileData) data;
                if (data instanceof Directory) {
                    icon = DataIcon.FOLDER;
                }
                else {
                    icon = df.getFormat() instanceof VectorFormat ? DataIcon.FILE_VECTOR :
                           df.getFormat() instanceof RasterFormat ? DataIcon.FILE_RASTER : DataIcon.FILE;
                }
            }
            else if (data instanceof Database) {
                icon = DataIcon.DATABASE;
            }
View Full Code Here

        }
        // @todo handling remote URL implies asynchronous processing at this stage
        if (location == null || !location.getProtocol().equalsIgnoreCase("file")) {
            throw new RestletException("Invalid url in request", Status.CLIENT_ERROR_BAD_REQUEST);
        }
        FileData file;
        try {
            file = FileData.createFromFile(new File(location.toURI().getPath()));
        } catch (Exception ex) {
            throw new RuntimeException("Unexpected exception", ex);
        }

        if (file instanceof Directory) {
            try {
                file.prepare();
            } catch (IOException ioe) {
                String msg = "Error processing file: " + file.getFile().getAbsolutePath();
                getLogger().log(Level.WARNING, msg, ioe);
                throw new RestletException(msg, Status.SERVER_ERROR_INTERNAL);
            }
        }
View Full Code Here

        return file.canRead() && "kml".equalsIgnoreCase(FilenameUtils.getExtension(file.getName()));
    }

    private File getFileFromData(ImportData data) {
        assert data instanceof FileData;
        FileData fileData = (FileData) data;
        File file = fileData.getFile();
        return file;
    }
View Full Code Here

            return FileData.createFromFile(new File(file));
            //return new FileData(new File(file));
        }
        else {
            //TODO: create a temp file
            return new FileData((File)null);
        }
    }
View Full Code Here

    @Override
    public void handlePut() {
        //TODO: this only handles granule timestamps at the moment, expand to handle more
        JSONObject obj = (JSONObject) getFormatPostOrPut().toObject(getRequest().getEntity());
        FileData file = lookupFile();
        if (file instanceof SpatialFile) {
            SpatialFile sf = (SpatialFile) file;
            if (sf instanceof Granule) {
                Granule g = (Granule) sf;
                if (obj.has("timestamp")) {
View Full Code Here

        return allowPut();
    }

    public void handleDelete() {
        Directory dir = lookupDirectory();
        FileData file = lookupFile();

        if (dir.getFiles().remove(file)) {
            getResponse().setStatus(Status.SUCCESS_NO_CONTENT);
        }
        else {
            throw new RestletException("Unable to remove file: " + file.getName(),
                Status.CLIENT_ERROR_BAD_REQUEST);
        }

    };
View Full Code Here

TOP

Related Classes of org.geoserver.importer.FileData

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.