Package org.geoserver.catalog

Examples of org.geoserver.catalog.Catalog


        this.wsId = workspaceId;
    }

    public void validate(final IValidatable validatable) {

        final Catalog catalog = GeoServerApplication.get().getCatalog();
        final StoreInfo store = catalog.getStore(storeId, StoreInfo.class);
        final WorkspaceInfo previousWorkspace = catalog.getWorkspace(wsId);

        final WorkspaceInfo newWorkspace = (WorkspaceInfo) validatable.getValue();
        if (previousWorkspace.equals(newWorkspace)) {
            return;
        }

        final NamespaceInfo newNamespace = catalog.getNamespaceByPrefix(newWorkspace.getName());

        List<ResourceInfo> configuredResources = catalog.getResourcesByStore(store,
                ResourceInfo.class);

        // The datastore namespace may have changed and resources with the same name may already
        // exist...
        StringBuilder sb = new StringBuilder();
        for (ResourceInfo res : configuredResources) {
            ResourceInfo existing = catalog.getResourceByName(newNamespace, res.getName(),
                    ResourceInfo.class);
            if (existing != null) {
                sb.append(existing.getName()).append(" ");
            }
        }
View Full Code Here


     *
     * @param resource
     * @return
     */
    LayerInfo buildLayerInfo(Resource resource) {
        Catalog catalog = getCatalog();
        StoreInfo store = catalog.getStore(getSelectedStoreId(), StoreInfo.class);

        // try to build from coverage store or data store
        try {
            CatalogBuilder builder = new CatalogBuilder(catalog);
            builder.setStore(store);
View Full Code Here

            error.addMessageKey("StoreNameValidator.storeNameRequired");
            nameComponent.error((IValidationError) error);
            return;
        }

        Catalog catalog = GeoServerApplication.get().getCatalog();

        final StoreInfo existing = catalog.getStoreByName(workspace, name, StoreInfo.class);
        if (existing != null) {
            final String existingId = existing.getId();
            if (!existingId.equals(edittingStoreId)) {
                ValidationError error = new ValidationError();
                error.addMessageKey("StoreNameValidator.storeExistsInWorkspace");
View Full Code Here

            AttributesImpl attributes = new AttributesImpl();
            //attributes.addAttribute("", "version", "version", "", CUR_VERSION);

            start("ContentMetadata", attributes);

            Catalog catalog = config.getGeoServer().getCatalog();
            List<CoverageInfo> coverages = catalog.getCoverages();
           
            // filter out disabled coverages
            for (Iterator it = coverages.iterator(); it.hasNext();) {
                CoverageInfo cv = (CoverageInfo) it.next();
                if(!cv.enabled())
View Full Code Here

       
        catalog = getCatalog();
        visitor = new CascadeDeleteVisitor(catalog);
       
        // setup a group, see GEOS-3040
        Catalog catalog = getCatalog();
        String lakes = MockData.LAKES.getLocalPart();
        String forests = MockData.FORESTS.getLocalPart();
        String bridges = MockData.BRIDGES.getLocalPart();
       
        setNativeBox(catalog, lakes);
        setNativeBox(catalog, forests);
        setNativeBox(catalog, bridges);
       
        LayerGroupInfo lg = catalog.getFactory().createLayerGroup();
        lg.setName(LAKES_GROUP);
        lg.getLayers().add(catalog.getLayerByName(lakes));
        lg.getStyles().add(catalog.getStyleByName(lakes));
        lg.getLayers().add(catalog.getLayerByName(forests));
        lg.getStyles().add(catalog.getStyleByName(forests));
        lg.getLayers().add(catalog.getLayerByName(bridges));
        lg.getStyles().add(catalog.getStyleByName(bridges));
        CatalogBuilder builder = new CatalogBuilder(catalog);
        builder.calculateLayerGroupBounds(lg);
        catalog.add(lg);
    }
View Full Code Here

   
    public void testFeatureTypeNoSRS() throws Exception {
        // build a feature type (it's already in the catalog, but we just want to
        // check it's built as expected
        // LINES is a feature type with a native SRS, so we want the bounds to be there
        Catalog cat = getCatalog();
        CatalogBuilder cb = new CatalogBuilder(cat);
        cb.setStore(cat.getDataStoreByName(MockData.BRIDGES.getPrefix()));
        FeatureTypeInfo fti = cb.buildFeatureType(toName(MockData.BRIDGES));
       
        // perform basic checks, this has no srs so no lat/lon bbox computation possible
        assertNull(fti.getSRS());
        assertNull(fti.getNativeCRS());
View Full Code Here

   
    public void testFeatureType() throws Exception {
        // build a feature type (it's already in the catalog, but we just want to
        // check it's built as expected
        // LINES is a feature type with a native SRS, so we want the bounds to be there
        Catalog cat = getCatalog();
        CatalogBuilder cb = new CatalogBuilder(cat);
        cb.setStore(cat.getDataStoreByName(MockData.LINES.getPrefix()));
        FeatureTypeInfo fti = cb.buildFeatureType(toName(MockData.LINES));
       
        // perform basic checks
        assertEquals("EPSG:32615", fti.getSRS());
        assertEquals(CRS.decode("EPSG:32615", true), fti.getCRS());
View Full Code Here

   
    public void testGeometryless() throws Exception {
        // build a feature type (it's already in the catalog, but we just want to
        // check it's built as expected
        // LINES is a feature type with a native SRS, so we want the bounds to be there
        Catalog cat = getCatalog();
        CatalogBuilder cb = new CatalogBuilder(cat);
        cb.setStore(cat.getDataStoreByName(MockData.GEOMETRYLESS.getPrefix()));
        FeatureTypeInfo fti = cb.buildFeatureType(toName(MockData.GEOMETRYLESS));
        LayerInfo layer = cb.buildLayer(fti);
        cb.setupBounds(fti);
       
        // perform basic checks
View Full Code Here

   
    public void testCoverage() throws Exception {
        // build a feature type (it's already in the catalog, but we just want to
        // check it's built as expected
        // LINES is a feature type with a native SRS, so we want the bounds to be there
        Catalog cat = getCatalog();
        CatalogBuilder cb = new CatalogBuilder(cat);
        cb.setStore(cat.getCoverageStoreByName(MockData.TASMANIA_DEM.getLocalPart()));
        CoverageInfo fti = cb.buildCoverage();
       
        // perform basic checks
        assertEquals(CRS.decode("EPSG:4326", true), fti.getCRS());
        assertEquals("EPSG:4326", fti.getSRS());
View Full Code Here

        assertNotNull(fti.getLatLonBoundingBox());
    }
   
    public void testEmptyBounds() throws Exception {
        // test the bounds of a single point
        Catalog cat = getCatalog();
        FeatureTypeInfo fti = cat.getFeatureTypeByName(getLayerId(MockData.POINTS ));
        assertEquals(Point.class, fti.getFeatureType().getGeometryDescriptor().getType().getBinding());
        assertEquals(1, fti.getFeatureSource(null, null).getCount(Query.ALL));
       
        CatalogBuilder cb = new CatalogBuilder(cat);
        cb.setStore(cat.getStoreByName(MockData.CGF_PREFIX, DataStoreInfo.class));
        FeatureTypeInfo built = cb.buildFeatureType(fti.getQualifiedName());
        cb.setupBounds(built);
       
        assertTrue(built.getNativeBoundingBox().getWidth() > 0);
        assertTrue(built.getNativeBoundingBox().getHeight() > 0);
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.