Package org.geoserver.catalog

Examples of org.geoserver.catalog.ResourceInfo


        final ImportTask task = imp.task(t);
        if (task == null) {
            throw new NotFoundException("No such task: " + t + " for import: " + id);
        }

        ResourceInfo resource = task.getLayer().getResource();

        if (task.getState() == ImportTask.State.NO_CRS) {
            JSONObj proj = obj.object("proj");
            if (proj == null) {
                throw new BadRequestException("Request must contain a 'proj' property");
            }

            try {
                resource.setSRS(IO.srs(proj));
                resource.setNativeCRS(IO.crs(proj));
                importer.changed(task);
            }
            catch(Exception e) {
                throw new BadRequestException("Unable to parse proj: " + proj.toString());
            }
View Full Code Here


        recent.add(LayerGroupInfo.class, map);
        return mapDetails(new JSONObj(), map, wsName, req);
    }

    void updateBounds(ReferencedEnvelope bounds, LayerInfo layer) throws Exception {
        ResourceInfo r = layer.getResource();
        if (r.boundingBox() != null && CRS.equalsIgnoreMetadata(bounds.getCoordinateReferenceSystem(), r.getCRS())) {
            bounds.include(r.boundingBox());
        }
        else {
            bounds.include(r.getLatLonBoundingBox().transform(bounds.getCoordinateReferenceSystem(), true));
        }
    }
View Full Code Here

        if (l instanceof LayerInfo) {
            LayerInfo info = (LayerInfo) l;
           
            IO.layer(obj, info, req);
           
            ResourceInfo r = info.getResource();
            String wsName = r.getNamespace().getPrefix();
//            obj.put("workspace", wsName);
//            obj.put("name", info.getName());
            obj.put("url",IO.url(req,"/layers/%s/%s",wsName,r.getName()));
//            obj.put("title", IO.title(info));
//            obj.put("description", IO.description(info));
//            obj.put("type",IO.Type.of(info.getResource()).toString());
            StoreInfo store = r.getStore();
            obj.putObject("resource")
                .put("name",r.getNativeName())
                .put("workspace",wsName)
                .put("store",store.getName())
                    .put("url",
                         IO.url(req, "/stores/%s/%s/%s", wsName, store.getName(),r.getNativeName())
                );
           
        } else if (l instanceof LayerGroupInfo) {
            LayerGroupInfo group = (LayerGroupInfo) l;
           
View Full Code Here

        Filter filter = and(equal("store", store), equal("namespace.prefix", ws.getName()));
        int count=0;
        try (CloseableIterator<ResourceInfo> layers = cat.list(ResourceInfo.class, filter);) {
            while (layers.hasNext()) {
                ResourceInfo r = layers.next();
                for (LayerInfo l : cat.getLayers(r)) {
                    if (l != null) {
                        count++;
                    }
                }
View Full Code Here

        WorkspaceInfo ws = store.getWorkspace();

        Filter filter = and(equal("store", store), equal("namespace.prefix", ws.getName()));
        try (CloseableIterator<ResourceInfo> layers = cat.list(ResourceInfo.class, filter);) {
            while (layers.hasNext()) {
                ResourceInfo r = layers.next();
                for (LayerInfo l : cat.getLayers(r)) {
                    layer(list.addObject(), l,true);
                }
            }
        }
View Full Code Here

            Filter filter = and(equal("namespace.prefix", store.getWorkspace().getName()),equal("nativeName", name));
            try (
                CloseableIterator<ResourceInfo> published = cat.list(ResourceInfo.class, filter);
            ) {
                while (published.hasNext()) {
                    ResourceInfo info = published.next();
                    if (!info.getStore().getId().equals(store.getId())) {
                        continue; // native name is not enough, double check store id
                    }
                    layers( info, layers );
                }
            }
View Full Code Here

            LayerInfo layerInfo = catalog.getLayerByName(localName);
            if(layerInfo == null){
                log.info("Can't find layer " + localName + ". Cache not truncated");
                throw new NoSuchElementException("Layer not found: " + localName);
            }
            ResourceInfo resource = layerInfo.getResource();
            layerName = resource.getPrefixedName();
        }

        return layerName;
    }
View Full Code Here

     *
     * @param li
     * @return
     */
    public TileLayer createLayer(LayerInfo li) {
        final ResourceInfo resourceInfno = li.getResource();
        final String layerName = resourceInfno.getPrefixedName();
        final String[] wmsURL = getWMSUrl();
        final String wmsStyles = null;
        final String wmsLayers = resourceInfno.getPrefixedName();
        ReferencedEnvelope latLonBounds = resourceInfno.getLatLonBoundingBox();
        if (latLonBounds == null) {
            log.severe("LatLonBoundingBox of " + li.getName()
                    + " is null, can't create a tile layer for it");
            return null;
        }
View Full Code Here

        }

        if (featureType != null) {
            final Name name = featureType.getName();

            ResourceInfo ri = wms.getResourceInfo(name);
            if (ri != null) {
                templateLoader.setResource(ri);
            } else {
                throw new IllegalArgumentException("Can't find neither a FeatureType nor "
                        + "a CoverageInfo or WMSLayerInfo named " + name);
View Full Code Here

      if (property != null && property.length() > 0) {
        /* First try to find as a FeatureType */
        try {
          LayerInfo layerInfo = catalog.getLayerByName(layerName);
          if (layerInfo != null) {
            ResourceInfo obj = layerInfo.getResource();
            /* Check if it's feature type or coverage */
            if (obj instanceof FeatureTypeInfo) {
              FeatureType ftType = ((FeatureTypeInfo) obj).getFeatureType();
              FeatureCollection ftCollection = ((FeatureTypeInfo) obj).getFeatureSource(new NullProgressListener(), null).getFeatures();
              List<Rule> rules = null;
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.ResourceInfo

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.