Package org.geoserver.catalog

Examples of org.geoserver.catalog.CoverageStoreInfo


                if ( obj instanceof NamespaceInfo ) {
                    NamespaceInfo ns = (NamespaceInfo) obj;
                    encodeLink("/namespaces/" + encode(ns.getPrefix()), writer);
                }
                if ( obj instanceof CoverageStoreInfo ) {
                    CoverageStoreInfo cs = (CoverageStoreInfo) obj;
                    encodeLink("/workspaces/" + encode(cs.getWorkspace().getName()) +
                        "/coveragestores/" + encode(cs.getName()), writer );
                   
                }
            }
        });
    }
View Full Code Here


    protected List handleListGet() throws Exception {
        String ws = getAttribute("workspace");
        String cs = getAttribute("coveragestore");
       
        if ( cs != null ) {
            CoverageStoreInfo coverageStore = catalog.getCoverageStoreByName( cs );
            return catalog.getCoveragesByCoverageStore(coverageStore);   
        }
       
        NamespaceInfo ns = catalog.getNamespaceByPrefix( ws );
        return catalog.getCoveragesByNamespace( ns );
View Full Code Here

            throw new RestletException( "Invalid path, workspace, store and coverage name must be specified", Status.CLIENT_ERROR_NOT_FOUND );
        }
        if (catalog.getWorkspaceByName( ws ) == null ) {
            throw new RestletException( "No such workspace: " + ws, Status.CLIENT_ERROR_NOT_FOUND );
        }
        CoverageStoreInfo store = catalog.getCoverageStoreByName(ws, cs);
        if (store == null ) {
            throw new RestletException( "No such coveragestore: " + ws + "," + cs, Status.CLIENT_ERROR_NOT_FOUND );
        }
        CoverageInfo coverage = catalog.getCoverageByCoverageStore(store, c);
        if (coverage == null ) {
View Full Code Here

                + "</coverageStore>";
        MockHttpServletResponse responseBefore = putAsServletResponse(
                "/rest/workspaces/wcs/coveragestores/BlueMarble", xml, "text/xml");
        assertEquals(200, responseBefore.getStatusCode());
        // Selection of the coverage store
        CoverageStoreInfo cs = getCatalog().getCoverageStoreByName("wcs", "BlueMarble");
        // Setting of the store configuration
        MetadataMap map = cs.getMetadata();
        // Addition of the key associated to the root directory
        map.put(RESTUtils.ROOT_KEY, root);
        // Saving the store
        getCatalog().save(cs);
        // Test of the input file
View Full Code Here

        // Check if the coverage is present
        String content = response.getOutputStreamContent();
        Document d = dom(new ByteArrayInputStream(content.getBytes()));
        assertEquals("coverageStore", d.getDocumentElement().getNodeName());
        // Control if the coverage store is present
        CoverageStoreInfo cs = getCatalog().getCoverageStoreByName(workspace, coverageStore);
        assertNotNull(cs);
        // Control if the associated info are present
        CoverageInfo ci = getCatalog().getCoverageByName(workspace, "usa");
        assertNotNull(ci);
        // Check if the defined root is present       
        // Using DataUtilities.fileToURL in order to have the same URL encoding
        String urlString = cs.getURL();
        File urlFile = new File(urlString);
        URL url = DataUtilities.fileToURL(urlFile);
        File urlFileRoot = new File(DataUtilities.fileToURL(root).getPath());
        URL urlRoot = DataUtilities.fileToURL(urlFileRoot);
       
View Full Code Here

            //configure workspace if it doesn;t already exist
            if (catalog.getWorkspaceByName(prefix) == null) {
                addWorkspace(prefix, qName.getNamespaceURI(), catalog);
            }
            //create the store
            CoverageStoreInfo store = catalog.getCoverageStoreByName(prefix, name);
            if (store == null) {
                store = catalog.getFactory().createCoverageStore();
            }

            store.setName(name);
            store.setWorkspace(catalog.getWorkspaceByName(prefix));
            store.setEnabled(true);
            store.setURL(DataUtilities.fileToURL(file).toString());
            store.setType(format.getName());

            if (store.getId() == null) {
                catalog.add(store);
            }
            else {
                catalog.save(store);
            }
View Full Code Here

        testAddWorkspace();
       
        File dir = new File( testData.getDataDirectoryRoot(), "workspaces/acme/foostore");
        assertFalse( dir.exists() );
       
        CoverageStoreInfo cs = catalog.getFactory().createCoverageStore();
        cs.setName( "foostore" );
        cs.setWorkspace( catalog.getWorkspaceByName( "acme" ) );
        catalog.add( cs );
       
        assertTrue( dir.exists() );
        assertTrue( new File( dir, "coveragestore.xml").exists() );
    }
View Full Code Here

   
    @Test
    public void testModifyCoverageStore() throws Exception {
        testAddCoverageStore();
       
        CoverageStoreInfo cs = catalog.getCoverageStoreByName( "acme", "foostore" );
        assertNull( cs.getURL() );
       
        cs.setURL( "file:data/foo.tiff" );
        catalog.save( cs );
       
        File f =
            new File( testData.getDataDirectoryRoot(), "workspaces/acme/foostore/coveragestore.xml");
        Document dom = dom( f );
View Full Code Here

        testAddCoverageStore();
       
        File f = new File( testData.getDataDirectoryRoot(), "workspaces/acme/foostore");
        assertTrue( f.exists() );
       
        CoverageStoreInfo cs = catalog.getCoverageStoreByName( "acme", "foostore");
        catalog.remove( cs );
        assertFalse( f.exists() );
    }
View Full Code Here

        // and again without any hint
        r = (GridCoverage2DReader) ci.getGridCoverageReader(null, null);
        assertTrue(CRS.equalsIgnoreMetadata(CRS.decode("EPSG:3857"), r.getCoordinateReferenceSystem()));
       
        // get the reader straight: we should get back the native projection
        CoverageStoreInfo store = catalog.getCoverageStoreByName("usa");
        final ResourcePool rpool = catalog.getResourcePool();
        r = (GridCoverage2DReader) rpool.getGridCoverageReader(store, GeoTools.getDefaultHints());
        assertTrue(CRS.equalsIgnoreMetadata(CRS.decode("EPSG:4326"), r.getCoordinateReferenceSystem()));

   }
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.CoverageStoreInfo

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.