Package com.boundlessgeo.geoserver.json

Examples of com.boundlessgeo.geoserver.json.JSONArr


    }
   
    @RequestMapping(value="/recent", method = RequestMethod.GET)
    public @ResponseBody JSONArr recent(HttpServletRequest req) {
        Catalog cat = geoServer.getCatalog();
        JSONArr arr = new JSONArr();
       
        for (Ref ref : recent.list(LayerInfo.class)) {
            LayerInfo layer = cat.getLayer(ref.id);
            IO.layer(arr.addObject(), layer, req);
        }
        return arr;
    }
View Full Code Here


        super(geoServer);
    }

    @RequestMapping(method = RequestMethod.GET)
    public @ResponseBody JSONArr list() {
        JSONArr list = new JSONArr();
        for (DataFormat<?> format : formats()) {
            encode(list.addObject(), format);
        }

        return list;
    }
View Full Code Here

            JSONObj obj = encode(new JSONObj(), g);

            obj.put("vendor", g.real.getVendor())
               .put("version", g.real.getVersion());

            JSONArr connection = obj.putArray("params");
            IO.param(connection.addObject(), g.real);

            return obj;
        }

        DataFormat<Class<?>> s = findServiceFormat(name);
View Full Code Here

        obj.putObject("service")
           .put("title", settings.getTitle());

        JSONObj services = obj.putObject("services");
        for (ServiceInfo service : geoServer.getServices()) {
            JSONArr versions = services.putObject(service.getName())
               .put("title", service.getTitle())
               .putArray("versions");

            for (Version ver : service.getVersions()) {
                versions.add(ver.toString());
            }
        }

        Catalog cat = geoServer.getCatalog();
        obj.put("workspaces", cat.count(WorkspaceInfo.class, Filter.INCLUDE))
           .put("layers", cat.count(LayerInfo.class, Filter.INCLUDE))
           .put("maps", cat.count(LayerGroupInfo.class, Filter.INCLUDE));

        JSONObj cache = obj.putObject("recent");

        JSONArr recentMaps = cache.putArray("maps");
        for (Ref ref : recent.list(LayerGroupInfo.class)) {
            IO.ref(recentMaps.addObject(), ref);
        }

        return obj;
    }
View Full Code Here

        ImportContext imp = findImport(id);

        JSONObj result = new JSONObj();
        result.put("id", imp.getId());

        JSONArr imported = result.putArray("imported");
        JSONArr pending = result.putArray("pending");
        JSONArr failed = result.putArray("failed");
        JSONArr ignored = result.putArray("ignored");

        for (ImportTask task : imp.getTasks()) {
            if (task.getState() == ImportTask.State.COMPLETE) {
                imported.add(complete(task));
            }
            else {
                switch(task.getState()) {
                    case NO_BOUNDS:
                    case NO_CRS:
                        pending.add(pending(task));
                        // fixable state, throw into pending
                        break;
                    case ERROR:
                        // error, dump out some details
                        failed.add(failed(task));
                        break;
                    default:
                        // ignore this task
                        ignored.add(ignored(task));
                }
            }
        }

        return result;
View Full Code Here

        return mapDetails(new JSONObj(), map, wsName, req);
    }
   
    @RequestMapping(value="/{wsName}", method = RequestMethod.GET)
    public @ResponseBody JSONArr list(@PathVariable String wsName) {
        JSONArr arr = new JSONArr();

        Catalog cat = geoServer.getCatalog();

        if ("default".equals(wsName)) {
            WorkspaceInfo def = cat.getDefaultWorkspace();
            if (def != null) {
                wsName = def.getName();
            }
        }

        CloseableIterator<LayerGroupInfo> it = cat.list(LayerGroupInfo.class, equal("workspace.name", wsName));
        try {
            while (it.hasNext()) {
                LayerGroupInfo map = it.next();
                if( checkMap( map ) ){
                    JSONObj obj = arr.addObject();
                    map(obj, map, wsName);
                }
            }
        }
        finally {
View Full Code Here

        }
        return arr;
    }
   
    private JSONArr mapLayerList(LayerGroupInfo map, HttpServletRequest req){
        JSONArr arr = new JSONArr();
        for (PublishedInfo l : Lists.reverse(map.getLayers())) {
            layer(arr.addObject(), l, req);
        }
        return arr;
    }
View Full Code Here

        return obj;
    }
   
    @RequestMapping(value="/recent", method = RequestMethod.GET)
    public @ResponseBody JSONArr plistRecentMaps() {
        JSONArr arr = new JSONArr();
        Catalog cat = geoServer.getCatalog();

        for (Ref ref : recent.list(LayerGroupInfo.class)) {
            LayerGroupInfo map = cat.getLayerGroup(ref.id);
            if( checkMap( map ) ){
                JSONObj obj = arr.addObject();
                map(obj, map, map.getWorkspace().getName());
            }
        }
        return arr;
    }
View Full Code Here

    /** Complete map description suitable for editing. */
    JSONObj mapDetails(JSONObj obj, LayerGroupInfo map, String wsName, HttpServletRequest req) {
        map(obj,map,wsName);
       
        List<PublishedInfo> published = Lists.reverse(map.getLayers());
        JSONArr layers = obj.putArray("layers");
        for (PublishedInfo l : published) {
            layer(layers.addObject(), l, req);
        }
        return obj;
    }
View Full Code Here

    }

    @RequestMapping(method = RequestMethod.GET)
    public @ResponseBody
    JSONArr list() {
        JSONArr arr = new JSONArr();

        Catalog cat = geoServer.getCatalog();

        WorkspaceInfo def = cat.getDefaultWorkspace();
        if (def != null) {
           workspace(arr.addObject(), def, namespaceFor(def), true);
        }

        try (
            CloseableIterator<WorkspaceInfo> list = cat.list(WorkspaceInfo.class, Predicates.acceptAll());
        ) {
            while(list.hasNext()) {
                WorkspaceInfo ws = list.next();
                if (def != null && ws.getName().equals(def.getName())) {
                    continue;
                }

                NamespaceInfo ns = namespaceFor(ws);
                workspace(arr.addObject(), ws, ns, false);
            }
        }

        return arr;
    }
View Full Code Here

TOP

Related Classes of com.boundlessgeo.geoserver.json.JSONArr

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.