Examples of WMSLayerInfo


Examples of org.geoserver.catalog.WMSLayerInfo

       
        assertEquals( 201, response.getStatusCode() );
        assertNotNull( response.getHeader( "Location") );
        assertTrue( response.getHeader("Location").endsWith( "/workspaces/sf/wmsstores/demo/wmslayers/bugsites" ) );
       
        WMSLayerInfo layer = catalog.getResourceByName("sf", "bugsites", WMSLayerInfo.class);
        assertNotNull(layer.getNativeBoundingBox());
    }
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

        assertEquals( "wmsLayer", dom.getDocumentElement().getNodeName() );
        assertXpathEvaluatesTo("states", "/wmsLayer/name", dom);
        assertXpathEvaluatesTo( "EPSG:4326", "/wmsLayer/srs", dom);
        assertEquals( CRS.decode( "EPSG:4326" ).toWKT(), xp.evaluate( "/wmsLayer/nativeCRS", dom ) );
       
        WMSLayerInfo wml = catalog.getResourceByName( "sf", "states", WMSLayerInfo.class );
       
        ReferencedEnvelope re = wml.getLatLonBoundingBox();
        assertXpathEvaluatesTore.getMinX()+"" , "/wmsLayer/latLonBoundingBox/minx", dom );
        assertXpathEvaluatesTore.getMaxX()+"" , "/wmsLayer/latLonBoundingBox/maxx", dom );
        assertXpathEvaluatesTore.getMinY()+"" , "/wmsLayer/latLonBoundingBox/miny", dom );
        assertXpathEvaluatesTore.getMaxY()+"" , "/wmsLayer/latLonBoundingBox/maxy", dom );
    }
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

        assertEquals( 200, response.getStatusCode() );
       
        Document dom = getAsDOM("/rest/workspaces/sf/wmsstores/demo/wmslayers/states.xml");
        assertXpathEvaluatesTo("Lots of states here", "/wmsLayer/title", dom );
       
        WMSLayerInfo wli = catalog.getResourceByName( "sf", "states", WMSLayerInfo.class);
        assertEquals( "Lots of states here", wli.getTitle() );
    }
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

       
        NodeList links = xp.getMatchingNodes("//html:a", dom );
        assertEquals( wmsLayers.size(), links.getLength() );
       
        for ( int i = 0; i < wmsLayers.size(); i++ ){
            WMSLayerInfo wl = wmsLayers.get( i );
            Element link = (Element) links.item( i );
           
            assertTrue( link.getAttribute("href").endsWith( wl.getName() + ".html") );
        }
    }
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

 
  public static WMSLayerInfo localizeWMSLayer(final WMSLayerInfo info, final Catalog catalog) throws IllegalAccessException, InvocationTargetException {
    if (info==null || catalog==null)
      throw new NullArgumentException("Arguments may never be null");
   
    final WMSLayerInfo localObject=catalog.getResourceByName(info.getNamespace(),info.getName(),WMSLayerInfo.class);
    if (localObject !=null){
      return localObject;
    }

    final WMSLayerInfo createdObject = catalog.getFactory().createWMSLayer();
   
    // let's using the created object (see getGridCoverageReader)
    BeanUtils.copyProperties(createdObject, info);
   
   
    createdObject.setNamespace(localizeNamespace(info.getNamespace(), catalog));
   
    final StoreInfo store=localizeStore(info.getStore(), catalog);
    createdObject.setStore(store);
   
//    WMSLayerObject.setAttributes(localizeAttributes(...)); TODO(should be already serialized)

    final CatalogBuilder builder = new CatalogBuilder(catalog);
    builder.attach(createdObject);
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

    @Override
    protected String handleObjectPost(Object object) throws Exception {
        String workspace = getAttribute( "workspace");
        String wmsstore = getAttribute( "wmsstore");

        WMSLayerInfo wml = (WMSLayerInfo) object;
        
        //ensure the store matches up
        WMSStoreInfo wms = catalog.getStoreByName( workspace, wmsstore, WMSStoreInfo.class);
        if ( wml.getStore() != null ) {
            if ( !wmsstore.equals( wml.getStore().getName() ) ) {
                throw new RestletException( "Expected wms store " + wmsstore +
                " but client specified " + wml.getStore().getName(), Status.CLIENT_ERROR_FORBIDDEN );
            }
        } else {
            wml.setStore( wms );
        }
       
        //ensure workspace/namespace matches up
        if ( wml.getNamespace() != null ) {
            if ( !workspace.equals( wml.getNamespace().getPrefix() ) ) {
                throw new RestletException( "Expected workspace " + workspace +
                    " but client specified " + wml.getNamespace().getPrefix(), Status.CLIENT_ERROR_FORBIDDEN );
            }
        } else {
            wml.setNamespace( catalog.getNamespaceByPrefix( workspace ) );
        }
        wml.setEnabled(true);
       
        NamespaceInfo ns = wml.getNamespace();
        if ( ns != null && !ns.getPrefix().equals( workspace ) ) {
            //TODO: change this once the two can be different and we untie namespace
            // from workspace
            LOGGER.warning( "Namespace: " + ns.getPrefix() + " does not match workspace: " + workspace + ", overriding." );
            ns = null;
        }
       
        if ( ns == null){
            //infer from workspace
            ns = catalog.getNamespaceByPrefix( workspace );
            wml.setNamespace( ns );
        }
       
        // fill in missing information
        CatalogBuilder cb = new CatalogBuilder(catalog);
        cb.setStore(wms);
        cb.initWMSLayer( wml );
       
        wml.setEnabled(true);
        catalog.add( wml );
       
        // create a layer for the feature type
        catalog.add(new CatalogBuilder(catalog).buildLayer(wml));
       
        LOGGER.info( "POST wms layer " + wmsstore + "," + wml.getName() );
        return wml.getName();
    }
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

        return getAttribute("wmslayer") != null;
    }

    @Override
    protected void handleObjectPut(Object object) throws Exception {
        WMSLayerInfo wml = (WMSLayerInfo) object;
       
        String workspace = getAttribute("workspace");
        String wmsstore = getAttribute("wmsstore");
        String wmslayer = getAttribute("wmslayer");
       
        WMSStoreInfo wms = catalog.getStoreByName(workspace, wmsstore, WMSStoreInfo.class);
        WMSLayerInfo original = catalog.getResourceByStore( wms,  wmslayer, WMSLayerInfo.class );
        new CatalogBuilder(catalog).updateWMSLayer(original,wml);
        catalog.save( original );
       
        LOGGER.info( "PUT wms layer " + wmsstore + "," + wmslayer );
    }
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

        String wmsstore = getAttribute("wmsstore");
        String wmslayer = getAttribute("wmslayer");
        boolean recurse = getQueryStringValue("recurse", Boolean.class, false);
       
        WMSStoreInfo wms = catalog.getStoreByName(workspace, wmsstore, WMSStoreInfo.class);
        WMSLayerInfo wml = catalog.getResourceByStore( wms,  wmslayer, WMSLayerInfo.class );
        List<LayerInfo> layers = catalog.getLayers(wml);
       
        if (recurse) {
            //by recurse we clear out all the layers that public this resource
            for (LayerInfo l : layers) {
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

            for ( Layer layer : ds.getCapabilities().getLayerList() ) {
                if(layer.getName() == null || "".equals(layer.getName())) {
                    continue;
                }
                   
                WMSLayerInfo wIinfo = catalog.getResourceByStore(info, layer.getName(), WMSLayerInfo.class);
                if (wIinfo == null ) {
                    //not in catalog, add it
                    available.add( layer.getName() );
                }
            }
View Full Code Here

Examples of org.geoserver.catalog.WMSLayerInfo

        WMSStoreInfo wms = cb.buildWMSStore("demo");
        wms.setCapabilitiesURL("http://demo.opengeo.org/geoserver/wms?");
        catalog.add(wms);
       
        // and a wms layer as well (cannot use the builder, would turn this test into an online one
        WMSLayerInfo wml = catalog.getFactory().createWMSLayer();
        wml.setName("states");
        wml.setNativeName("topp:states");
        wml.setStore(catalog.getStoreByName("demo", WMSStoreInfo.class));
        wml.setCatalog(catalog);
        wml.setNamespace(catalog.getNamespaceByPrefix("sf"));
        wml.setSRS("EPSG:4326");
        CoordinateReferenceSystem wgs84 = CRS.decode("EPSG:4326");
        wml.setNativeCRS(wgs84);
        wml.setLatLonBoundingBox(new ReferencedEnvelope(-110, 0, -60, 50, wgs84));
        wml.setProjectionPolicy(ProjectionPolicy.FORCE_DECLARED);
       
        catalog.add(wml);
       
    }
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.