Package org.geoserver.catalog

Examples of org.geoserver.catalog.CatalogBuilder


                ReferencedEnvelope nativeBounds = (ReferencedEnvelope) nativeBBox.getModelObject();
                try {
                    // if the native bounds are not around compute them
                    if(nativeBounds == null) {
                        ResourceInfo resource = (ResourceInfo) BasicResourceConfig.this.getDefaultModelObject();
                        CatalogBuilder cb = new CatalogBuilder(GeoServerApplication.get().getCatalog());
                        nativeBounds = cb.getNativeBounds(resource);
                        resource.setNativeBoundingBox(nativeBounds);
                        nativeBBox.setModelObject(nativeBounds);
                        target.addComponent(nativeBBox);
                    }
               
                    CatalogBuilder cb = new CatalogBuilder(GeoServerApplication.get().getCatalog());
                    latLonPanel.setModelObject(cb.getLatLonBounds(nativeBounds, declaredCRS.getCRS()));
                } catch(IOException e) {
                    LOGGER.log(Level.SEVERE, "Error computing the geographic BBOX", e);
                    error("Error computing the geographic bounds:" + e.getMessage());
                }
                target.addComponent(latLonPanel);
View Full Code Here


    LayerInfo buildLayerInfo(LayerResource resource) {
        Catalog catalog = getCatalog();
        StoreInfo store = catalog.getStore(storeId, StoreInfo.class);

        try {
            CatalogBuilder builder = new CatalogBuilder(catalog);
            builder.setStore(store);
            WMSLayerInfo wli = builder.buildWMSLayer(resource.getLocalName());
            return builder.buildLayer(wli);           
        } catch (Exception e) {
            throw new RuntimeException(
                    "Error occurred while building the resources for the configuration page",
                    e);
        }
View Full Code Here

        };
    }
   
    void publishLayers(List<LayerResource> selection) {
        Catalog catalog = getCatalog();
        CatalogBuilder builder = new CatalogBuilder(catalog);
       
        WMSStoreInfo store = getCatalog().getStore(storeId, WMSStoreInfo.class);                                       
        builder.setStore(store);

        importCount = 0;
        errorCount = 0;
        updateCount = 0;
        for (LayerResource resource : selection) {
View Full Code Here

                StoreInfo store = getCatalog().getStore(storeId, StoreInfo.class);
               
                Map<String, LayerResource> resources = new HashMap<String, LayerResource>();
                WMSStoreInfo wmsInfo = (WMSStoreInfo) store;
               
                CatalogBuilder builder = new CatalogBuilder(getCatalog());
                builder.setStore(store);
                List<Layer> layers = wmsInfo.getWebMapServer(null).getCapabilities().getLayerList();
                for(Layer l : layers) {
                    if(l.getName() == null) {
                        continue;
                    }
View Full Code Here

        final InputCoverageBand band = new InputCoverageBand("watertemp", "0");
        final CoverageBand outputBand = new CoverageBand(Collections.singletonList(band), "watertemp@0",
                0, CompositionType.BAND_SELECT);
        final CoverageView coverageView = new CoverageView("waterView",
                Collections.singletonList(outputBand));
        final CatalogBuilder builder = new CatalogBuilder(catalog);
        builder.setStore(storeInfo);

        // Adding the coverageView to the catalog
        final String layerName = "waterview";
        final CoverageInfo coverageInfo = coverageView.createCoverageInfo(layerName, storeInfo, builder);
        coverageInfo.getParameters().put("USE_JAI_IMAGEREAD","false");
View Full Code Here

        FeatureTypeInfo ftInfo = catalog.getFeatureTypeByName(c.getSchema().getName());
        if (ftInfo == null) {
            // SG the fc might have been generated by the WPS therefore there is no such a thing
            // inside the GeoServer catalogue
            final SimpleFeatureSource featureSource = DataUtilities.source(c);
            final CatalogBuilder catalogBuilder = new CatalogBuilder(catalog);
            catalogBuilder.setStore(catalogBuilder.buildDataStore(c.getSchema().getName()
                    .getLocalPart()));
            ftInfo = catalogBuilder.buildFeatureType(featureSource);

        }
        return ftInfo;
    }
View Full Code Here

        SimpleFeatureType schema = tb.buildFeatureType();
        store.createSchema(schema);
        SimpleFeatureStore featureStore = (SimpleFeatureStore) store.getFeatureSource("pgeo");
        featureStore.addFeatures(fsp.getFeatures());

        CatalogBuilder cb = new CatalogBuilder(cat);
        cb.setStore(ds);
        FeatureTypeInfo tft = cb.buildFeatureType(featureStore);
        cat.add(tft);

        // create the sql view
        JDBCDataStore jds = (JDBCDataStore) ds.getDataStore(null);
        VirtualTable vt = new VirtualTable("pgeo_view", "select \"name\", \"pointProperty\" from \"pgeo\" where \"booleanProperty\" = %bool% and \"name\" = '%name%'");
        vt.addParameter(new VirtualTableParameter("bool", "true"));
        vt.addParameter(new VirtualTableParameter("name", "name-f001"));
        vt.addGeometryMetadatata("pointProperty", Point.class, 4326);
        jds.addVirtualTable(vt);

        FeatureTypeInfo vft = cb.buildFeatureType(jds.getFeatureSource(vt.getName()));
        vft.getMetadata().put(FeatureTypeInfo.JDBC_VIRTUAL_TABLE, vt);
        cat.add(vft);
    }
View Full Code Here

        Map<String,Serializable> params = createConnectionParameters(data);
        if (params == null) {
            return null;
        }

        CatalogBuilder cb = new CatalogBuilder(catalog);
        cb.setWorkspace(workspace);
        DataStoreInfo store  = cb.buildDataStore(data.getName());
        store.setType(factory().getDisplayName());
        store.getConnectionParameters().putAll(params);
        return store;
    }
