Package org.geoserver.catalog

Examples of org.geoserver.catalog.Catalog


        StringBuffer tempResponse = new StringBuffer();

        // ComplexType table = new ComplexType();
        if (requestedTypes.size() == 0) {
            // if there are no specific requested types then get all.
          Catalog catalog = wcsRequest.getWCS().getGeoServer().getCatalog();
          requestedTypes = new ArrayList();
          for (CoverageInfo ci : catalog.getCoverages()) {
        requestedTypes.add(ci.getName());
      }
        }

        tempResponse.append("<?xml version=\"1.0\" encoding=\"")
View Full Code Here


        String curCoverageName = new String();

        final int length = requestedTypes.size();
        CoverageInfo meta;

        Catalog catalog = gs.getGeoServer().getCatalog();
        for (int i = 0; i < length; i++) {
            curCoverageName = requestedTypes.get(i).toString();

      meta = catalog.getCoverageByName(curCoverageName);

            if (meta == null) {
                throw new WcsException(new StringBuffer("Coverage ").append(curCoverageName)
                                                                    .append(" does ")
                                                                    .append("not exist on this server")
View Full Code Here

            assertEquals( "describefeaturetype", params.get( "request") );
      
            String types = (String) params.get( "typename");
            assertNotNull(types);
               
            Catalog cat =  getCatalog();
            NamespaceInfo ns = cat.getNamespaceByURI(namespace);
            System.out.println(ns.getPrefix());
            // %2c == , (url-encoded, comma is not considered a safe char)
            assertEquals( cat.getFeatureTypesByNamespace(ns).size(), types.split("%2c").length);
        }
       
    }
View Full Code Here

        Document dom = getAsDOM("wfs?request=getfeature&featureid=PrimitiveGeoFeature.f008&version=1.0.0");
        runAssertions(dom,1);
    }

    public void testPerFeatureType() throws Exception {
        Catalog cat = getCatalog();
        FeatureTypeInfo ft = cat.getFeatureTypeByName("sf", "PrimitiveGeoFeature");
        ft.setNumDecimals(1);
        cat.save(ft);
       
        Document dom = getAsDOM("wfs?request=getfeature&featureid=PrimitiveGeoFeature.f008&version=1.0.0");
        runAssertions(dom,1);
    }
View Full Code Here

        Document dom = getAsDOM("wfs?request=getfeature&featureid=PrimitiveGeoFeature.f008&version=1.0.0");
        runAssertions(dom,1);
    }

    public void testMultipleFeatureTypes() throws Exception {
        Catalog cat = getCatalog();
        FeatureTypeInfo ft1 = cat.getFeatureTypeByName("sf", "PrimitiveGeoFeature");
        FeatureTypeInfo ft2 = cat.getFeatureTypeByName("sf", "AggregateGeoFeature");
        ft1.setNumDecimals(3);
        cat.save(ft1);
           
        ft2.setNumDecimals(1);
        cat.save(ft2);
       
        Document dom = getAsDOM("wfs?request=getfeature&featureid=PrimitiveGeoFeature.f008,AggregateGeoFeature.f009&version=1.0.0");
        runAssertions(dom, 3);
    }
View Full Code Here

    /**
     * See GEOS-3322, upon a namespace URI change the datastores connection parameter shall be
     * changed accordingly
     */
    public void testUpdatesDataStoresNamespace() {
        final Catalog catalog = getCatalog();
        final List<DataStoreInfo> storesInitial = catalog.getStoresByWorkspace(citeWorkspace,
                DataStoreInfo.class);

        final NamespaceInfo citeNamespace = catalog.getNamespaceByPrefix(citeWorkspace.getName());

        for (DataStoreInfo store : storesInitial) {
            assertEquals(citeNamespace.getURI(), store.getConnectionParameters().get("namespace"));
        }

        FormTester form = tester.newFormTester("form");
        final String newNsURI = "http://www.geoserver.org/changed";
        form.setValue("uri", newNsURI);
        form.submit();
        tester.assertNoErrorMessage();

        List<DataStoreInfo> storesChanged = catalog.getStoresByWorkspace(citeWorkspace,
                DataStoreInfo.class);
        for (DataStoreInfo store : storesChanged) {
            assertEquals(newNsURI, store.getConnectionParameters().get("namespace"));
        }
    }
