Package org.geoserver.catalog

Examples of org.geoserver.catalog.FeatureTypeInfo


            type.getPrefix() + ":" + type.getLocalPart(),
            fid
        );

        assertStatusCodeForGet(403, path);
        FeatureTypeInfo ft = getCatalog().getFeatureTypeByName(
            getCatalog().getNamespace(type.getPrefix()),
            type.getLocalPart()
        );

        ft.getMetadata().put("indexingEnabled", true);
        getCatalog().save(ft);

        ft = getCatalog().getFeatureTypeByName(
            getCatalog().getNamespace(type.getPrefix()),
            type.getLocalPart()
        );
        assertEquals(ft.getMetadata().get("indexingEnabled"), true);


        Document d = getAsDOM(path);
        assertEquals(
                "In " + path + ": ",
View Full Code Here


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

        assertNotBlank("testBlueLake", this.rasterMapProducer);
    }

    private void addToMap(final WMSMapContext map, final QName typeName) throws IOException {
        final FeatureTypeInfo ftInfo = getCatalog().getFeatureTypeByName(typeName.getNamespaceURI(), typeName.getLocalPart());
       
        List<LayerInfo> layers = getCatalog().getLayers(ftInfo);
        StyleInfo defaultStyle = layers.get(0).getDefaultStyle();
        Style style = defaultStyle.getStyle();
       
        map.addLayer(new FeatureSourceMapLayer(ftInfo.getFeatureSource(null, null), style));
    }
