Examples of WMSLayerInfo


Examples of org.geoserver.catalog.WMSLayerInfo

            CoverageInfo data = factory.createCoverage();
            builder.updateCoverage( data,  resource);
            l.setResource(data);
        }
        else if (origResource instanceof WMSLayerInfo){
            WMSLayerInfo resource = (WMSLayerInfo) origResource;
            WMSLayerInfo data = factory.createWMSLayer();
            builder.updateWMSLayer( data,  resource);
            l.setResource(data);
        }
        else {
            throw new BadRequestException("Unable to copy layer from " + origResource.getClass().getSimpleName());
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

                    throw new ServiceException(new StringBuffer(
                            "Internal error : unable to get reader for this coverage layer ")
                            .append(mapLayerInfo.toString()).toString());
                }
            } else if (layerType == MapLayerInfo.TYPE_WMS) {
                WMSLayerInfo wmsLayer = (WMSLayerInfo) mapLayerInfo.getResource();
                WebMapServer wms = wmsLayer.getStore().getWebMapServer(null);
                Layer gt2Layer = wmsLayer.getWMSLayer(null);

                // see if we can merge this layer with the previous one
                boolean merged = false;
                if (mapContext.getLayerCount() > 0) {
                    MapLayer lastLayer = mapContext.getLayer(mapContext.getLayerCount() - 1);
                    if (lastLayer instanceof WMSMapLayer) {
                        WMSMapLayer lastWMS = (WMSMapLayer) lastLayer;
                        WebMapServer otherWMS = lastWMS.getWebMapServer();
                        if (otherWMS.equals(wms)) {
                            lastWMS.addLayer(gt2Layer);
                            merged = true;
                        }
                    }
                }
                if (!merged) {
                    WMSMapLayer mapLayer = new WMSMapLayer(wms, gt2Layer);
                    mapLayer.setTitle(wmsLayer.getPrefixedName());
                    mapContext.addLayer(mapLayer);
                }
            } else {
                throw new IllegalArgumentException("Unkown layer type " + layerType);
            }
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

                return builder.buildLayer(ci);
            } else if (store instanceof DataStoreInfo) {
                FeatureTypeInfo fti = builder.buildFeatureType(resource.getName());
                return builder.buildLayer(fti);
            } else if (store instanceof WMSStoreInfo) {
                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",
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

        NamespaceInfo ns = catalog.getFactory().createNamespace();
        ns.setPrefix( "bar" );
        ns.setURI( "http://bar" );
        catalog.add( ns );
       
        WMSLayerInfo wms = catalog.getFactory().createWMSLayer();
        wms.setName( "foo" );
        wms.setNamespace( ns );
        wms.setStore(catalog.getStoreByName("acme", "demowms", WMSStoreInfo.class));
        catalog.add( wms );
       
        assertTrue( d.exists() );
        assertTrue( new File( d, "wmslayer.xml").exists() );
    }
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

    }
   
    public void testModifyWMSLayer() throws Exception {
        testAddWMSLayer();
       
        WMSLayerInfo wli = catalog.getResourceByName( "bar", "foo", WMSLayerInfo.class );
        wli.setTitle( "fooTitle" );
        catalog.save( wli );
       
        File f = new File( testData.getDataDirectoryRoot(), "workspaces/acme/demowms/foo/wmslayer.xml");
        Document dom = dom( f );
       
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

        testAddWMSLayer();
       
        File d = new File( testData.getDataDirectoryRoot(), "workspaces/acme/demowms/foo");
        assertTrue( d.exists() );
       
        WMSLayerInfo wli = catalog.getResourceByName( "bar", "foo", WMSLayerInfo.class );
        catalog.remove( wli );
       
        assertFalse( d.exists() );
    }
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

        wms.setCapabilitiesURL(RemoteOWSTestSupport.WMS_SERVER_URL
                + "service=WMS&request=GetCapabilities");
        cat.save(wms);

        cb.setStore(wms);
        WMSLayerInfo wmsLayer = cb.buildWMSLayer("topp:states");
        assertEquals("states", wmsLayer.getName());
        assertEquals("topp:states", wmsLayer.getNativeName());
        assertEquals("EPSG:4326", wmsLayer.getSRS());
        assertEquals(CRS.decode("EPSG:4326"), wmsLayer.getNativeCRS());
        assertNotNull(wmsLayer.getNativeBoundingBox());
        assertNotNull(wmsLayer.getLatLonBoundingBox());
       
        LayerInfo layer = cb.buildLayer(wmsLayer);
        assertEquals(LayerInfo.Type.WMS, layer.getType());
    }
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

                               
                                //load wms layers
                                for ( File cd : list(sd,DirectoryFileFilter.INSTANCE) ) {
                                    f = new File( cd, "wmslayer.xml" );
                                    if( f.exists() ) {
                                        WMSLayerInfo wl = null;
                                        try {
                                            wl = depersist(xp,f,WMSLayerInfo.class);
                                            catalog.add( wl );
                                           
                                            LOGGER.info( "Loaded wms layer'" + wl.getName() +"'");
                                        }
                                        catch( Exception e ) {
                                            LOGGER.log( Level.WARNING, "Failed to load wms layer '" + cd.getName() +"'", e);
                                            continue;
                                        }
                                       
                                        f = new File( cd, "layer.xml" );
                                        if ( f.exists() ) {
                                            try {
                                                LayerInfo l = depersist(xp, f, LayerInfo.class );
                                                catalog.add( l );
                                               
                                                LOGGER.info( "Loaded layer '" + l.getName() + "'" );
                                            }
                                            catch( Exception e ) {
                                                LOGGER.log( Level.WARNING, "Failed to load cascaded wms layer '" + wl.getName() +"'", e);
                                            }
                                        }
                                    }
                                    else {
                                        LOGGER.warning( "Ignoring coverage directory " + cd.getAbsolutePath() );
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

        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

Examples of org.geoserver.catalog.WMSLayerInfo

        };
    }
   
    private void publishLayer(LayerResource layer, CatalogBuilder builder, WMSStoreInfo store, Catalog catalog) {
               
        WMSLayerInfo wli;
        LayerInfo li;
        try {
            wli = builder.buildWMSLayer(layer.getLocalName());
            li  = builder.buildLayer(wli);
        } catch (IOException e) {
            LOGGER.log(Level.WARNING,
                    "Error building WMS cascading layer "
                    + layer.getLocalName(), e);
            layer.setStatus(LayerStatus.ERROR);
            layer.setError(e.getMessage());
            errorCount++;
            return;
        }       

        WMSLayerInfo exists = catalog.getResourceByStore(store, li.getName(),
                WMSLayerInfo.class);

        if (exists != null) {
            // TODO what to do if layer already exists?
            builder.updateWMSLayer(exists, wli);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.