Revision 53003
Added by Panagiotis Kanakakis over 5 years ago
modules/uoa-repository-manager-service/branches/dev-api/Dockerfile | ||
---|---|---|
1 |
FROM tomcat:8.5-jre8-alpine
|
|
1 |
FROM tomcat:7.0.90-jre8
|
|
2 | 2 |
MAINTAINER "pkanakakis@di.uoa.gr" |
3 | 3 |
RUN ["rm", "-fr", "/usr/local/tomcat/webapps/ROOT"] |
4 | 4 |
COPY ./target/uoa-repository-manager-service.war /usr/local/tomcat/webapps/uoa-repository-manager-service.war |
modules/uoa-repository-manager-service/branches/dev-api/src/test/java/unitest/SushiTest.java | ||
---|---|---|
1 |
package unitest; |
|
2 |
|
|
3 |
import eu.dnetlib.repo.manager.service.controllers.SushiliteApi; |
|
4 |
import org.junit.Test; |
|
5 |
import org.junit.runner.RunWith; |
|
6 |
import org.springframework.beans.factory.annotation.Autowired; |
|
7 |
import org.springframework.test.context.ContextConfiguration; |
|
8 |
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
|
9 |
import org.springframework.test.context.web.WebAppConfiguration; |
|
10 |
|
|
11 |
@RunWith(SpringJUnit4ClassRunner.class) |
|
12 |
@ContextConfiguration(locations = "classpath:applicationContext.xml") |
|
13 |
//@WebAppConfiguration |
|
14 |
public class SushiTest { |
|
15 |
|
|
16 |
@Autowired |
|
17 |
SushiliteApi sushiliteApi; |
|
18 |
|
|
19 |
|
|
20 |
@Test |
|
21 |
public void getReportResults(){ |
|
22 |
System.out.println("test"); |
|
23 |
} |
|
24 |
|
|
25 |
} |
modules/uoa-repository-manager-service/branches/dev-api/src/test/resources/application-context.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" |
|
5 |
xsi:schemaLocation="http://www.springframework.org/schema/beans |
|
6 |
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> |
|
7 |
|
|
8 |
|
|
9 |
<context:annotation-config/> |
|
10 |
<context:component-scan base-package="eu.dnetlib.repo.manager.service.*"/> |
|
11 |
<tx:annotation-driven transaction-manager="txManager"/> |
|
12 |
|
|
13 |
<bean class="eu.dnetlib.repo.manager.service.config.CascadingPropertyLoader" |
|
14 |
id="propertyLoader"> |
|
15 |
<property name="order" value="2"/> |
|
16 |
<property name="properties"> |
|
17 |
<bean class="eu.dnetlib.conf.WebappContextProperyFactory"> |
|
18 |
<property name="propertyFetcher"> |
|
19 |
<bean class="eu.dnetlib.conf.PropertyFetcher"/> |
|
20 |
</property> |
|
21 |
</bean> |
|
22 |
</property> |
|
23 |
<property name="ignoreUnresolvablePlaceholders" value="true"/> |
|
24 |
<property name="locations"> |
|
25 |
<list> |
|
26 |
<value>classpath*:/gr/**/springContext-*.properties</value> |
|
27 |
<value>classpath*:/eu/**/springContext-*.properties</value> |
|
28 |
|
|
29 |
<value>classpath*:/application.properties</value> |
|
30 |
<value>classpath*:/email-texts.properties</value> |
|
31 |
|
|
32 |
<value>classpath*:dnet-site-wizard.properties</value> |
|
33 |
<value>classpath*:dnet-site-override.properties</value> |
|
34 |
<value>classpath*:dnet-wizard.properties</value> |
|
35 |
<value>classpath*:dnet-override.properties</value> |
|
36 |
<value>classpath*:dnet-validator-wizard.properties</value> |
|
37 |
<value>classpath*:dnet-validator-override.properties</value> |
|
38 |
<value>classpath*:dnet-site-force-override.properties</value> |
|
39 |
<value>classpath*:dnet-force-override.properties</value> |
|
40 |
</list> |
|
41 |
</property> |
|
42 |
</bean> |
|
43 |
|
|
44 |
<bean id="repomanager.dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> |
|
45 |
<property name="driverClassName" value="${repomanager.db.driverClassName}" /> |
|
46 |
<property name="url" value="${repomanager.db.url}" /> |
|
47 |
<property name="username" value="${repomanager.db.username}" /> |
|
48 |
<property name="password" value="${repomanager.db.password}" /> |
|
49 |
<property name="maxIdle" value="10" /> |
|
50 |
<property name="maxActive" value="100" /> |
|
51 |
<property name="maxWait" value="10000" /> |
|
52 |
<property name="validationQuery" value="SELECT 1;" /> |
|
53 |
<property name="testOnBorrow" value="true" /> |
|
54 |
<property name="testOnReturn" value="true" /> |
|
55 |
<property name="testWhileIdle" value="true" /> |
|
56 |
<property name="timeBetweenEvictionRunsMillis" value="1200000" /> |
|
57 |
<property name="minEvictableIdleTimeMillis" value="1800000" /> |
|
58 |
<property name="numTestsPerEvictionRun" value="5" /> |
|
59 |
<property name="poolPreparedStatements" value="true" /> |
|
60 |
<property name="defaultAutoCommit" value="true" /> |
|
61 |
</bean> |
|
62 |
|
|
63 |
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> |
|
64 |
<property name="dataSource" ref="repomanager.dataSource"/> |
|
65 |
</bean> |
|
66 |
|
|
67 |
</beans> |
modules/uoa-repository-manager-service/branches/dev-api/src/test/resources/applicationContext.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans xmlns="http://www.springframework.org/schema/beans" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xmlns:tx="http://www.springframework.org/schema/tx" |
|
5 |
xmlns:mvc="http://www.springframework.org/schema/mvc" |
|
6 |
xsi:schemaLocation="http://www.springframework.org/schema/beans |
|
7 |
|
|
8 |
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd |
|
9 |
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd |
|
10 |
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd"> |
|
11 |
|
|
12 |
<import resource="classpath*:/application-context.xml"/> |
|
13 |
|
|
14 |
<import resource="classpath*:/eu/dnetlib/soap/cxf/applicationContext-eprbuilders.xml"/> |
|
15 |
<import resource="classpath*:/eu/dnetlib/clients/ws/springContext-locatorFactory.xml"/> |
|
16 |
<import resource="classpath*:/gr/uoa/di/driver/util/springContext-locators.xml"/> |
|
17 |
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupFactory.xml"/> |
|
18 |
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupClients.xml"/> |
|
19 |
<import resource="classpath*:/eu/dnetlib/enabling/hcm/springContext-hcmService.xml"/> |
|
20 |
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-commons.xml"/> |
|
21 |
|
|
22 |
<!--<import resource="classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml"/>--> |
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
<bean id="maillib" class="eu.dnetlib.utils.MailLibrary" init-method="init"> |
|
28 |
<property name="mailhost" value="${services.validator.mail.host}"/> |
|
29 |
<property name="smtpPort" value="${services.validator.mail.port}"/> |
|
30 |
<property name="authenticate" value="${services.validator.mail.authenticate}"/> |
|
31 |
<property name="username" value="${services.validator.mail.username}"/> |
|
32 |
<property name="password" value="${services.validator.mail.password}"/> |
|
33 |
<property name="from" value="${services.validator.mail.fromAddress}"/> |
|
34 |
<property name="replyTo" value="${services.validator.mail.replyToAddress}"/> |
|
35 |
<property name="mode" value="${services.validator.mail.mode}"/> |
|
36 |
<property name="debug" value="${services.validator.mail.debug}"/> |
|
37 |
</bean> |
|
38 |
|
|
39 |
<bean class="eu.dnetlib.repo.manager.service.config.CascadingPropertyLoader" |
|
40 |
id="propertyLoader"> |
|
41 |
<property name="order" value="2"/> |
|
42 |
<property name="properties"> |
|
43 |
<bean class="eu.dnetlib.conf.WebappContextProperyFactory"> |
|
44 |
<property name="propertyFetcher"> |
|
45 |
<bean class="eu.dnetlib.conf.PropertyFetcher"/> |
|
46 |
</property> |
|
47 |
</bean> |
|
48 |
</property> |
|
49 |
<property name="ignoreUnresolvablePlaceholders" value="true"/> |
|
50 |
<property name="locations"> |
|
51 |
<list> |
|
52 |
<value>classpath*:/gr/**/springContext-*.properties</value> |
|
53 |
<value>classpath*:/eu/**/springContext-*.properties</value> |
|
54 |
|
|
55 |
<value>classpath*:/application.properties</value> |
|
56 |
<value>classpath*:/email-texts.properties</value> |
|
57 |
|
|
58 |
<value>classpath*:dnet-site-wizard.properties</value> |
|
59 |
<value>classpath*:dnet-site-override.properties</value> |
|
60 |
<value>classpath*:dnet-wizard.properties</value> |
|
61 |
<value>classpath*:dnet-override.properties</value> |
|
62 |
<value>classpath*:dnet-validator-wizard.properties</value> |
|
63 |
<value>classpath*:dnet-validator-override.properties</value> |
|
64 |
<value>classpath*:dnet-site-force-override.properties</value> |
|
65 |
<value>classpath*:dnet-force-override.properties</value> |
|
66 |
</list> |
|
67 |
</property> |
|
68 |
</bean> |
|
69 |
|
|
70 |
<bean id="repomanager.dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> |
|
71 |
<property name="driverClassName" value="${repomanager.db.driverClassName}" /> |
|
72 |
<property name="url" value="${repomanager.db.url}" /> |
|
73 |
<property name="username" value="${repomanager.db.username}" /> |
|
74 |
<property name="password" value="${repomanager.db.password}" /> |
|
75 |
<property name="maxIdle" value="10" /> |
|
76 |
<property name="maxActive" value="100" /> |
|
77 |
<property name="maxWait" value="10000" /> |
|
78 |
<property name="validationQuery" value="SELECT 1;" /> |
|
79 |
<property name="testOnBorrow" value="true" /> |
|
80 |
<property name="testOnReturn" value="true" /> |
|
81 |
<property name="testWhileIdle" value="true" /> |
|
82 |
<property name="timeBetweenEvictionRunsMillis" value="1200000" /> |
|
83 |
<property name="minEvictableIdleTimeMillis" value="1800000" /> |
|
84 |
<property name="numTestsPerEvictionRun" value="5" /> |
|
85 |
<property name="poolPreparedStatements" value="true" /> |
|
86 |
<property name="defaultAutoCommit" value="true" /> |
|
87 |
</bean> |
|
88 |
|
|
89 |
<tx:annotation-driven transaction-manager="txManager"/> |
|
90 |
|
|
91 |
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> |
|
92 |
<property name="dataSource" ref="repomanager.dataSource"/> |
|
93 |
</bean> |
|
94 |
|
|
95 |
<mvc:resources mapping="swagger-ui.html" location="classpath:/META-INF/resources/"/> |
|
96 |
<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/> |
|
97 |
<bean class="eu.dnetlib.repo.manager.service.config.SwaggerConfig"/> |
|
98 |
|
|
99 |
</beans> |
modules/uoa-repository-manager-service/branches/dev-api/src/main/java/eu/dnetlib/repo/manager/service/config/FrontEndLinkURIAuthenticationSuccessHandler.java | ||
---|---|---|
3 | 3 |
import com.google.gson.JsonObject; |
4 | 4 |
import org.apache.log4j.Logger; |
5 | 5 |
import org.mitre.openid.connect.model.OIDCAuthenticationToken; |
6 |
import org.springframework.beans.factory.annotation.Value; |
|
6 | 7 |
import org.springframework.security.core.Authentication; |
7 | 8 |
import org.springframework.security.web.authentication.AuthenticationSuccessHandler; |
8 | 9 |
|
... | ... | |
25 | 26 |
LOGGER.debug("Front end uri : " + frontEndURI); |
26 | 27 |
} |
27 | 28 |
|
29 |
|
|
30 |
@Value("${aai.mode}") |
|
31 |
private String aai_mode; |
|
32 |
|
|
28 | 33 |
@Override |
29 | 34 |
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { |
30 | 35 |
|
... | ... | |
59 | 64 |
Cookie openAIREUser = new Cookie("openAIREUser", new Gson().toJson(userInfo) ); |
60 | 65 |
openAIREUser.setMaxAge(14400); |
61 | 66 |
openAIREUser.setPath("/"); |
62 |
// openAIREUser .setDomain(".openaire.eu"); |
|
67 |
if(aai_mode.equalsIgnoreCase("production") || aai_mode.equalsIgnoreCase("beta")) |
|
68 |
openAIREUser .setDomain(".openaire.eu"); |
|
63 | 69 |
// openAIREUser.setDomain(".athenarc.gr"); |
64 | 70 |
response.addCookie(openAIREUser); |
65 | 71 |
|
66 | 72 |
|
67 | 73 |
Cookie accessToken = new Cookie("AccessToken", authOIDC.getAccessTokenValue()); |
68 | 74 |
accessToken.setMaxAge(14400); |
69 |
// accessToken.setDomain(".openaire.eu"); |
|
75 |
if(aai_mode.equalsIgnoreCase("production") || aai_mode.equalsIgnoreCase("beta")) |
|
76 |
accessToken.setDomain(".openaire.eu"); |
|
70 | 77 |
accessToken.setPath("/"); |
71 | 78 |
|
72 | 79 |
// accessToken.setDomain(".athenarc.gr"); |
modules/uoa-repository-manager-service/branches/dev-api/src/main/java/eu/dnetlib/repo/manager/service/config/Config.java | ||
---|---|---|
31 | 31 |
@Value("${redis.password}") |
32 | 32 |
private String password; |
33 | 33 |
|
34 |
@Value("${aai.mode}") |
|
35 |
private String aai_mode; |
|
36 |
|
|
34 | 37 |
@PostConstruct |
35 | 38 |
private void init(){ |
36 | 39 |
LOGGER.info(host); |
... | ... | |
51 | 54 |
DefaultCookieSerializer serializer = new DefaultCookieSerializer(); |
52 | 55 |
serializer.setCookieName("openAIRESession"); |
53 | 56 |
serializer.setCookiePath("/"); |
54 |
// serializer.setDomainName(".openaire.eu"); |
|
57 |
if(aai_mode.equalsIgnoreCase("production") || aai_mode.equalsIgnoreCase("beta")) |
|
58 |
serializer.setDomainName(".openaire.eu"); |
|
55 | 59 |
// serializer.setDomainName(".athenarc.gr"); |
56 | 60 |
LOGGER.info("Serializer : " + serializer); |
57 | 61 |
return serializer; |
modules/uoa-repository-manager-service/branches/dev-api/src/main/java/eu/dnetlib/repo/manager/service/controllers/PiWikApiImpl.java | ||
---|---|---|
73 | 73 |
} |
74 | 74 |
|
75 | 75 |
@Override |
76 |
@PreAuthorize("hasRole('ROLE_ADMIN')") |
|
76 |
@PreAuthorize("hasRole('ROLE_ADMIN') or (hasRole('ROLE_USER') and #piwikInfo.requestorEmail == authentication.userInfo.email)")
|
|
77 | 77 |
public PiwikInfo savePiwikInfo(@RequestBody PiwikInfo piwikInfo) { |
78 | 78 |
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); |
79 | 79 |
jdbcTemplate.update(INSERT_PIWIK_INFO, new Object[]{piwikInfo.getRepositoryId(), piwikInfo.getSiteId(), piwikInfo.getRequestorName(), |
modules/uoa-repository-manager-service/branches/dev-api/src/main/java/eu/dnetlib/repo/manager/service/controllers/SushiliteApi.java | ||
---|---|---|
15 | 15 |
@Api(description = "Sushi-Lite API", tags = {"sushilite"}) |
16 | 16 |
public interface SushiliteApi { |
17 | 17 |
|
18 |
@RequestMapping(value = "/getReportResults", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) |
|
18 |
@RequestMapping(value = "/getReportResults/{page}/{pageSize}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
19 | 19 |
@ResponseBody |
20 | 20 |
ReportResponseWrapper getReportResults(String page, |
21 | 21 |
String pageSize, |
modules/uoa-repository-manager-service/branches/dev-api/src/main/java/eu/dnetlib/repo/manager/service/controllers/StatsApiImpl.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.controllers; |
|
2 |
|
|
3 |
import org.apache.log4j.Logger; |
|
4 |
import org.json.JSONException; |
|
5 |
import org.json.JSONObject; |
|
6 |
import org.springframework.beans.factory.annotation.Value; |
|
7 |
import org.springframework.http.HttpHeaders; |
|
8 |
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; |
|
9 |
import org.springframework.stereotype.Component; |
|
10 |
import org.springframework.web.client.RestTemplate; |
|
11 |
import org.springframework.web.util.UriComponents; |
|
12 |
import org.springframework.web.util.UriComponentsBuilder; |
|
13 |
|
|
14 |
import javax.annotation.PostConstruct; |
|
15 |
import java.util.HashMap; |
|
16 |
import java.util.Map; |
|
17 |
|
|
18 |
@Component |
|
19 |
public class StatsApiImpl implements StatsApi { |
|
20 |
|
|
21 |
private RestTemplate restTemplate = null; |
|
22 |
|
|
23 |
private HttpHeaders httpHeaders; |
|
24 |
|
|
25 |
private static final Logger LOGGER = Logger.getLogger(RepositoryApiImpl.class); |
|
26 |
|
|
27 |
@Value("${search.api.baseAddress}") |
|
28 |
private String baseAddress; |
|
29 |
|
|
30 |
@PostConstruct |
|
31 |
private void init() { |
|
32 |
LOGGER.debug("Initialization method of statistics api!"); |
|
33 |
|
|
34 |
restTemplate = new RestTemplate(); |
|
35 |
restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter()); |
|
36 |
|
|
37 |
httpHeaders = new HttpHeaders(); |
|
38 |
httpHeaders.set("Content-Type", "application/json"); |
|
39 |
} |
|
40 |
|
|
41 |
|
|
42 |
@Override |
|
43 |
public Map<String, String> getStatistics() throws JSONException { |
|
44 |
|
|
45 |
|
|
46 |
String aggregators = getTotalByType("datasource",baseAddress+"/resources", |
|
47 |
"?query= " + |
|
48 |
" oaftype exact datasource and " + |
|
49 |
" ( datasourcetypename exact Institutional Repository Aggregator " + |
|
50 |
" or datasourcetypename exact Publication Repository Aggregator )"); |
|
51 |
|
|
52 |
String dataRepositories = getTotalByType("datasource",baseAddress+"/resources", |
|
53 |
"?query= " + |
|
54 |
" oaftype exact datasource and " + |
|
55 |
" datasourcetypename exact Data Repository " ); |
|
56 |
|
|
57 |
String literature = getTotalByType("datasource",baseAddress+"/resources", |
|
58 |
"?query= " + |
|
59 |
" oaftype exact datasource and " + |
|
60 |
" ( datasourcetypename exact Institutional Repository " + |
|
61 |
" or datasourcetypename exact Publication Repository )"); |
|
62 |
|
|
63 |
String journal = getTotalByType("datasource",baseAddress+"/resources", |
|
64 |
"?query= " + |
|
65 |
" oaftype exact datasource and " + |
|
66 |
" datasourcetypename exact Journal"); |
|
67 |
|
|
68 |
String publications = getTotalByType("other",baseAddress,"/publications/count"); |
|
69 |
String datasets = getTotalByType("other",baseAddress,"/datasets/count"); |
|
70 |
String software = getTotalByType("other",baseAddress,"/software/count"); |
|
71 |
|
|
72 |
|
|
73 |
HashMap<String,String> stats = new HashMap<>(); |
|
74 |
stats.put("aggregators",aggregators); |
|
75 |
stats.put("dataRepositories",dataRepositories); |
|
76 |
stats.put("literature",literature); |
|
77 |
stats.put("journal",journal); |
|
78 |
|
|
79 |
stats.put("publications",publications); |
|
80 |
stats.put("datasets",datasets); |
|
81 |
stats.put("software",software); |
|
82 |
|
|
83 |
|
|
84 |
return stats; |
|
85 |
} |
|
86 |
|
|
87 |
|
|
88 |
private String getTotalByType(String type,String url,String query) throws JSONException { |
|
89 |
UriComponents uriComponents = UriComponentsBuilder |
|
90 |
.fromHttpUrl(url + query) |
|
91 |
.queryParam("page",0) |
|
92 |
.queryParam("size",0) |
|
93 |
.queryParam("format","json") |
|
94 |
.build().encode(); |
|
95 |
|
|
96 |
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class); |
|
97 |
|
|
98 |
if(type.equalsIgnoreCase("datasource")){ |
|
99 |
JSONObject metadata = (JSONObject) new JSONObject(rs).get("meta"); |
|
100 |
return String.valueOf(metadata.get("total")); |
|
101 |
}else |
|
102 |
return String.valueOf(new JSONObject(rs).get("total")); |
|
103 |
|
|
104 |
} |
|
105 |
} |
modules/uoa-repository-manager-service/branches/dev-api/src/main/java/eu/dnetlib/repo/manager/service/controllers/SushiliteApiImpl.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.repo.manager.service.controllers; |
2 | 2 |
|
3 |
import com.fasterxml.jackson.databind.ObjectMapper; |
|
4 |
import com.google.gson.Gson; |
|
5 | 3 |
import eu.dnetlib.usagestats.sushilite.domain.ReportItem; |
6 |
import eu.dnetlib.usagestats.sushilite.domain.ReportResponse; |
|
7 | 4 |
import eu.dnetlib.usagestats.sushilite.domain.ReportResponseWrapper; |
8 |
import org.json.JSONException; |
|
9 | 5 |
import org.springframework.beans.factory.annotation.Autowired; |
10 | 6 |
import org.springframework.beans.factory.annotation.Value; |
11 | 7 |
import org.springframework.core.ParameterizedTypeReference; |
12 |
import org.springframework.http.HttpEntity; |
|
13 |
import org.springframework.http.HttpHeaders; |
|
14 | 8 |
import org.springframework.http.HttpMethod; |
15 | 9 |
import org.springframework.http.ResponseEntity; |
16 | 10 |
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; |
modules/uoa-repository-manager-service/branches/dev-api/src/main/java/eu/dnetlib/repo/manager/service/controllers/StatsApi.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.controllers; |
|
2 |
|
|
3 |
import io.swagger.annotations.Api; |
|
4 |
import org.json.JSONException; |
|
5 |
import org.springframework.http.MediaType; |
|
6 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
7 |
import org.springframework.web.bind.annotation.RequestMethod; |
|
8 |
import org.springframework.web.bind.annotation.ResponseBody; |
|
9 |
import org.springframework.web.bind.annotation.RestController; |
|
10 |
|
|
11 |
import java.util.Map; |
|
12 |
|
|
13 |
@RestController |
|
14 |
@RequestMapping(value = "/stats") |
|
15 |
@Api(description = "Stats API", tags = {"statistics"}) |
|
16 |
public interface StatsApi { |
|
17 |
|
|
18 |
|
|
19 |
@RequestMapping(value = "/getStatistics" , method = RequestMethod.GET, |
|
20 |
produces = MediaType.APPLICATION_JSON_VALUE) |
|
21 |
@ResponseBody |
|
22 |
Map<String, String> getStatistics() throws JSONException; |
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
} |
modules/uoa-repository-manager-service/branches/dev-api/src/main/java/eu/dnetlib/repo/manager/service/controllers/RepositoryApiImpl.java | ||
---|---|---|
24 | 24 |
import org.springframework.http.HttpMethod; |
25 | 25 |
import org.springframework.http.ResponseEntity; |
26 | 26 |
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; |
27 |
import org.springframework.security.access.annotation.Secured; |
|
28 |
import org.springframework.security.access.prepost.PostAuthorize; |
|
29 | 27 |
import org.springframework.security.access.prepost.PreAuthorize; |
30 | 28 |
import org.springframework.stereotype.Component; |
31 | 29 |
import org.springframework.web.bind.annotation.PathVariable; |
... | ... | |
40 | 38 |
import java.sql.Timestamp; |
41 | 39 |
import java.util.*; |
42 | 40 |
import java.util.concurrent.ConcurrentHashMap; |
43 |
import java.util.function.Function; |
|
44 | 41 |
import java.util.stream.Collectors; |
45 | 42 |
|
46 | 43 |
@Component |
modules/uoa-repository-manager-service/branches/dev-api/src/main/resources/application.properties | ||
---|---|---|
1 | 1 |
infrastructure.name=integration |
2 |
# |
|
2 |
|
|
3 | 3 |
## Container properties |
4 | 4 |
container.hostname=aleka.athenarc.gr |
5 | 5 |
container.context=uoa-repository-manager-service |
6 | 6 |
container.port = 8480 |
7 |
# |
|
7 |
|
|
8 | 8 |
## IS |
9 |
ISLookUpService.url = http://node6.t.openaire.research-infrastructures.eu/is/services/isLookUp |
|
10 |
ISRegistryService.url = http://node6.t.openaire.research-infrastructures.eu/is/services/isRegistry |
|
11 |
ISSNService.url = http://node6.t.openaire.research-infrastructures.eu/is/services/isSN |
|
12 |
# |
|
13 |
# |
|
9 |
#ISLookUpService.url = http://node6.t.openaire.research-infrastructures.eu/is/services/isLookUp |
|
10 |
#ISRegistryService.url = http://node6.t.openaire.research-infrastructures.eu/is/services/isRegistry |
|
11 |
#ISSNService.url = http://node6.t.openaire.research-infrastructures.eu/is/services/isSN |
|
12 |
|
|
13 |
IS.url = https://dev-openaire.d4science.org/is/services |
|
14 |
ISLookUpService.url = ${IS.url}/isLookUp |
|
15 |
ISRegistryService.url = ${IS.url}/isRegistry |
|
16 |
ISSNService.url = ${IS.url}/services/isSN |
|
17 |
|
|
18 |
|
|
14 | 19 |
ValidatorService.url=http://adonis.athenarc.gr:8080/validator-service/services/validatorWebService |
15 |
# |
|
20 |
|
|
16 | 21 |
## Broker Service |
17 | 22 |
services.broker.url = http://broker1-dev-dnet.d4science.org |
18 | 23 |
services.broker.port = 8080 |
19 | 24 |
services.broker.api = api/ |
20 | 25 |
services.broker.openaire = openaireBroker |
21 |
# |
|
22 |
# |
|
26 |
|
|
27 |
|
|
23 | 28 |
api.baseAddress=https://dev-openaire.d4science.org/openaire |
24 | 29 |
##api.baseAddress=http://beta.services.openaire.eu:8080/openaire |
25 |
# |
|
30 |
|
|
26 | 31 |
service.repository-rest-api.baseUrl =http://${container.hostname}:${container.port} |
27 | 32 |
services.repo-manager.baseUrl = http://${container.hostname}:${container.port}/${container.context} |
28 |
# |
|
33 |
|
|
29 | 34 |
transport.soap.baseAddress = http://${container.hostname}:${container.port}/${container.context} |
30 | 35 |
transport.soap.force.local.address = false |
31 |
# |
|
36 |
|
|
32 | 37 |
services.repo-manager.adminEmail = pkanakakis@di.uoa.gr |
33 | 38 |
services.repo-manager.repository.testing.mode = false |
34 | 39 |
services.repo-manager.deploy.environment = development |
... | ... | |
45 | 50 |
services.validator.mail.debug = false |
46 | 51 |
services.validator.mail.overrideEmail = pkanakakis@di.uoa.gr |
47 | 52 |
services.validator.mail.specialRecipients = pkanakakis@di.uoa.gr |
48 |
# |
|
53 |
|
|
49 | 54 |
services.validator.repoRegistration.override = pkanakakis@di.uoa.gr |
50 |
# |
|
51 |
# |
|
55 |
|
|
56 |
|
|
52 | 57 |
repomanager.db.driverClassName = org.postgresql.Driver |
53 | 58 |
repomanager.db.url = jdbc:postgresql://194.177.192.119:5432/repomanager |
54 | 59 |
repomanager.db.username = dnet |
55 | 60 |
repomanager.db.password = dnetPwd |
56 |
# |
|
61 |
|
|
57 | 62 |
services.repomanager.analyticsURL = http://analytics.openaire.eu/addsite.php? |
58 |
# |
|
63 |
|
|
59 | 64 |
topic_types.url = https://beta.services.openaire.eu/provision/mvc/vocabularies/dnet:topic_types.json |
60 |
# |
|
65 |
|
|
61 | 66 |
oidc.issuer = https://aai.openaire.eu/oidc/ |
62 | 67 |
oidc.id = 767422b9-5461-4807-a80a-f9a2072d3a7d |
63 | 68 |
oidc.secret = AMQtGlbTXNjwjhF0st28LmM6V0XypMdaVS7tJmGuYFlmH36iIv4t7tVqYuLYrNPkhnZ_GPUJvhymBhFupdgb6aU |
64 |
# |
|
65 |
#oidc.dev.home = http://koulis.athenarc.gr:4200/uoa-repository-manager-service/openid_connect_login |
|
66 |
#webapp.dev.front = http://koulis.athenarc.gr:4200/landing |
|
67 |
oidc.dev.home = http://aleka.athenarc.gr:4200/uoa-repository-manager-service/openid_connect_login |
|
68 |
webapp.dev.front = http://aleka.athenarc.gr:4200/landing |
|
69 |
# |
|
69 |
|
|
70 |
oidc.dev.home = http://koulis.athenarc.gr:4200/uoa-repository-manager-service/openid_connect_login |
|
71 |
webapp.dev.front = http://koulis.athenarc.gr:4200/landing |
|
72 |
#oidc.dev.home = http://aleka.athenarc.gr:4200/uoa-repository-manager-service/openid_connect_login |
|
73 |
#webapp.dev.front = http://aleka.athenarc.gr:4200/landing |
|
74 |
|
|
75 |
##REDIS-AAI |
|
76 |
|
|
70 | 77 |
redis.host = audrey.athenarc.gr |
71 | 78 |
redis.port = 6379 |
72 | 79 |
redis.password = E#Szvnidd |
73 |
# |
|
80 |
aai.mode = develop |
|
81 |
|
|
82 |
|
|
83 |
|
|
74 | 84 |
services.repomanager.usageStatisticsDiagramsBaseURL = https://beta.openaire.eu/stats3/ |
75 | 85 |
services.repomanager.usageStatisticsNumbersBaseURL = https://beta.services.openaire.eu/usagestats/datasources/ |
76 | 86 |
services.repomanager.usagestats.adminEmail = pkanakakis@di.uoa.gr |
77 | 87 |
|
78 | 88 |
|
89 |
##SUSHI |
|
90 |
services.repomanager.usagestats.sushiliteEndpoint = http://beta.services.openaire.eu/usagestats/sushilite/ |
|
91 |
|
|
92 |
##SEARCH API |
|
93 |
search.api.baseAddress=https://beta.services.openaire.eu/search/v2/api |
modules/uoa-repository-manager-service/branches/dev-api/src/main/webapp/WEB-INF/applicationContext.xml | ||
---|---|---|
19 | 19 |
<import resource="classpath*:/eu/dnetlib/enabling/hcm/springContext-hcmService.xml"/> |
20 | 20 |
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-commons.xml"/> |
21 | 21 |
|
22 |
<!--<import resource="classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml"/>--> |
|
22 | 23 |
|
23 | 24 |
|
25 |
|
|
26 |
|
|
24 | 27 |
<bean id="maillib" class="eu.dnetlib.utils.MailLibrary" init-method="init"> |
25 | 28 |
<property name="mailhost" value="${services.validator.mail.host}"/> |
26 | 29 |
<property name="smtpPort" value="${services.validator.mail.port}"/> |
modules/uoa-repository-manager-service/branches/dev-api/pom.xml | ||
---|---|---|
68 | 68 |
|
69 | 69 |
<dependency> |
70 | 70 |
<groupId>eu.dnetlib</groupId> |
71 |
<artifactId>dnet-openaire-usage-stats-api</artifactId>
|
|
72 |
<version>2.0.2-SNAPSHOT</version>
|
|
71 |
<artifactId>dnet-openaire-usage-stats-sushilite</artifactId>
|
|
72 |
<version>1.0.0-SNAPSHOT</version>
|
|
73 | 73 |
</dependency> |
74 | 74 |
|
75 |
|
|
75 | 76 |
<dependency> |
76 | 77 |
<groupId>cglib</groupId> |
77 | 78 |
<artifactId>cglib-nodep</artifactId> |
Also available in: Unified diff
1. Add env var for cookies 2. Add sushi controllers 3. Bug fix on piwik/repo 4. Add stats controllers/service