1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.activeinstalls.server

File DataManager.java

 

Code metrics

0
0
0
1
113
10
0
-
-
0
-

Classes

Class Line # Actions
DataManager 34 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.activeinstalls.server;
21   
22    import java.util.Map;
23   
24    import org.xwiki.component.annotation.Role;
25    import com.google.gson.JsonObject;
26   
27    /**
28    * Provides access to stored ping data.
29    *
30    * @version $Id: bd717060125a3f65cbba5f3736e8905f705096be $
31    * @since 5.2M2
32    */
33    @Role
 
34    public interface DataManager
35    {
36    /**
37    * Executes a Search query for Active Installs.
38    *
39    * @param indexType the Elastic Search index type (e.g. "installs" or "installs2". Some XWiki instances may have
40    * sent pings stored under a given index type while other instances may have used another index type (and
41    * thus another data format). We use the index type to match a given data model. The Active Installs Client
42    * module should be checked to understand the data model used.
43    * @param fullQuery the full Elastic Search query used to search for installs. For example:
44    * <pre>{@code
45    * {
46    * "query" : {
47    * "term": { "distributionVersion" : "5.2" }
48    * }
49    * }
50    * }</pre>
51    * @return the parsed JSON result coming from Elastic Search, for example:
52    * <pre>{@code
53    * {
54    * "took": 97,
55    * "timed_out": false,
56    * "_shards": {
57    * "total": 1,
58    * "successful": 1,
59    * "failed": 0
60    * },
61    * "hits": {
62    * "total": 2,
63    * "max_score": 1,
64    * "hits": [
65    * {
66    * "_index": "installs",
67    * "_type": "install",
68    * "_id": "id1",
69    * "_score": 1,
70    * "_source": {
71    * "distributionVersion": "5.2",
72    * ...
73    * }
74    * },
75    * {
76    * "_index": "installs",
77    * "_type": "install",
78    * "_id": "id2",
79    * "_score": 0.625,
80    * "_source": {
81    * "distributionVersion": "5.2-SNAPSHOT",
82    * ...
83    * }
84    * }
85    * ]
86    * }
87    * }
88    * }</pre>
89    * @param parameters the ElasticSearch search parameters to use (see for example
90    * <a href="http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-uri-request.html">
91    * Search URI parameters</a>)
92    * @throws Exception when an error happens while retrieving the data
93    * @since 6.1M1
94    */
95    JsonObject searchInstalls(String indexType, String fullQuery, Map<String, Object> parameters) throws Exception;
96   
97    /**
98    * Executes a Count query for Active Installs.
99    *
100    * @param indexType the Elastic Search index type (e.g. "installs" or "installs2". Some XWiki instances may have
101    * sent pings stored under a given index type while other instances may have used another index type (and
102    * thus another data format). We use the index type to match a given data model. The Active Installs Client
103    * module should be checked to understand the data model used.
104    * @param fullQuery the full Elastic Search query used to search for installs.
105    * @param parameters the ElasticSearch count parameters to use (see for example
106    * <a href="http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-count.html">
107    * Count API</a>)
108    * @return the parsed JSON result coming from Elastic Search
109    * @throws Exception when an error happens while retrieving the data
110    * @since 6.1M1
111    */
112    JsonObject countInstalls(String indexType, String fullQuery, Map<String, Object> parameters) throws Exception;
113    }