View Full Code Here

     */
    private void testDefaultStyle(FeatureSource fSource) throws Exception {
        Catalog catalog = getCatalog();
        Style style = catalog.getStyleByName("Default").getStyle();

        FeatureTypeInfo typeInfo = catalog.getFeatureTypeByName(MockData.LAKES.getNamespaceURI(), MockData.LAKES.getLocalPart());
        Envelope env = typeInfo.getFeatureSource(null, null).getBounds();
        env.expandToInclude(fSource.getBounds());

        int w = 400;
        int h = (int) Math.round((env.getHeight() * w) / env.getWidth());

View Full Code Here

        map.setMapHeight(100);
        map.setRequest(new GetMapRequest(getWMS()));
        final ReferencedEnvelope bounds = new ReferencedEnvelope(-180, 180, -90, 90, DefaultGeographicCRS.WGS84);
        map.setAreaOfInterest(bounds);

        final FeatureTypeInfo ftInfo = getCatalog().getFeatureTypeByName(STREAMS.getNamespaceURI(), STREAMS.getLocalPart());

        final FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = (FeatureSource<SimpleFeatureType, SimpleFeature>) ftInfo.getFeatureSource(null, null);
       
        DecoratingFeatureSource<SimpleFeatureType, SimpleFeature> source;
        // This source should make the renderer fail when asking for the features
        source = new DecoratingFeatureSource<SimpleFeatureType, SimpleFeature>(featureSource) {
            @Override
View Full Code Here

        response.setEntity(format.toRepresentation(getContext(namespace, layer, request)));
    }
   
    SimpleHash getContext(String namespace, String layer, Request request){
      FeatureTypeInfo info = lookupType(namespace, layer);
        
        if (!(Boolean)info.getMetadata().get("indexingEnabled")) {
            throw new RestletException(
                    "Layer indexing disabled",
                    Status.CLIENT_ERROR_FORBIDDEN
                    );
        }
     
      SimpleHash map = new SimpleHash();
     
      //basic
      map.put("title", info.getTitle());
      map.put("abstract", info.getAbstract());
     
      //Metadata
      map.put("keywords", info.getKeywords());
    map.put("declaredCRS", info.getCRS());       
    map.put("metadataLinks", info.getMetadataLinks());
    try {
            Object o = info.getNativeCRS();
            if (o != null) {
                map.put("nativeCRS", info.getNativeCRS());
            } else {
                map.put("nativeCRS", "No native CRS configured for layer");
            }
    } catch (Exception e) {
            LOGGER.log(Level.WARNING,
                    "Error trying to get nativeCRS from "
                    + info.getName()
                    + "FeatureTypeInfo",
                    e
                    );
    }

    String baseUrl = RESTUtils.getBaseURL(request);
    map.put("base", baseUrl);         
   
    //general parameters for data requests
      map.put("name", info.getPrefixedName());
      map.put("srs", info.getSRS());
     
      ReferencedEnvelope bbox = getBBOX(info);
     
      String bboxString = bbox.getMinX() + "," + bbox.getMinY() + "," + bbox.getMaxX() + ","
        + bbox.getMaxY();     
      map.put("bbox", bboxString);
     
      map.put("tilesOrigin", bbox.getMinX()+","+bbox.getMinY());     
     
      int[] imageBox = getMapWidthHeight(bbox);
        map.put("width", imageBox[0]);
        map.put("height", imageBox[1]);
     
        map.put("maxResolution", getMaxResolution(bbox));
       
      try{         
          map.put("boundingBox", info.boundingBox());
          map.put("lonLatBoundingBox", info.getLatLonBoundingBox());
      } catch(Exception e) {
            LOGGER.log(Level.WARNING, "Error trying to access bounding box or lonLatBoundingBox for " + info.getName() + "FeatureTypeInfo", e);
     
     
      //Fields of Access
      map.put("gwc", isGWCAround() + "");
     
      String gwcLink = baseUrl.substring(0,baseUrl.length()-4) + "gwc/";
      map.put("gwcLink", gwcLink);
     
      map.put("attributes", info.getAttributes());
     
      return map;
    }
View Full Code Here

                    "No such namespace: " + namespace,
                    Status.CLIENT_ERROR_NOT_FOUND
                    );
        }

        FeatureTypeInfo featureType = null;
        try {
            featureType = catalog.getFeatureTypeByName(ns, layer);
        } catch(Exception e) {
            throw new RestletException(
                "No such featuretype: " + namespace + ":" + layer,
View Full Code Here

        Rule rule = multipleRulesStyle.getFeatureTypeStyles()[0].getRules()[0];
        LOGGER.info("testing single rule " + rule.getName() + " from style "
            + multipleRulesStyle.getName());

        GetLegendGraphicRequest req = new GetLegendGraphicRequest(getWMS());
        FeatureTypeInfo ftInfo = getCatalog().getFeatureTypeByName(MockData.ROAD_SEGMENTS.getNamespaceURI(), MockData.ROAD_SEGMENTS.getLocalPart());
        req.setLayer(ftInfo.getFeatureType());
        req.setStyle(multipleRulesStyle);
        req.setRule(rule);
        req.setLegendOptions(new HashMap());

        final int HEIGHT_HINT = 30;
View Full Code Here

            if (ns == null) {
                throw new RestletException("No such namespace:" + namespace,
                        Status.CLIENT_ERROR_NOT_FOUND);
            }

            FeatureTypeInfo featureType = null;
            try {
                featureType = catalog.getFeatureTypeByName(ns, layer);
            } catch (NoSuchElementException e) {
                // ignore, handled later
            }

            if (featureType == null) {
                throw new RestletException("No such layer:" + layer,
                        Status.CLIENT_ERROR_NOT_FOUND);
            }

            if (!(Boolean)featureType.getMetadata().get("indexingEnabled")) {
                throw new RestletException("Layer not indexable: " + layer,
                        Status.CLIENT_ERROR_FORBIDDEN);
            }

            // create some kvp and pass through to GetMapKvpreader
View Full Code Here

        String page = request.getAttributes().containsKey("page")
            ? (String) request.getAttributes().get("page")
            : null;

        // Check that layer exists, and that we allow people to index it
        FeatureTypeInfo fti = getCatalog().getFeatureTypeByName(layerName);
        if(fti == null || ! (Boolean)fti.getMetadata().get("indexingEnabled")) {
            response.setStatus(Status.CLIENT_ERROR_FORBIDDEN);
            LOGGER.log(Level.FINE, "not allowed to publish layername: " + layerName);
            //TODO nice error message
            return;
        }
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.