Package org.geoserver.importer

Examples of org.geoserver.importer.Directory


        if (!uploadDir.exists()) {
            throw new RuntimeException("Unable to create directory for file upload");
        }

        // pass off the uploaded file to the importer
        Directory dir = new Directory(uploadDir);
        dir.accept(files.next());

        return doImport(dir, ws);
    }
View Full Code Here


            throw new RestletException("File upload failed", Status.SERVER_ERROR_INTERNAL, ioe);
        }
    }
   
    private ImportData handleFileUpload(ImportContext context) {
        Directory directory = findOrCreateDirectory(context);

        try {
            directory.accept(getAttribute("task"),getRequest().getEntity().getStream());
        } catch (IOException e) {
            throw new RestletException("Error unpacking file",
                Status.SERVER_ERROR_INTERNAL, e);
        }
       
View Full Code Here

        } catch (FileUploadException e) {
            throw new RestletException("File upload failed", Status.SERVER_ERROR_INTERNAL, e);
        }

        //look for a directory to hold the files
        Directory directory = findOrCreateDirectory(context);

        //unpack all the files
        for (FileItem item : items) {
            if (item.getName() == null) {
                continue;
            }
            try {
                directory.accept(item);
            } catch (Exception ex) {
                throw new RestletException("Error writing file " + item.getName(), Status.SERVER_ERROR_INTERNAL, ex);
            }
        }
        return directory;
View Full Code Here

        DataStoreInfo ds = cat.getFactory().createDataStore();
        ds.setName("data");

        File dir = unpack("shape/archsites_epsg_prj.zip");
        ImportContext context = importer.createContext(new Directory(dir), ws, ds);

        SerialVersionSafeSerialBinding binding = new SerialVersionSafeSerialBinding();

        DatabaseEntry e = new DatabaseEntry();
        binding.objectToEntry(context, e);
View Full Code Here

    }

    @Test
    public void testAdd() throws Exception {
        File dir = unpack("shape/archsites_epsg_prj.zip");
        ImportContext context = importer.createContext(new Directory(dir));

        assertEquals(1,context.getTasks().size());
        for (int i = 0; i < context.getTasks().size(); i++) {
            assertNotNull(context.getTasks().get(i).getStore());
            assertNotNull(context.getTasks().get(i).getStore().getCatalog());
View Full Code Here

public class XStreamInfoSerialBindingTest extends ImporterTestSupport {

    @Test
    public void testSerializeWithNewStore() throws Exception {
        File dir = unpack("shape/archsites_epsg_prj.zip");
        ImportContext context = importer.createContext(new Directory(dir));

        XStreamPersister xp = importer.createXStreamPersisterXML();
        XStreamInfoSerialBinding<ImportContext> binding =
                new XStreamInfoSerialBinding<ImportContext>(xp, ImportContext.class);
        binding.setCompress(false);
View Full Code Here

        File dir = tmpDir();
        unpack("shape/archsites_epsg_prj.zip", dir);
        unpack("shape/bugsites_esri_prj.tar.gz", dir);

        ds = cat.getDataStore(ds.getId());
        ImportContext context = importer.createContext(new Directory(dir), ds);
        assertEquals(2, context.getTasks().size());

        XStreamPersister xp = new XStreamPersisterFactory().createXMLPersister();
        xp.getXStream().omitField(ImportTask.class, "context");
View Full Code Here

        return directory(json);
    }

    Directory directory(JSONObject json) throws IOException {
        if (json.has("location")) {
            return new Directory(new File(json.getString("location")));
        }
        else {
            return Directory.createNew(importer.getUploadRoot());
        }
    }
View Full Code Here

    @Before
    public void prepareData() throws Exception {
        // prepare the contexts used in thsi test
        File dir = unpack("shape/archsites_epsg_prj.zip");
        unpack("shape/bugsites_esri_prj.tar.gz", dir);
        importer.createContext(new Directory(dir));
       
        dir = unpack("geotiff/EmissiveCampania.tif.bz2");
        importer.createContext(new Directory(dir));
       
        dir = unpack("shape/archsites_no_crs.zip");
        importer.createContext(new SpatialFile(new File(dir, "archsites.shp")));
    }
View Full Code Here

    private ByteArrayOutputStream buf;

    @Before
    public void prepareData() throws Exception {
        File dir = unpack("shape/archsites_epsg_prj.zip");
        importer.createContext(new Directory(dir));
       
        PageInfo info = new PageInfo();
        info.setBasePath("basePath");
        info.setBaseURL("baseURL");
        info.setPagePath("pagePath");
View Full Code Here

TOP

Related Classes of org.geoserver.importer.Directory

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.