Package org.geoserver.monitor

Examples of org.geoserver.monitor.Query


    }
   
    @Override
    protected Map<String, Integer> gatherData(Monitor monitor) {
        DataGatherer g = new DataGatherer();
        monitor.query(new Query().properties("operation")
            .filter("service", owsService, Comparison.EQ), g);
       
        return g.getData();
    }
View Full Code Here


        static final Property<RequestData> STATUS = new BeanProperty("status", "status");
       
        @Override
        protected List<RequestData> getItems() {
            MonitorDAO dao = getApplication().getBeanOfType(Monitor.class).getDAO();
            Query q = new Query().filter("status",
                Arrays.asList(Status.RUNNING, Status.WAITING, Status.CANCELLING), Comparison.IN);
           
            return dao.getRequests(q);
        }
View Full Code Here

            }
        });
    }
   
    BufferedDynamicImageResource queryAndRenderChart(Monitor monitor, Date[] range) {
        Query q = new Query();
        q.properties("startTime").between(range[0], range[1]);
       
        DataGatherer gatherer = new DataGatherer();
        monitor.query(q, gatherer);
       
        HashMap<RegularTimePeriod,Integer> data = gatherer.getData();
View Full Code Here

           
            // date range
            String from = form.getFirstValue("from");
            String to = form.getFirstValue("to");

            Query q = new Query().between(
                from != null ? parseDate(from) : null,
                to != null ? parseDate(to) : null);
           
            //filter
            String filter = form.getFirstValue("filter");
            if (filter != null) {
                try {
                    parseFilter(filter, q);
                }
                catch(Exception e) {
                    throw new RestletException("Error parsing filter " + filter,
                        Status.CLIENT_ERROR_BAD_REQUEST, e);
                }
            }
           
            //sorting
            String sortBy;
            SortOrder sortOrder;
           
            String order = form.getFirstValue("order");
            if (order != null) {
                int semi = order.indexOf(';');
                if (semi != -1) {
                    String[] split = order.split(";");
                    sortBy = split[0];
                    sortOrder = SortOrder.valueOf(split[1]);
                }
                else {
                    sortBy = order;
                    sortOrder = SortOrder.ASC;
                }
               
                q.sort(sortBy, sortOrder);
            }
           
            //limit offset
            String offset = form.getFirstValue("offset");
            String count = form.getFirstValue("count");
            q.page(offset != null ? Long.parseLong(offset) : null,
                count != null ? Long.parseLong(count) : null);
           
            //live?
            String live = form.getFirstValue("live");
            if (live != null) {
                if ("yes".equalsIgnoreCase(live) || "true".equalsIgnoreCase(live)) {
                    q.filter("status", Arrays.asList(
                        org.geoserver.monitor.RequestData.Status.RUNNING,
                        org.geoserver.monitor.RequestData.Status.WAITING,
                        org.geoserver.monitor.RequestData.Status.CANCELLING), Comparison.IN);
                }
                else {
                    q.filter("status", Arrays.asList(
                        org.geoserver.monitor.RequestData.Status.FINISHED,
                        org.geoserver.monitor.RequestData.Status.FAILED), Comparison.IN);
                }
            }
           
View Full Code Here

        return "OWS Request Summary";
    }
   
    @Override
    protected Map<String,Integer> gatherData(Monitor monitor) {
        Query q = new Query();
        q.properties("service").filter("service", null, Comparison.NEQ);
       
        DataGatherer g = new DataGatherer();
        monitor.query(q, g);
       
        return g.getData();
View Full Code Here

            HibUtil.setUpSession(sessionFactory);
        }
       
        try {
            //clear out any requests that were left in an inconsistent state
            Query query = new Query().filter("status",
                Arrays.asList(Status.RUNNING, Status.WAITING, Status.CANCELLING), Comparison.IN);
            for (RequestData data : monitor.getDAO().getRequests(query)) {
                if (InternalHostname.get().equals(data.getInternalHost())) {
                    //mark start as INTERRUPTED
                    data.setStatus(Status.INTERRUPTED);
View Full Code Here

    public void testGetAll() throws Exception {
        Request req = new Request();
        Response res = new Response(req);
       
        resource.init(null, req, res);
        Query q = (Query) resource.handleObjectGet();
       
        assertEquals(monitor.getDAO().getRequests().size(),
            monitor.getDAO().getRequests(q).size());
    }
View Full Code Here

    public void testGetAllCSVQuery() throws Exception {
        RequestResource.CSVFormat format = new RequestResource.CSVFormat(
                new String[]{"id", "path", "startTime"}, monitor);
       
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        format.toRepresentation(new Query()).write(out);
       
        BufferedReader in = new BufferedReader(new InputStreamReader(
            new ByteArrayInputStream(out.toByteArray())));
        String line = in.readLine();
        assertEquals("id,path,startTime", line);
View Full Code Here

        setKVP(req, "from", "2010-07-23T15:56:44", "to", "2010-07-23T16:16:44");
       
        Response res = new Response(req);
        resource.init(null, req, res);
       
        Query q = (Query) resource.handleObjectGet();
        List<RequestData> datas = (List<RequestData>) monitor.getDAO().getRequests(q);
       
        assertCoveredInOrder(datas, 6, 5, 4);
    }
View Full Code Here

        setKVP(req, "from", "2010-07-23T15:56:44+0000", "to", "2010-07-23T16:16:44+0000");
       
        Response res = new Response(req);
        resource.init(null, req, res);
       
        Query q = (Query) resource.handleObjectGet();
        List<RequestData> datas = (List<RequestData>) monitor.getDAO().getRequests(q);
       
        assertCoveredInOrder(datas, 6, 5, 4);
    }
View Full Code Here

TOP

Related Classes of org.geoserver.monitor.Query

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.