View Full Code Here

        Document dom = dom( in( out ) ) ;
        assertEquals( "ms", dom.getDocumentElement().getNodeName() );
    }
   
    public void testDataStore() throws Exception {
        Catalog catalog = new CatalogImpl();
        CatalogFactory cFactory = catalog.getFactory();
       
        WorkspaceInfo ws = cFactory.createWorkspace();
        ws.setName( "foo" );
       
        DataStoreInfo ds1 = cFactory.createDataStore();
View Full Code Here

        Document dom = dom( in( out ) );
        assertEquals( "dataStore", dom.getDocumentElement().getNodeName() );
    }
   
    public void testCoverageStore() throws Exception {
        Catalog catalog = new CatalogImpl();
        CatalogFactory cFactory = catalog.getFactory();
       
        WorkspaceInfo ws = cFactory.createWorkspace();
        ws.setName( "foo" );
       
        CoverageStoreInfo cs1 = cFactory.createCoverageStore();
View Full Code Here

        Document dom = dom( in( out ) );
        assertEquals( "coverageStore", dom.getDocumentElement().getNodeName() );
    }
   
    public void testStyle() throws Exception {
        Catalog catalog = new CatalogImpl();
        CatalogFactory cFactory = catalog.getFactory();
       
        StyleInfo s1 = cFactory.createStyle();
        s1.setName( "foo" );
        s1.setFilename( "foo.sld" );
       
View Full Code Here

        Document dom = dom( in( out ) );
        assertEquals( "style", dom.getDocumentElement().getNodeName() );
    }
   
    public void testCatalog() throws Exception {
        Catalog catalog = new CatalogImpl();
        CatalogFactory cFactory = catalog.getFactory();
       
        WorkspaceInfo ws = cFactory.createWorkspace();
        ws.setName( "foo" );
        catalog.add( ws );
       
        NamespaceInfo ns = cFactory.createNamespace();
        ns.setPrefix( "acme" );
        ns.setURI( "http://acme.org" );
        catalog.add( ns );
       
        DataStoreInfo ds = cFactory.createDataStore();
        ds.setWorkspace( ws );
        ds.setName( "foo" );
        catalog.add( ds );
       
        CoverageStoreInfo cs = cFactory.createCoverageStore();
        cs.setWorkspace( ws );
        cs.setName( "bar" );
        catalog.add( cs );
       
        StyleInfo s = cFactory.createStyle();
        s.setName( "style" );
        s.setFilename( "style.sld" );
        catalog.add(s);
    
        ByteArrayOutputStream out = out();
        persister.save( catalog, out );
       
        catalog = persister.load( in(out), Catalog.class );
        assertNotNull(catalog);
       
        assertEquals( 1, catalog.getWorkspaces().size() );
        assertNotNull( catalog.getDefaultWorkspace() );
        ws = catalog.getDefaultWorkspace();
        assertEquals( "foo", ws.getName() );
       
        assertEquals( 1, catalog.getNamespaces().size() );
        assertNotNull( catalog.getDefaultNamespace() );
        ns = catalog.getDefaultNamespace();
        assertEquals( "acme", ns.getPrefix() );
        assertEquals( "http://acme.org", ns.getURI() );
       
        assertEquals( 1, catalog.getDataStores().size() );
        ds = catalog.getDataStores().get( 0 );
        assertEquals( "foo", ds.getName() );
        assertNotNull( ds.getWorkspace() );
        assertEquals( ws, ds.getWorkspace() );
       
        assertEquals( 1, catalog.getCoverageStores().size() );
        cs = catalog.getCoverageStores().get( 0 );
        assertEquals( "bar", cs.getName() );
        assertEquals( ws, cs.getWorkspace() );
       
        assertEquals( 1, catalog.getStyles().size() );
        s = catalog.getStyles().get(0);
        assertEquals( "style", s.getName() );
        assertEquals( "style.sld", s.getFilename() );
    }
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.Catalog

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.