Add usagestats statistics
This commit is contained in:
parent
8e91741a6e
commit
0358820465
|
@ -2,7 +2,7 @@ FROM tomcat:7.0.90-jre8
|
|||
MAINTAINER "pkanakakis@di.uoa.gr"
|
||||
RUN ["rm", "-fr", "/usr/local/tomcat/webapps/ROOT"]
|
||||
COPY ./target/uoa-repository-manager-service.war /usr/local/tomcat/webapps/uoa-repository-manager-service.war
|
||||
COPY src/main/resources/dnet-override.properties /usr/local/tomcat/lib/dnet-override.properties
|
||||
COPY src/main/resources/dnet-override-new.properties /usr/local/tomcat/lib/dnet-override.properties
|
||||
#COPY src/main/resources/application.properties /usr/local/tomcat/lib/application.properties
|
||||
#COPY src/main/resources/email-texts.properties /usr/local/tomcat/lib/email-texts.properties
|
||||
VOLUME /var/log/uoa-repository-manager-service:/var/log/uoa-repository-manager-service/
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.dnetlib.repo.manager.service.controllers;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
@ -27,6 +28,9 @@ public class StatsApiImpl implements StatsApi {
|
|||
@Value("${search.api.baseAddress}")
|
||||
private String baseAddress;
|
||||
|
||||
@Value("${search.api.usagestats}")
|
||||
private String usagestatsBaseAddress;
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
LOGGER.debug("Initialization method of statistics api!");
|
||||
|
@ -68,6 +72,7 @@ public class StatsApiImpl implements StatsApi {
|
|||
String publications = getTotalByType("other",baseAddress,"/publications/count");
|
||||
String datasets = getTotalByType("other",baseAddress,"/datasets/count");
|
||||
String software = getTotalByType("other",baseAddress,"/software/count");
|
||||
String usagestats = getUsageStatsTotal();
|
||||
|
||||
|
||||
HashMap<String,String> stats = new HashMap<>();
|
||||
|
@ -79,6 +84,7 @@ public class StatsApiImpl implements StatsApi {
|
|||
stats.put("publications",publications);
|
||||
stats.put("datasets",datasets);
|
||||
stats.put("software",software);
|
||||
stats.put("usagestats",usagestats);
|
||||
|
||||
|
||||
return stats;
|
||||
|
@ -102,4 +108,20 @@ public class StatsApiImpl implements StatsApi {
|
|||
return String.valueOf(new JSONObject(rs).get("total"));
|
||||
|
||||
}
|
||||
|
||||
private String getUsageStatsTotal() throws JSONException {
|
||||
UriComponents uriComponents = UriComponentsBuilder
|
||||
.fromHttpUrl(usagestatsBaseAddress + "/totals")
|
||||
.build().encode();
|
||||
|
||||
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
|
||||
|
||||
JSONArray resultSet = (JSONArray) new JSONObject(rs).getJSONArray("yearly_stats");
|
||||
JSONObject lastYear = resultSet.getJSONObject(resultSet.length()-1);
|
||||
|
||||
Integer downloads = lastYear.getInt("downloads");
|
||||
Integer views = lastYear.getInt("views");
|
||||
|
||||
return String.valueOf(downloads+views);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,10 +67,10 @@ oidc.issuer = https://aai.openaire.eu/oidc/
|
|||
oidc.id = 767422b9-5461-4807-a80a-f9a2072d3a7d
|
||||
oidc.secret = AMQtGlbTXNjwjhF0st28LmM6V0XypMdaVS7tJmGuYFlmH36iIv4t7tVqYuLYrNPkhnZ_GPUJvhymBhFupdgb6aU
|
||||
|
||||
oidc.dev.home = http://koulis.athenarc.gr:4200/uoa-repository-manager-service/openid_connect_login
|
||||
webapp.dev.front = http://koulis.athenarc.gr:4200/landing
|
||||
#oidc.dev.home = http://aleka.athenarc.gr:4200/uoa-repository-manager-service/openid_connect_login
|
||||
#webapp.dev.front = http://aleka.athenarc.gr:4200/landing
|
||||
#oidc.dev.home = http://koulis.athenarc.gr:4200/uoa-repository-manager-service/openid_connect_login
|
||||
#webapp.dev.front = http://koulis.athenarc.gr:4200/landing
|
||||
oidc.dev.home = http://aleka.athenarc.gr:4200/uoa-repository-manager-service/openid_connect_login
|
||||
webapp.dev.front = http://aleka.athenarc.gr:4200/landing
|
||||
|
||||
##REDIS-AAI
|
||||
|
||||
|
@ -90,4 +90,5 @@ services.repomanager.usagestats.adminEmail = pkanakakis@di.uoa.gr
|
|||
services.repomanager.usagestats.sushiliteEndpoint = http://beta.services.openaire.eu/usagestats/sushilite/
|
||||
|
||||
##SEARCH API
|
||||
search.api.baseAddress=https://beta.services.openaire.eu/search/v2/api
|
||||
search.api.baseAddress=https://beta.services.openaire.eu/search/v2/api
|
||||
search.api.usagestats=https://services.openaire.eu/usagestats
|
|
@ -32,7 +32,7 @@
|
|||
<value>classpath*:dnet-site-wizard.properties</value>
|
||||
<value>classpath*:dnet-site-override.properties</value>
|
||||
<value>classpath*:dnet-wizard.properties</value>
|
||||
<value>classpath*:dnet-override.properties</value>
|
||||
<value>classpath*:dnet-override-new.properties</value>
|
||||
<value>classpath*:dnet-validator-wizard.properties</value>
|
||||
<value>classpath*:dnet-validator-override.properties</value>
|
||||
<value>classpath*:dnet-site-force-override.properties</value>
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<value>classpath*:dnet-site-wizard.properties</value>
|
||||
<value>classpath*:dnet-site-override.properties</value>
|
||||
<value>classpath*:dnet-wizard.properties</value>
|
||||
<value>classpath*:dnet-override.properties</value>
|
||||
<value>classpath*:dnet-override-new.properties</value>
|
||||
<value>classpath*:dnet-validator-wizard.properties</value>
|
||||
<value>classpath*:dnet-validator-override.properties</value>
|
||||
<value>classpath*:dnet-site-force-override.properties</value>
|
||||
|
|
Loading…
Reference in New Issue