View Full Code Here

    @Override
    public List<ImportTask> list(ImportData data, Catalog catalog, ProgressMonitor monitor) throws IOException {
        DataStore dataStore = createDataStore(data);
        try {
            CatalogBuilder cb = new CatalogBuilder(catalog);
           
            //create a dummy datastore
            DataStoreInfo store = cb.buildDataStore("dummy");
            cb.setStore(store);
           
            List<ImportTask> tasks = new ArrayList<ImportTask>();
            for (String typeName : dataStore.getTypeNames()) {
                if (monitor.isCanceled()) {
                    break;
                }
                monitor.setTask("Processing " + typeName);

                // warning - this will log a scary exception if SRS cannot be found
                try {
                    FeatureTypeInfo featureType =
                            cb.buildFeatureType(dataStore.getFeatureSource(typeName));
                    featureType.setStore(null);
                    featureType.setNamespace(null);
   
                    SimpleFeatureSource featureSource = dataStore.getFeatureSource(typeName);
                    cb.setupBounds(featureType, featureSource);
   
                    //add attributes
                    CatalogFactory factory = catalog.getFactory();
                    SimpleFeatureType schema = featureSource.getSchema();
                    for (AttributeDescriptor ad : schema.getAttributeDescriptors()) {
                        AttributeTypeInfo att = factory.createAttribute();
                        att.setName(ad.getLocalName());
                        att.setBinding(ad.getType().getBinding());
                        featureType.getAttributes().add(att);
                    }
   
                    LayerInfo layer = cb.buildLayer((ResourceInfo)featureType);
   
                    ImportTask task = new ImportTask(data.part(typeName));
                    task.setLayer(layer);
                    task.getMetadata().put(FeatureType.class, schema);
   
View Full Code Here

       
        tb.init((SimpleFeatureType) fs2.getSchema());
        tb.remove("boundedBy");
        store.createSchema(tb.buildFeatureType());
       
        CatalogBuilder cb = new CatalogBuilder(cat);
        cb.setStore(ds);
       
        FeatureStore fs = (FeatureStore) store.getFeatureSource("Fifteen");
        fs.addFeatures(fs1.getFeatures());
        FeatureTypeInfo ft = cb.buildFeatureType(fs);
        cat.add(ft);
       
        fs = (FeatureStore) store.getFeatureSource("Seven");
        fs.addFeatures(fs2.getFeatures());
        ft = cb.buildFeatureType(fs);
        cat.add(ft);
    }
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.CatalogBuilder

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.