Package org.geoserver.catalog

Examples of org.geoserver.catalog.FeatureTypeInfo


       
        DataStoreInfo ds1 = catalog.getFactory().createDataStore();
        ds1.setName( "ds1" );
        catalog.add( ds );
       
        FeatureTypeInfo ft1 = catalog.getFactory().createFeatureType();
        ft1.setName( "ft1" );
        ft1.setStore(ds1);
        catalog.add( ft1 );
       
        FeatureTypeInfo ft2 = catalog.getFactory().createFeatureType();
        ft2.setName( "ft2" );
        ft2.setStore(ds1);
        catalog.add( ft2 );
       
        DataStoreInfo ds2 = catalog.getFactory().createDataStore();
        ds2.setName( "ds2" );
        catalog.add( ds2 );
       
        FeatureTypeInfo ft3 = catalog.getFactory().createFeatureType();
        ft3.setName( "ft3" );
        ft3.setStore( ds2 );
        catalog.add( ft3 );
       
        List<FeatureTypeInfo> ft = catalog.getFeatureTypesByStore( ds1 );
        assertEquals( 2, ft.size() );
       
View Full Code Here


    }
   
    public void testModifyFeatureType() {
        catalog.add( ft );
       
        FeatureTypeInfo ft2 = catalog.getFeatureTypeByName(ft.getName());
        ft2.setDescription( "ft2Description" );
        ft2.getKeywords().add( "ft2");
       
        FeatureTypeInfo ft3 = catalog.getFeatureTypeByName(ft.getName());
        assertEquals( "ftName", ft3.getName() );
        assertEquals( "ftDescription", ft3.getDescription() );
        assertTrue( ft3.getKeywords().isEmpty() );
       
        catalog.save( ft2 );
        ft3 = catalog.getFeatureTypeByName(ft.getName());
        assertEquals(ft2, ft3);
        assertEquals( "ft2Description", ft3.getDescription() );
        assertEquals( 1, ft3.getKeywords().size() );
    }
View Full Code Here

        return watermark.getURL();
    }

    public FeatureTypeInfo getFeatureTypeInfo(final Name name) {
        Catalog catalog = getCatalog();
        FeatureTypeInfo resource = catalog.getResourceByName(name, FeatureTypeInfo.class);
        return resource;
    }
View Full Code Here

        catalog.add( ns );
       
        TestListener l = new TestListener();
        catalog.addListener( l );
       
        FeatureTypeInfo ft = catalog.getFactory().createFeatureType();
        ft.setName( "ftName" );
        ft.setDescription( "ftDescription" );
        ft.setStore( ds );
       
        assertTrue( l.added.isEmpty() );
        catalog.add(ft);
       
        assertEquals( 1, l.added.size() );
        assertEquals( ft, l.added.get(0).getSource() );
       
        ft = catalog.getFeatureTypeByName("ftName");
        ft.setDescription( "changed" );
        assertTrue( l.modified.isEmpty() );
        catalog.save(ft);
        assertEquals( 1, l.modified.size() );
        assertEquals( ft, l.modified.get(0).getSource() );
        assertTrue( l.modified.get(0).getPropertyNames().contains( "description"));
View Full Code Here

        FeatureTypeCache featureTypeCache = (FeatureTypeCache) context
            .getComponentInstanceOfType(FeatureTypeCache.class);

        Collection featureTypes = catalog.getFeatureTypes();
        for (Iterator f = featureTypes.iterator(); f.hasNext();) {
            FeatureTypeInfo meta = (FeatureTypeInfo) f.next();
            if ( !meta.enabled() ) {
                continue;
            }

           
            FeatureType featureType =  null;
            try {
                featureType = meta.getFeatureType();
            } catch(Exception e) {
                LOGGER.log(Level.WARNING, "Could not load underlying feature type for type "
                        + meta.getName(), e);
                continue;
            }

            featureTypeCache.put(featureType);
        }
View Full Code Here

            builder.setStore(store);
            if (store instanceof CoverageStoreInfo) {
                CoverageInfo ci = builder.buildCoverage();
                return builder.buildLayer(ci);
            } else if (store instanceof DataStoreInfo) {
                FeatureTypeInfo fti = builder.buildFeatureType(resource.getName());
                return builder.buildLayer(fti);
            }
        } catch (Exception e) {
            throw new RuntimeException(
                    "Error occurred while building the resources for the configuration page",
View Full Code Here

                    + "(required for rollback)");
        }

        // then, make sure we're hitting a versioning datastore
        RollbackType rollback = (RollbackType) element;
        FeatureTypeInfo info = (FeatureTypeInfo) featureTypeInfos.get(rollback.getTypeName());
       

        try {
            if (!(info.getFeatureSource(null,null) instanceof VersioningFeatureSource)) {
                throw new WFSTransactionException("Cannot perform a rollback on "
                        + info.getName() + " since the backing data store is not versioning",
                        "", rollback.getHandle());
            }
        } catch (IOException e) {
            throw new WFSTransactionException("Cannot get the feature source for feature type "
                    + info.getName(), e, rollback.getHandle());
        }

        // TODO: we should check the user attribute, but for the moment
        // we don't have an authentication subsystem
    }
View Full Code Here

        builder.calculateLayerGroupBounds(lg);
        catalog.add(lg);
    }
   
    public void setNativeBox(Catalog catalog, String name) throws Exception {
        FeatureTypeInfo fti = catalog.getFeatureTypeByName(name);
        fti.setNativeBoundingBox(fti.getFeatureSource(null, null).getBounds());
        fti.setLatLonBoundingBox(new ReferencedEnvelope(fti.getNativeBoundingBox(), DefaultGeographicCRS.WGS84));
        catalog.save(fti);
    }
View Full Code Here

        // for each difference query check the feature type is versioned, and
        // gather bounds
        try {
            for (int i = 0; i < queries.size() && residual > 0; i++) {
                DifferenceQueryType query = (DifferenceQueryType) queries.get(i);
                FeatureTypeInfo meta = featureTypeInfo((QName) query.getTypeName());
                FeatureSource<? extends FeatureType, ? extends Feature> source = meta.getFeatureSource(null,null);

                if (!(source instanceof VersioningFeatureSource)) {
                    throw new WFSException("Feature type" + query.getTypeName()
                        + " is not versioned");
                }
View Full Code Here

        return result;
    }

    FeatureTypeInfo featureTypeInfo(QName name) throws WFSException, IOException {
        FeatureTypeInfo meta = catalog.getFeatureTypeByName(name.getNamespaceURI(), name.getLocalPart());

        if (meta == null) {
            String msg = "Could not locate " + name + " in catalog.";
            throw new WFSException(msg);
        }
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.FeatureTypeInfo

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.