Examples of GeoServerResourceLoader


Examples of org.geoserver.platform.GeoServerResourceLoader

        workspace = options.workspace();
        namespace = catalog.getNamespaceByPrefix(workspace.getName());

        // temp directory to unpack
        root = Files.createTempDirectory(null);
        importDataDir = new GeoServerDataDirectory(new GeoServerResourceLoader(root.toFile()));
        targetDataDir = new GeoServerDataDirectory(catalog.getResourceLoader());

        // config deserializer
        xsp = new XStreamPersisterFactory().createXMLPersister();
        xsp.setExcludeIds();
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

    GeoServerResourceLoader resourceLoader;
    GeoServerInfo info;

    @Before
    public void setUp() throws Exception {
        resourceLoader = new GeoServerResourceLoader(Files.createTempDir());
        info = new GeoServerInfo(resourceLoader);
    }
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

        FileUtils.deleteDirectory(dataDir);
    }

    protected Catalog createCatalog() throws IOException {
        Path dataDir = Files.createTempDirectory(Paths.get("target"), "data");
        GeoServerResourceLoader resourceLoader = new GeoServerResourceLoader(dataDir.toFile());

        Catalog cat = new CatalogImpl();
        cat.setResourceLoader(resourceLoader);
        cat.addListener(new GeoServerPersister(resourceLoader, new XStreamPersisterFactory().createXMLPersister()));
        return cat;
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

            .layer("one")
              .style().ysld("one.yaml")
        .geoServer().build(geoServer);

      // Test directory placeholder
      GeoServerResourceLoader rl = this.geoServer.getCatalog().getResourceLoader();
      Resource d = rl.get("workspaces/foo/styles");
      assertEquals( d.getType(), Type.DIRECTORY );
      assertEquals( 3, d.list().size() );
     
      MvcResult result = mvc.perform(get("/api/icons/foo"))
              .andExpect(status().isOk())
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

        throws IOException, FileUploadException {

        WorkspaceInfo ws = findWorkspace(wsName, catalog());
       
        // Resource resource = dataDir().get(ws).get("icons"); // GEOS-6690
        GeoServerResourceLoader rl = geoServer.getCatalog().getResourceLoader();       
        Resource styles = rl.get(Paths.path("workspaces",ws.getName(),"styles"));

        ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory());
        @SuppressWarnings("unchecked")
        List<FileItem> input = (List<FileItem>) upload.parseRequest(request);
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

    public @ResponseBody byte[] raw(@PathVariable String wsName, @PathVariable String icon,
                                   HttpServletResponse response) throws IOException {

        WorkspaceInfo ws = findWorkspace(wsName, catalog());

        GeoServerResourceLoader rl = geoServer.getCatalog().getResourceLoader();
        Resource resource = rl.get(Paths.path("workspaces",ws.getName(),"styles",icon));

        if( resource.getType() != Type.RESOURCE ){
            throw new NotFoundException("Icon "+icon+" not found");
        }
        String ext = fileExt(icon);
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

    @RequestMapping(value = "/{wsName}/{icon:.+}", method = RequestMethod.DELETE)
    public boolean delete(@PathVariable String wsName, @PathVariable String icon) throws IOException {

        WorkspaceInfo ws = findWorkspace(wsName, catalog());

        GeoServerResourceLoader rl = geoServer.getCatalog().getResourceLoader();
        Resource resource = rl.get(Paths.path("workspaces",ws.getName(),"styles",icon));
        if( resource.getType() != Type.RESOURCE ){
            throw new NotFoundException("Icon "+icon+" not found");
        }
        String ext = fileExt(icon);
        if( !ICON_FORMATS.containsKey(ext)){
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

        // if the style is already stored in ySLD format just pull it directly, otherwise encode the style
        if (YsldHandler.FORMAT.equalsIgnoreCase(s.getFormat())) {
            return dataDir().style(s);
        }
        else {           
            GeoServerResourceLoader rl = cat.getResourceLoader();
            String path;
            if( s.getWorkspace() == null ){
                path = Paths.path("styles",s.getFilename());
            }
            else {
                path = Paths.path("workspaces",s.getWorkspace().getName(),"styles",s.getFilename());
            }
            final Resource r = rl.get(path);
           
            // Similar to s.getStyle() and GeoServerDataDirectory.parsedStyle(s)
            // But avoid resolving external graphics to absolute file references
            if ( r == null || r.getType() == Type.UNDEFINED ){
                throw new IOException( "No such resource: " + s.getFilename());
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

    private String source(StoreInfo store) {
        if( store instanceof CoverageStoreInfo ){
            CoverageStoreInfo coverage = (CoverageStoreInfo) store;
            return sourceURL( coverage.getURL() );
        }
        GeoServerResourceLoader resourceLoader = geoServer.getCatalog().getResourceLoader();
        Map<String, Serializable> params =
                ResourcePool.getParams( store.getConnectionParameters(), resourceLoader );
        if( params.containsKey("dbtype")){
            // See JDBCDataStoreFactory for details
            String host = Converters.convert(params.get("host"),  String.class);
View Full Code Here

Examples of org.geoserver.platform.GeoServerResourceLoader

    static Python python;
   
    @BeforeClass
    public static void oneTimeSetUp() throws Exception {
        python = new Python(new GeoServerResourceLoader(new File("target")));
       
        File f = new File( python.getLibRoot(), "bar.py");
        FileWriter w = new FileWriter(f);
        w.write("class Bar:\n  pass\n\n");
        w.close();
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.