Project

General

Profile

« Previous | Next » 

Revision 59335

branch no longer needed

View differences:

modules/uoa-repository-manager-service/branches/newmodel/Dockerfile
1
FROM tomcat:7.0.90-jre8
2
MAINTAINER "pkanakakis@di.uoa.gr"
3
RUN ["rm", "-fr", "/usr/local/tomcat/webapps/ROOT"]
4
COPY ./target/uoa-repository-manager-service.war /usr/local/tomcat/webapps/uoa-repository-manager-service.war
5
#COPY src/main/resources/dnet-override-new.properties /usr/local/tomcat/lib/dnet-override.properties
6
COPY src/main/resources/application.properties /usr/local/tomcat/lib/dnet-override.properties
7
#COPY src/main/resources/application.properties /usr/local/tomcat/lib/application.properties
8
#COPY src/main/resources/email-texts.properties /usr/local/tomcat/lib/email-texts.properties
9
VOLUME /var/log/uoa-repository-manager-service:/var/log/uoa-repository-manager-service/
10
CMD ["catalina.sh", "run"]
11

  
modules/uoa-repository-manager-service/branches/newmodel/src/test/java/unitest/PiwikTest.java
1
/*
2
package unitest;
3

  
4
import com.fasterxml.jackson.databind.ObjectMapper;
5
import eu.dnetlib.repo.manager.config.RepoManagerContextLoaderListener;
6
import org.apache.commons.lang.StringEscapeUtils;
7
import org.junit.Test;
8
import org.junit.runner.RunWith;
9
import org.springframework.context.annotation.ComponentScan;
10
import org.springframework.test.context.ContextConfiguration;
11
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
12

  
13
import java.io.IOException;
14
import java.io.UnsupportedEncodingException;
15
import java.net.URL;
16
import java.net.URLEncoder;
17
import java.util.Map;
18

  
19
@RunWith(SpringJUnit4ClassRunner.class)
20
@ContextConfiguration(classes = RepoManagerContextLoaderListener.class)
21
public class PiwikTest {
22

  
23
    String analyticsURL = "https://analytics.openaire.eu/addsite.php?";
24

  
25
    @Test
26
    public void enableMetricsRepo1(){
27

  
28
        String officialName = "BỘ SƯU TẬP SỐ";
29
        String repoWebsite = "http://www.vnulib.edu.vn:8000/dspace/";
30

  
31
        enableMetrics(officialName, repoWebsite, analyticsURL);
32

  
33
    }
34

  
35
    @Test
36
    public void enableMetricsRepo2(){
37

  
38
        String officialName = "ILC4CLARIN repository of language resources and tools";
39
        String repoWebsite = "https://dspace-clarin-it.ilc.cnr.it/repository/xmlui";
40

  
41
        enableMetrics(officialName, repoWebsite, analyticsURL);
42
    }
43

  
44
    @Test
45
    public void enableMetricsRepo3(){
46

  
47
        String officialName = "ANSTO Publications Online";
48
        String repoWebsite = "http://apo.ansto.gov.au/dspace/";
49

  
50
        enableMetrics(officialName, repoWebsite, analyticsURL);
51
    }
52

  
53
    private void enableMetrics(String officialName, String repoWebsite, String analyticsURL) {
54
        String url;
55
        try {
56
            url = analyticsURL + "siteName=" + URLEncoder.encode(officialName, "UTF-8") + "&url="
57
                    + URLEncoder.encode(repoWebsite, "UTF-8");
58
            url = StringEscapeUtils.escapeJava(url);
59

  
60
            Map map = null;
61
            String siteId = null;
62

  
63
            URL u = new URL(url);
64
            map = new ObjectMapper().readValue(u, Map.class);
65
            if(map.get("value")!=null) {
66
                siteId = map.get("value").toString();
67
            }
68
        } catch (Exception e) {
69
            e.printStackTrace();
70
        }
71
    }
72
}*/
modules/uoa-repository-manager-service/branches/newmodel/src/test/java/unitest/ValidatorTest.java
1
//package unitest;
2
//
3
//import eu.dnetlib.repo.manager.config.RepoManagerContextLoaderListener;
4
//import eu.dnetlib.repo.manager.utils.OaiTools;
5
//import org.junit.Test;
6
//import org.junit.runner.RunWith;
7
//import org.springframework.test.context.ContextConfiguration;
8
//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
9
//
10
//@RunWith(SpringJUnit4ClassRunner.class)
11
//@ContextConfiguration(classes = RepoManagerContextLoaderListener.class)
12
////@WebAppConfiguration
13
//public class ValidatorTest {
14
//
15
//
16
//    @Test
17
//    public void identiFy(){
18
//
19
//        String url = "https://repozitorij.srce.unizg.hr/oai";
20
//
21
//
22
//        System.out.println("Identify repository with url : " + url);
23
//        try {
24
//            System.out.println(OaiTools.identifyRepository(url));
25
//        } catch (Exception e) {
26
//            System.out.println(e);
27
//        }
28
//    }
29
//
30
//
31
//}
modules/uoa-repository-manager-service/branches/newmodel/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.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-new.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
</beans>
modules/uoa-repository-manager-service/branches/newmodel/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

  
12
    <bean class="eu.dnetlib.repo.manager.config.CascadingPropertyLoader"
13
          id="propertyLoader">
14
        <property name="order" value="2"/>
15
        <property name="properties">
16
            <bean class="eu.dnetlib.conf.WebappContextProperyFactory">
17
                <property name="propertyFetcher">
18
                    <bean class="eu.dnetlib.conf.PropertyFetcher"/>
19
                </property>
20
            </bean>
21
        </property>
22
        <property name="ignoreUnresolvablePlaceholders" value="true"/>
23
        <property name="locations">
24
            <list>
25
                <value>classpath*:/gr/**/springContext-*.properties</value>
26
                <value>classpath*:/eu/**/springContext-*.properties</value>
27

  
28
                <value>classpath*:/application.properties</value>
29
                <value>classpath*:email-texts.properties</value>
30

  
31
                <!--                <value>classpath*:dnet-site-wizard.properties</value>-->
32
                <!--                <value>classpath*:dnet-site-override.properties</value>-->
33
                <!--                <value>classpath*:dnet-wizard.properties</value>-->
34
                <!--                <value>classpath*:dnet-override.properties</value>-->
35
                <!--                <value>classpath*:dnet-validator-wizard.properties</value>-->
36
                <!--                <value>classpath*:dnet-validator-override.properties</value>-->
37
                <!--                <value>classpath*:dnet-site-force-override.properties</value>-->
38
                <!--                <value>classpath*:dnet-force-override.properties</value>-->
39
            </list>
40
        </property>
41
    </bean>
42
</beans>
modules/uoa-repository-manager-service/branches/newmodel/src/main/resources/application.properties
1
#container.hostname = dl114.madgik.di.uoa.gr
2
#container.hostname = mpagasas.di.uoa.gr
3
#container.hostname = adonis.athenarc.gr
4
container.hostname = estella.athenarc.gr
5

  
6
provider.endpoint=http://estella.athenarc.gr:8480/uoa-repository-manager-service
7

  
8

  
9
#container.hostname = validator.mincyt.research-infrastructures.eu
10
container.port = 8080
11
#container.context = <yourContext>
12

  
13
# BASIC SETTINGS
14
services.validator.mode.user = ldap
15
services.validator.mail.override = false
16
services.validator.mode.repo = dms
17
services.validator.baseUrl = http://${container.hostname}:${container.port}/${container.context}
18
services.validator.dnetWorkflow = true
19
services.validator.deploy.environment = openaire-beta
20
#services.validator.deploy.environment = mincyt
21
services.validator.registration.files.download = true
22
services.validator.autoRestoreOnStartup = false
23
services.validator.mode.standalone = false
24
services.validator.mail.override = false
25
services.validator.adminEmail = antleb@di.uoa.gr
26
services.validator.admins.master = antleb@di.uoa.gr
27
services.validator.admins.secondary = ant.lebesis@gmail.com
28
services.validator.adminBaseUrl = ../validator-admin
29
services.validator.webBaseUrl = http://${container.hostname}:${container.port}/validator
30
services.validator.registrationsReport.email = ant.lebesis@gmail.com
31
services.repo-manager.repository.testing.mode = false
32

  
33
# EMAIL SETTINGS
34
services.validator.mail.host = smtp.gmail.com
35
services.validator.mail.port = 465
36
services.validator.mail.username = test.openaire@gmail.com
37
services.validator.mail.password = ^($*@$)*!$
38
services.validator.mail.authenticate = true
39
services.validator.mail.mode = ssl
40
ervices.validator.mail.fromAddress = no-reply@mpagasas.openaire.eu
41
services.validator.mail.override = false
42
services.validator.mail.overrideEmail = nikonas@di.uoa.gr
43
services.validator.mail.specialRecipients = antleb@di.uoa.gr
44

  
45

  
46
# VALIDATOR DB
47
services.validator.db.driverClassName = org.postgresql.Driver
48
#services.validator.db.url = jdbc:postgresql://194.177.192.119:5432/validator
49
services.validator.db.url = jdbc:postgresql://88.197.53.70:5432/validator
50
services.validator.db.username = dnet
51
services.validator.db.password = dnetPwd
52

  
53
# IS
54
#ISLookUpService.url = http://node1.t.openaire.research-infrastructures.eu:8280/is/services/isLookUp
55
#ISRegistryService.url = http://node1.t.openaire.research-infrastructures.eu:8280/is/services/isRegistry
56
#ISSNService.url = http://node1.t.openaire.research-infrastructures.eu:8280/is/services/isSN
57

  
58
#ISLookUpService.url = http://skalny.icm.edu.pl:8280/is/services/isLookUp
59
#ISRegistryService.url = http://skalny.icm.edu.pl:8280/is/services/isRegistry
60
#ISSNService.url = skalny.icm.edu.pl:8280/is/services/isSN
61

  
62
#ISLookUpService.url = http://node0.t.openaire.research-infrastructures.eu:8080/is/services/isLookUp
63
#ISRegistryService.url = http://node0.t.openaire.research-infrastructures.eu:8080/is/services/isRegistry
64
#ISSNService.url = http://node0.t.openaire.research-infrastructures.eu:8080/is/services/isSN
65

  
66
#ISLookUpService.url = http://node6.t.openaire.research-infrastructures.eu:8980/dnet/services/isLookUp
67
#ISRegistryService.url = http://node6.t.openaire.research-infrastructures.eu:8980/dnet/services/isRegistry
68
#ISSNService.url = http://node6.t.openaire.research-infrastructures.eu:8980/dnet/services/isSN
69

  
70
#ISLookUpService.url = http://node6.t.openaire.research-infrastructures.eu:8280/is/services/isLookUp
71
#ISRegistryService.url = http://node6.t.openaire.research-infrastructures.eu:8280/is/services/isRegistry
72
#ISSNService.url = http://node6.t.openaire.research-infrastructures.eu:8280/is/services/isSN
73

  
74
#ISLookUpService.url = http://aggregator.mincyt.research-infrastructures.eu:8080/is/services/isLookUp
75
#ISRegistryService.url = http://aggregator.mincyt.research-infrastructures.eu:8080/is/services/isRegistry
76
#ISSNService.url = http://aggregator.mincyt.research-infrastructures.eu:8080/is/services/isSN
77

  
78
#ISLookUpService.url = http://node0.d.hudl.research-infrastructures.eu:8080/is/services/isLookUp
79
#ISRegistryService.url = http://node0.d.hudl.research-infrastructures.eu:8080/is/services/isRegistry
80
#ISSNService.url = http://node0.d.hudl.research-infrastructures.eu:8080/is/is/services/isSN
81

  
82
ISLookUpService.url = https://dev-openaire.d4science.org:443/is/services/isLookUp
83
ISRegistryService.url = https://dev-openaire.d4science.org:443/is/services/isRegistry
84
ISSNService.url = https://dev-openaire.d4science.org:443/is/services/isSN
85
ValidatorService.url=http://estella.athenarc.gr:8080/validator-service/services/validatorWebService
86

  
87
# LDAP
88
#services.validator.ldap.address = 88.197.53.113
89
#services.validator.ldap.address = 194.197.192.119
90
#services.validator.ldap.port = 389
91
#services.validator.ldap.username = cn=admin,dc=openaire,dc=eu
92
#services.validator.ldap.password = serenata
93
#services.validator.ldap.usersDN = ou=users,dc=openaire,dc=eu
94

  
95
services.users.ldap.address = 194.177.192.119
96
services.users.ldap.port = 389
97
services.users.ldap.username = cn=admin,dc=openaire,dc=eu
98
services.users.ldap.password = serenata
99
services.users.ldap.usersDN = ou=users,dc=openaire,dc=eu
100

  
101
services.validator.ldap.address = 194.177.192.119
102
services.validator.ldap.port = 389
103
services.validator.ldap.username = cn=admin,dc=openaire,dc=eu
104
services.validator.ldap.password = serenata
105
services.validator.ldap.usersDN = ou=users,dc=openaire,dc=eu
106

  
107
#AAI-REDIS
108
redis.host = estella.athenarc.gr
109
redis.port = 6379
110
redis.password = redis123
111

  
112
oidc.dev.home = http://localhost:8480/uoa-repository-manager-service/openid_connect_login
113
webapp.dev.front = http://localhost:4200/dashboard
114

  
115
repomanager.db.driverClassName=org.postgresql.Driver
116
repomanager.db.url=jdbc:postgresql://194.177.192.119:5432/repomanager
117
repomanager.db.username=dnet
118
repomanager.db.password=dnetPwd
119
infrastructure.name=integration
120

  
121
transport.soap.baseAddress=http://${container.hostname}:${container.port}/${container.context}
122
transport.soap.force.local.address=false
123
services.validator.mail.host=smtp.gmail.com
124
services.validator.mail.port=465
125
services.validator.mail.fromAddress=no-reply@openaire.eu
126
services.validator.mail.replyToAddress=no-reply@openaire.eu
127
services.validator.mail.username=test.openaire@gmail.com
128
services.validator.mail.password=^($*@$)*!$
129
services.validator.mail.authenticate=true
130
services.validator.mail.override=false
131
services.validator.mail.logonly=false
132
services.validator.mail.mode=ssl
133
services.validator.mail.debug=false
134
services.validator.mail.overrideEmail=antleb@di.uoa.gr
135
services.validator.mail.specialRecipients=antleb@di.uoa.gr
136
services.validator.repoRegistration.override=antleb@di.uoa.gr
137

  
138
oidc.issuer=https://aai.openaire.eu/oidc/
139
oidc.id=767422b9-5461-4807-a80a-f9a2072d3a7d
140
oidc.secret=AMQtGlbTXNjwjhF0st28LmM6V0XypMdaVS7tJmGuYFlmH36iIv4t7tVqYuLYrNPkhnZ_GPUJvhymBhFupdgb6aU
141
search.api.baseAddress=https://beta.services.openaire.eu/search/v2/api
142
search.api.usagestats=https://services.openaire.eu/usagestats
143
search.api.usageEvents=http://beta.lbs.openaire.eu:8080/ajax/summary
144
api.baseAddress=http://beta.services.openaire.eu/openaire
145
services.repo-manager.baseUrl=http://${container.hostname}:${container.port}/${container.context}
146
services.repo-manager.adminEmail=antleb@di.uoa.gr
147
services.repo-manager.repository.testing.mode=false
148
services.repo-manager.deploy.environment=development
149
services.repomanager.usageStatisticsDiagramsBaseURL=https://beta.openaire.eu/stats3/
150
services.repomanager.usageStatisticsNumbersBaseURL=https://beta.services.openaire.eu/usagestats/datasources/
151
services.repomanager.usagestats.adminEmail=antleb@di.uoa.gr
152
services.repomanager.usagestats.sushiliteEndpoint=http://beta.services.openaire.eu/usagestats/sushilite/
153
services.repomanager.analyticsURL=https://analytics.openaire.eu/addsite.php?
154

  
155
aai.mode=develop
156
#uoa-repository-manager-service
157
#oidc.dev.home=http://88.197.53.69:8080/uoa-repository-manager-service/openid_connect_login
158
#webapp.dev.front=http://88.197.53.69/landing
159
services.repo-manager.adminEmail=antleb@di.uoa.gr
160
services.repomanager.usagestats.adminEmail=antleb@di.uoa.gr
161
services.provide.adminEmail=antleb@di.uoa.gr
162
validator.results.url=https://beta.provide.openaire.eu/compatibility/browseHistory/
163
topic_types.url=https://beta.services.openaire.eu/provision/mvc/vocabularies/dnet:topic_types.json
164
services.broker.url=http://broker1-dev-dnet.d4science.org
165
services.broker.port=8080
166
services.broker.api=api/
167
services.broker.openaire=openaireBroker
modules/uoa-repository-manager-service/branches/newmodel/src/main/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

  
12
    <bean class="eu.dnetlib.repo.manager.config.CascadingPropertyLoader"
13
          id="propertyLoader">
14
        <property name="order" value="2"/>
15
        <property name="properties">
16
            <bean class="eu.dnetlib.conf.WebappContextProperyFactory">
17
                <property name="propertyFetcher">
18
                    <bean class="eu.dnetlib.conf.PropertyFetcher"/>
19
                </property>
20
            </bean>
21
        </property>
22
        <property name="ignoreUnresolvablePlaceholders" value="true"/>
23
        <property name="locations">
24
            <list>
25
                <value>classpath*:/gr/**/springContext-*.properties</value>
26
                <value>classpath*:/eu/**/springContext-*.properties</value>
27

  
28
                <value>classpath*:/application.properties</value>
29
                <value>classpath*:email-texts.properties</value>
30

  
31
                <!--                <value>classpath*:dnet-site-wizard.properties</value>-->
32
                <!--                <value>classpath*:dnet-site-override.properties</value>-->
33
                <!--                <value>classpath*:dnet-wizard.properties</value>-->
34
                <!--                <value>classpath*:dnet-override.properties</value>-->
35
                <!--                <value>classpath*:dnet-validator-wizard.properties</value>-->
36
                <!--                <value>classpath*:dnet-validator-override.properties</value>-->
37
                <!--                <value>classpath*:dnet-site-force-override.properties</value>-->
38
                <!--                <value>classpath*:dnet-force-override.properties</value>-->
39
            </list>
40
        </property>
41
    </bean>
42
</beans>
modules/uoa-repository-manager-service/branches/newmodel/src/main/resources/email-texts.properties
1
user.registration.mail.subject = OpenAIRE Account Activation
2
user.registration.mail.message = Please follow this link to activate your account
3

  
4
user.forgotPassword.mail.Subject = OpenAIRE Reset Password Request
5
user.forgotPassword.mail.Body1 = To complete your password reset please follow this link
6
user.forgotPassword.mail.Body2 = Security Code
7

  
modules/uoa-repository-manager-service/branches/newmodel/src/main/resources/eu/dnetlib/repo/manager/service/countries.txt
1
Afghanistan
2
Albania
3
Algeria
4
Andorra
5
Angola
6
Antigua & Deps
7
Argentina
8
Armenia
9
Australia
10
Austria
11
Azerbaijan
12
Bahamas
13
Bahrain
14
Bangladesh
15
Barbados
16
Belarus
17
Belgium
18
Belize
19
Benin
20
Bhutan
21
Bolivia
22
Bosnia Herzegovina
23
Botswana
24
Brazil
25
Brunei
26
Bulgaria
27
Burkina
28
Burundi
29
Cambodia
30
Cameroon
31
Canada
32
Cape Verde
33
Central African Rep
34
Chad
35
Chile
36
China
37
Colombia
38
Comoros
39
Congo
40
Congo {Democratic Rep}
41
Costa Rica
42
Croatia
43
Cuba
44
Cyprus
45
Czech Republic
46
Denmark
47
Djibouti
48
Dominica
49
Dominican Republic
50
East Timor
51
Ecuador
52
Egypt
53
El Salvador
54
Equatorial Guinea
55
Eritrea
56
Estonia
57
Ethiopia
58
Fiji
59
Finland
60
France
61
Gabon
62
Gambia
63
Georgia
64
Germany
65
Ghana
66
Greece
67
Grenada
68
Guatemala
69
Guinea
70
Guinea-Bissau
71
Guyana
72
Haiti
73
Honduras
74
Hungary
75
Iceland
76
India
77
Indonesia
78
Iran
79
Iraq
80
Ireland {Republic}
81
Israel
82
Italy
83
Ivory Coast
84
Jamaica
85
Japan
86
Jordan
87
Kazakhstan
88
Kenya
89
Kiribati
90
Korea North
91
Korea South
92
Kosovo
93
Kuwait
94
Kyrgyzstan
95
Laos
96
Latvia
97
Lebanon
98
Lesotho
99
Liberia
100
Libya
101
Liechtenstein
102
Lithuania
103
Luxembourg
104
Macedonia
105
Madagascar
106
Malawi
107
Malaysia
108
Maldives
109
Mali
110
Malta
111
Marshall Islands
112
Mauritania
113
Mauritius
114
Mexico
115
Micronesia
116
Moldova
117
Monaco
118
Mongolia
119
Montenegro
120
Morocco
121
Mozambique
122
Myanmar, {Burma}
123
Namibia
124
Nauru
125
Nepal
126
Netherlands
127
New Zealand
128
Nicaragua
129
Niger
130
Nigeria
131
Norway
132
Oman
133
Pakistan
134
Palau
135
Panama
136
Papua New Guinea
137
Paraguay
138
Peru
139
Philippines
140
Poland
141
Portugal
142
Qatar
143
Romania
144
Russian Federation
145
Rwanda
146
St Kitts & Nevis
147
St Lucia
148
Saint Vincent & the Grenadines
149
Samoa
150
San Marino
151
Sao Tome & Principe
152
Saudi Arabia
153
Senegal
154
Serbia
155
Seychelles
156
Sierra Leone
157
Singapore
158
Slovakia
159
Slovenia
160
Solomon Islands
161
Somalia
162
South Africa
163
Spain
164
Sri Lanka
165
Sudan
166
Suriname
167
Swaziland
168
Sweden
169
Switzerland
170
Syria
171
Taiwan
172
Tajikistan
173
Tanzania
174
Thailand
175
Togo
176
Tonga
177
Trinidad & Tobago
178
Tunisia
179
Turkey
180
Turkmenistan
181
Tuvalu
182
Uganda
183
Ukraine
184
United Arab Emirates
185
United Kingdom
186
United States
187
Uruguay
188
Uzbekistan
189
Vanuatu
190
Vatican City
191
Venezuela
192
Vietnam
193
Yemen
194
Zambia
195
Zimbabwe
modules/uoa-repository-manager-service/branches/newmodel/src/main/resources/eu/dnetlib/repo/manager/service/timezones.txt
1
-2.0	[GMT - 2] Fernando de Noronha Time,	South Georg...
2
-1.0	[GMT - 1] Azores Standard Time, Cape Verde Time...
3
0.0	[GMT] Western European Time, Greenwich Mean Time
4
1.0	[GMT + 1] Central European Time, West African Time
5
2.0	[GMT + 2] Eastern European Time, Central Africa...
6
3.0	[GMT + 3] Moscow Standard Time, Eastern African...
7
3.5	[GMT + 3:30] Iran Standard Time
8
4.0	[GMT + 4] Gulf Standard Time, Samara Standard Time
9
4.5	[GMT + 4:30] Afghanistan Time
10
5.0	[GMT + 5] Pakistan Standard Time, Yekaterinburg...
11
8.0	[GMT + 8] Beijing, Hong Kong, Irkutsk, Kuala Lumpur, Manila, Perth
modules/uoa-repository-manager-service/branches/newmodel/src/main/resources/eu/dnetlib/repo/manager/service/typologies.txt
1
CONTENTdm
2
Digibib
3
Digital Commons
4
DigiTool
5
DIVA
6
Diva-Portal
7
dLibra
8
Doks
9
Drupal
10
DSpace
11
Earmas
12
EPrints
13
ETD
14
ETD-db
15
Fedora
16
Fez
17
Greenstone
18
HAL
19
invenio
20
MyCoRe
21
Open Repository
22
OPUS
23
Pica-Verbundkatalog
24
Proprietary Software
25
PUMA
26
PURE
27
SciELO
28
SFIX
29
VITAL
30
VTOAI
31
WEKO
32
XooNIps
33
------------------------
34
OJS
35
HyperJournal
36
ePubTk
37
GAPworks
38
DPubS
39
E-Journal
40
------------------------
41
[Other]
42

  
modules/uoa-repository-manager-service/branches/newmodel/src/main/webapp/WEB-INF/log4j.properties
1
log4j.rootLogger = INFO
2

  
3
log4j.logger.eu.dnetlib = INFO, R
4
log4j.logger.eu.dnetlib.repo.manager = INFO, R
5
log4j.logger.eu.dnetlib.clients.data.datasourcemanager.ws.Converter = FATAL
6
log4j.logger.org.springframework = INFO, R
7

  
8
log4j.appender.R=org.apache.log4j.RollingFileAppender
9
log4j.appender.R.File=/var/log/dnet/repository-manager.log
10
log4j.appender.R.MaxFileSize=10MB
11
log4j.appender.R.MaxBackupIndex=10
12
log4j.appender.R.layout=org.apache.log4j.PatternLayout
13
log4j.appender.R.layout.ConversionPattern= %d %p %t [%c] - %m%n
modules/uoa-repository-manager-service/branches/newmodel/src/main/webapp/WEB-INF/web.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<web-app>
3

  
4
    <listener>
5
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
6
    </listener>
7

  
8
    <context-param>
9
        <param-name>contextConfigLocation</param-name>
10
        <param-value>
11
            /WEB-INF/applicationContext.xml
12
        </param-value>
13
    </context-param>
14
    <context-param>
15
        <param-name>log4jRefreshInterval</param-name>
16
        <param-value>1000</param-value>
17
    </context-param>
18
    <context-param>
19
        <param-name>log4jExposeWebAppRoot</param-name>
20
        <param-value>false</param-value>
21
    </context-param>
22

  
23
    <servlet>
24
        <servlet-name>spring</servlet-name>
25
        <servlet-class>
26
            org.springframework.web.servlet.DispatcherServlet
27
        </servlet-class>
28
        <init-param>
29
            <param-name>throwExceptionIfNoHandlerFound</param-name>
30
            <param-value>true</param-value>
31
        </init-param>
32
        <load-on-startup>1</load-on-startup>
33
    </servlet>
34

  
35
    <filter>
36
        <filter-name>springSecurityFilterChain</filter-name>
37
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
38
        <init-param>
39
            <param-name>contextAttribute</param-name>
40
            <param-value>org.springframework.web.servlet.FrameworkServlet.CONTEXT.spring</param-value>
41
        </init-param>
42
    </filter>
43

  
44
    <filter>
45
        <filter-name>CorsFilter</filter-name>
46
        <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
47
        <init-param>
48
            <param-name>cors.allowed.origins</param-name>
49
            <param-value>*</param-value>
50
        </init-param>
51
        <init-param>
52
            <param-name>cors.allowed.headers</param-name>
53
            <param-value>Content-Type,X-Requested-With,accept,authorization,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
54
        </init-param>
55
        <init-param>
56
            <param-name>cors.allowed.methods</param-name>
57
            <param-value>GET, POST, PUT, DELETE, OPTIONS, HEAD</param-value>
58
        </init-param>
59
    </filter>
60

  
61
    <filter-mapping>
62
        <filter-name>CorsFilter</filter-name>
63
        <url-pattern>/*</url-pattern>
64
    </filter-mapping>
65

  
66
    <filter>
67
        <filter-name>springSessionRepositoryFilter</filter-name>
68
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
69
    </filter>
70
    <filter-mapping>
71
        <filter-name>springSessionRepositoryFilter</filter-name>
72
        <url-pattern>/*</url-pattern>
73
        <dispatcher>REQUEST</dispatcher>
74
        <dispatcher>ERROR</dispatcher>
75
    </filter-mapping>
76

  
77
    <filter-mapping>
78
        <filter-name>springSecurityFilterChain</filter-name>
79
        <url-pattern>/*</url-pattern>
80
    </filter-mapping>
81

  
82
    <servlet-mapping>
83
        <servlet-name>spring</servlet-name>
84
        <url-pattern>/</url-pattern>
85
    </servlet-mapping>
86
</web-app>
modules/uoa-repository-manager-service/branches/newmodel/src/main/webapp/WEB-INF/spring-servlet.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<beans xmlns="http://www.springframework.org/schema/beans"
3
       xmlns:mvc="http://www.springframework.org/schema/mvc"
4
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
       xmlns:context="http://www.springframework.org/schema/context"
6
       xmlns:security="http://www.springframework.org/schema/security"
7
       xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
8
		http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd
9
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
10
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"
11
      >
12

  
13
    <security:global-method-security pre-post-annotations="enabled" proxy-target-class="true"
14
                                     authentication-manager-ref="authenticationManager">
15
    </security:global-method-security>
16

  
17
    <bean id="webexpressionHandler"
18
          class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler"/>
19

  
20
    <context:annotation-config/>
21
    <mvc:annotation-driven />
22

  
23
</beans>
modules/uoa-repository-manager-service/branches/newmodel/src/main/webapp/WEB-INF/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.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
    <mvc:resources mapping="swagger-ui.html" location="classpath:/META-INF/resources/"/>
71
    <mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/>
72
    <bean class="eu.dnetlib.repo.manager.config.SwaggerConfig"/>
73

  
74
</beans>
modules/uoa-repository-manager-service/branches/newmodel/src/main/java/eu/dnetlib/repo/manager/exception/EndPointException.java
1
package eu.dnetlib.repo.manager.exception;
2

  
3
import java.io.IOException;
4

  
5
//@ResponseStatus(HttpStatus.GATEWAY_TIMEOUT)
6
public class EndPointException extends IOException {
7

  
8
    public EndPointException() {
9
            super("Endpoint not responding!");
10
        }
11

  
12
    public EndPointException(String url) {
13
            super("Endpoint with url: " + url + " not responding!");
14
        }
15

  
16
}
modules/uoa-repository-manager-service/branches/newmodel/src/main/java/eu/dnetlib/repo/manager/exception/ServerError.java
1
package eu.dnetlib.repo.manager.exception;
2

  
3
public class ServerError {
4

  
5
    public final String url;
6
    public final String error;
7

  
8
    public ServerError(String url, Exception ex) {
9
        this.url = url;
10
        this.error = ex.getMessage();
11
    }
12

  
13
    public String getUrl() {
14
        return this.url;
15
    }
16

  
17
    public String getError() {
18
        return this.error;
19
    }
20

  
21
}
modules/uoa-repository-manager-service/branches/newmodel/src/main/java/eu/dnetlib/repo/manager/exception/ResourceNotFoundException.java
1
package eu.dnetlib.repo.manager.exception;
2

  
3
import org.springframework.http.HttpStatus;
4
import org.springframework.web.bind.annotation.ResponseStatus;
5

  
6
@ResponseStatus(HttpStatus.NOT_FOUND)
7
public class ResourceNotFoundException extends Exception {
8
    public ResourceNotFoundException() {
9
        super("Resource Not Found");
10
    }
11

  
12
    public ResourceNotFoundException(String id, String resourceType) {
13
        super(resourceType + " with id " + id + " was not found");
14
    }
15
}
modules/uoa-repository-manager-service/branches/newmodel/src/main/java/eu/dnetlib/repo/manager/service/BrokerService.java
1
package eu.dnetlib.repo.manager.service;
2

  
3
import eu.dnetlib.repo.manager.domain.BrokerException;
4
import eu.dnetlib.repo.manager.domain.Term;
5
import eu.dnetlib.repo.manager.domain.broker.*;
6
import org.json.JSONException;
7
import org.springframework.http.ResponseEntity;
8

  
9
import java.io.IOException;
10
import java.util.List;
11
import java.util.Map;
12

  
13

  
14
public interface BrokerService {
15

  
16
    DatasourcesBroker getDatasourcesOfUser(String user, String includeShared, String includeByOthers) throws BrokerException, JSONException;
17

  
18
    List<BrowseEntry> getTopicsForDatasource(String datasourceName) throws BrokerException;
19

  
20
    EventsPage advancedShowEvents(String page,
21
                                  String size,
22
                                  AdvQueryObject advQueryObject) throws BrokerException, JSONException ,IOException;
23

  
24
    EventsPage showEvents(String datasourceName,
25
                          String topic,
26
                          String page,
27
                          String size) throws BrokerException, JSONException;
28

  
29
    Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(String userEmail) throws BrokerException;
30

  
31
    Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUserByRepoId(String userEmail, String repoId) throws BrokerException;
32

  
33
    Subscription subscribe(OpenaireSubscription obj) throws BrokerException;
34

  
35
    ResponseEntity<Object> unsubscribe(String subscriptionId) throws BrokerException;
36

  
37
    Subscription getSubscription(String subscriptionId) throws BrokerException;
38

  
39
    Map<String, Term> getDnetTopics() throws BrokerException;
40

  
41
    EventsPage getNotificationsBySubscriptionId(String subscriptionId, String page, String size) throws BrokerException;
42

  
43
    Map<String, List<Subscription>> getSubscriptionsOfUser(String userEmail) throws BrokerException;
44
}
modules/uoa-repository-manager-service/branches/newmodel/src/main/java/eu/dnetlib/repo/manager/service/ValidatorService.java
1
package eu.dnetlib.repo.manager.service;
2

  
3
import eu.dnetlib.api.functionality.ValidatorServiceException;
4
import eu.dnetlib.domain.functionality.validator.JobForValidation;
5
import eu.dnetlib.domain.functionality.validator.RuleSet;
6
import eu.dnetlib.domain.functionality.validator.StoredJob;
7
import eu.dnetlib.repo.manager.domain.InterfaceInformation;
8
import eu.dnetlib.repo.manager.domain.ValidationServiceException;
9
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
10
import org.json.JSONException;
11
import org.springframework.http.ResponseEntity;
12

  
13
import java.util.List;
14

  
15

  
16

  
17
public interface ValidatorService {
18

  
19

  
20
    JobForValidation submitJobForValidation(JobForValidation jobForValidation) throws ValidatorServiceException;
21

  
22
    ResponseEntity<Object> reSubmitJobForValidation(String email, String jobId) throws JSONException, ValidatorServiceException;
23

  
24
    List<RuleSet> getRuleSets(String mode);
25

  
26
    List<String> getSetsOfRepository(String url);
27

  
28
    boolean identifyRepo(String url);
29

  
30
    RuleSet getRuleSet(String acronym);
31

  
32
    List<StoredJob> getStoredJobsNew(String user,
33
                                     String jobType,
34
                                     String offset,
35
                                     String limit,
36
                                     String dateFrom,
37
                                     String dateTo,
38
                                     String validationStatus) throws ValidatorServiceException;
39

  
40
    int getStoredJobsTotalNumberNew(String user, String jobType, String validationStatus) throws ValidatorServiceException;
41

  
42
    InterfaceInformation getInterfaceInformation(String baseUrl) throws ValidationServiceException;
43

  
44
    List<StoredJob> getJobsSummary(String repoId, int limit) throws ValidatorServiceException, ResourceNotFoundException, JSONException;
45
}
modules/uoa-repository-manager-service/branches/newmodel/src/main/java/eu/dnetlib/repo/manager/service/customHystrixCommands/LiteratureHystrixCommand.java
1
package eu.dnetlib.repo.manager.service.customHystrixCommands;
2

  
3
import com.netflix.hystrix.HystrixCommand;
4
import com.netflix.hystrix.HystrixCommandGroupKey;
5
import org.springframework.http.HttpMethod;
6
import org.springframework.http.ResponseEntity;
7
import org.springframework.web.client.RestTemplate;
8
import org.springframework.web.util.UriComponents;
9
import org.springframework.web.util.UriComponentsBuilder;
10

  
11
import java.util.Map;
12

  
13
public class LiteratureHystrixCommand extends HystrixCommand<String> {
14

  
15
    RestTemplate restTemplate;
16
    private String baseAddress;
17

  
18
    public LiteratureHystrixCommand(String baseAddress , RestTemplate restTemplate) {
19
        super(HystrixCommandGroupKey.Factory.asKey("StatisticsGroup"));
20
        this.baseAddress = baseAddress;
21
        this.restTemplate = restTemplate;
22
    }
23

  
24
    @Override
25
    protected String run() throws Exception {
26
        String url = baseAddress+"/resources"+
27
                "?query= " +
28
                " oaftype exact datasource and " +
29
                " ( datasourcetypename exact Institutional Repository  " +
30
                "     or datasourcetypename exact Publication Repository )";
31

  
32
        UriComponents uriComponents = UriComponentsBuilder
33
                .fromHttpUrl(url)
34
                .queryParam("page", 0)
35
                .queryParam("size", 0)
36
                .queryParam("format", "json")
37
                .build().encode();
38

  
39
        ResponseEntity rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
40
        Map metadata = (Map) ((Map) rs.getBody()).get("meta");
41
        return String.valueOf(metadata.get("total"));
42
    }
43

  
44
    @Override
45
    protected String getFallback() {
46
        return null;
47
    }
48

  
49
}
modules/uoa-repository-manager-service/branches/newmodel/src/main/java/eu/dnetlib/repo/manager/service/customHystrixCommands/DataRepositoriesHystrixCommand.java
1
package eu.dnetlib.repo.manager.service.customHystrixCommands;
2

  
3
import com.netflix.hystrix.HystrixCommand;
4
import com.netflix.hystrix.HystrixCommandGroupKey;
5
import org.springframework.http.HttpMethod;
6
import org.springframework.http.ResponseEntity;
7
import org.springframework.web.client.RestTemplate;
8
import org.springframework.web.util.UriComponents;
9
import org.springframework.web.util.UriComponentsBuilder;
10

  
11
import java.util.Map;
12

  
13
public class DataRepositoriesHystrixCommand extends HystrixCommand<String> {
14

  
15
    RestTemplate restTemplate ;
16
    private String baseAddress;
17

  
18
    public DataRepositoriesHystrixCommand(String baseAddress,RestTemplate restTemplate) {
19
        super(HystrixCommandGroupKey.Factory.asKey("StatisticsGroup"));
20
        this.baseAddress = baseAddress;
21
        this.restTemplate = restTemplate;
22
    }
23

  
24
    @Override
25
    protected String run() {
26
        String url = baseAddress+"/resources" +
27
                "?query= " +
28
                " oaftype exact datasource and " +
29
                " datasourcetypename exact Data Repository ";
30

  
31
        UriComponents uriComponents = UriComponentsBuilder
32
                .fromHttpUrl(url)
33
                .queryParam("page",0)
34
                .queryParam("size",0)
35
                .queryParam("format","json")
36
                .build().encode();
37

  
38
        ResponseEntity rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET,null,Map.class);
39
        Map metadata = (Map) ((Map)rs.getBody()).get("meta");
40
        return String.valueOf(metadata.get("total"));
41
    }
42

  
43
    @Override
44
    protected String getFallback() {
45
        return null;
46
    }
47
}
modules/uoa-repository-manager-service/branches/newmodel/src/main/java/eu/dnetlib/repo/manager/service/customHystrixCommands/AggregatorsHystrixCommand.java
1
package eu.dnetlib.repo.manager.service.customHystrixCommands;
2

  
3
import com.netflix.hystrix.HystrixCommand;
4
import com.netflix.hystrix.HystrixCommandGroupKey;
5
import org.springframework.http.HttpMethod;
6
import org.springframework.http.ResponseEntity;
7
import org.springframework.web.client.RestTemplate;
8
import org.springframework.web.util.UriComponents;
9
import org.springframework.web.util.UriComponentsBuilder;
10

  
11
import java.util.Map;
12

  
13
public class AggregatorsHystrixCommand extends HystrixCommand<String> {
14

  
15
    RestTemplate restTemplate;
16
    String baseAddress;
17

  
18
    public AggregatorsHystrixCommand(String baseAddress, RestTemplate restTemplate) {
19
        super(HystrixCommandGroupKey.Factory.asKey("StatisticsGroup"));
20
        this.baseAddress = baseAddress;
21
        this.restTemplate = restTemplate;
22
    }
23

  
24
    @Override
25
    protected String run() throws Exception {
26
        String url = baseAddress + "/resources" +
27
                "?query= " +
28
                " oaftype exact datasource and " +
29
                " ( datasourcetypename exact Institutional Repository Aggregator " +
30
                "     or datasourcetypename exact Publication Repository Aggregator )";
31

  
32
        UriComponents uriComponents = UriComponentsBuilder
33
                .fromHttpUrl(url)
34
                .queryParam("page", 0)
35
                .queryParam("size", 0)
36
                .queryParam("format", "json")
37
                .build().encode();
38

  
39
        ResponseEntity rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
40
        Map metadata = (Map) ((Map) rs.getBody()).get("meta");
41
        return String.valueOf(metadata.get("total"));
42
    }
43

  
44
    @Override
45
    protected String getFallback() {
46
        return null;
47
    }
48
}
modules/uoa-repository-manager-service/branches/newmodel/src/main/java/eu/dnetlib/repo/manager/service/customHystrixCommands/UsageStatsTotalHystrixCommand.java
1
package eu.dnetlib.repo.manager.service.customHystrixCommands;
2

  
3
import com.netflix.hystrix.HystrixCommand;
4
import com.netflix.hystrix.HystrixCommandGroupKey;
5
import org.springframework.http.HttpMethod;
6
import org.springframework.http.ResponseEntity;
7
import org.springframework.web.client.RestTemplate;
8
import org.springframework.web.util.UriComponents;
9
import org.springframework.web.util.UriComponentsBuilder;
10

  
11
import java.util.Map;
12

  
13
public class UsageStatsTotalHystrixCommand extends HystrixCommand<Integer> {
14

  
15
    RestTemplate restTemplate ;
16
    String usagestatsEvents;
17

  
18
    public UsageStatsTotalHystrixCommand(String usagestatsEvents,RestTemplate restTemplate) {
19
        super(HystrixCommandGroupKey.Factory.asKey("StatisticsGroup"));
20
        this.usagestatsEvents = usagestatsEvents;
21
        this.restTemplate = restTemplate;
22
    }
23

  
24
    @Override
25
    protected Integer run() {
26
        UriComponents uriComponents = UriComponentsBuilder
27
                .fromHttpUrl(usagestatsEvents)
28
                .build().encode();
29

  
30
        ResponseEntity rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET,null,Map.class);
31
        Map metadata = (Map) ((Map)rs.getBody()).get("totals");
32
//        String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
33
//        JSONObject resultSet = new JSONObject(rs);
34
//        JSONObject totals = resultSet.getJSONObject("totals");
35
        return (Integer) metadata.get("events");
36
    }
37

  
38
    @Override
39
    protected Integer getFallback() {
40
        return null;
41
    }
42

  
43
}
modules/uoa-repository-manager-service/branches/newmodel/src/main/java/eu/dnetlib/repo/manager/service/customHystrixCommands/DatasetsHystrixCommand.java
1
package eu.dnetlib.repo.manager.service.customHystrixCommands;
2

  
3
import com.netflix.hystrix.HystrixCommand;
4
import com.netflix.hystrix.HystrixCommandGroupKey;
5
import org.springframework.http.HttpMethod;
6
import org.springframework.http.ResponseEntity;
7
import org.springframework.web.client.RestTemplate;
8
import org.springframework.web.util.UriComponents;
9
import org.springframework.web.util.UriComponentsBuilder;
10

  
11
import java.util.Map;
12

  
13
public class DatasetsHystrixCommand extends HystrixCommand<String> {
14

  
15
    RestTemplate restTemplate;
16
    String baseAddress;
17

  
18
    public DatasetsHystrixCommand(String baseAddress,RestTemplate restTemplate) {
19
        super(HystrixCommandGroupKey.Factory.asKey("StatisticsGroup"));
20
        this.restTemplate = restTemplate;
21
        this.baseAddress = baseAddress;
22
    }
23

  
24
    @Override
25
    protected String run() throws Exception {
26
        String url = baseAddress+"/datasets/count";
27

  
28
        UriComponents uriComponents = UriComponentsBuilder
29
                .fromHttpUrl(url)
30
                .queryParam("page", 0)
31
                .queryParam("size", 0)
32
                .queryParam("format", "json")
33
                .build().encode();
34

  
35
        ResponseEntity rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
36
        Map metadata = (Map) (rs.getBody());
37
        return String.valueOf(metadata.get("total"));
38
    }
39

  
40
    @Override
41
    protected String getFallback() {
42
        return null;
43
    }
44
}
modules/uoa-repository-manager-service/branches/newmodel/src/main/java/eu/dnetlib/repo/manager/service/customHystrixCommands/LastYearUsageStatsHystrixCommand.java
1
package eu.dnetlib.repo.manager.service.customHystrixCommands;
2

  
3
import com.netflix.hystrix.HystrixCommand;
4
import com.netflix.hystrix.HystrixCommandGroupKey;
5
import org.springframework.http.HttpMethod;
6
import org.springframework.http.ResponseEntity;
7
import org.springframework.web.client.RestTemplate;
8
import org.springframework.web.util.UriComponents;
9
import org.springframework.web.util.UriComponentsBuilder;
10

  
11
import java.util.HashMap;
12
import java.util.List;
13
import java.util.Map;
14

  
15
public class LastYearUsageStatsHystrixCommand extends HystrixCommand<Map> {
16

  
17
    RestTemplate restTemplate;
18
    String usagestatsBaseAddress;
19

  
20
    public LastYearUsageStatsHystrixCommand(String usagestatsBaseAddress,RestTemplate restTemplate) {
21
        super(HystrixCommandGroupKey.Factory.asKey("StatisticsGroup"));
22
        this.usagestatsBaseAddress = usagestatsBaseAddress;
23
        this.restTemplate = restTemplate;
24
    }
25

  
26
    @Override
27
    protected Map run() throws Exception {
28
        UriComponents uriComponents = UriComponentsBuilder
29
                .fromHttpUrl(usagestatsBaseAddress + "/totals")
30
                .build().encode();
31

  
32
        ResponseEntity rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET,null,Map.class);
33

  
34
        List yearly_stats = (List) ((Map)rs.getBody()).get("yearly_stats");
35
        Map lastYear = (Map) yearly_stats.get(yearly_stats.size()-1);
36
        Integer downloads = (Integer) lastYear.get("downloads");
37
        Integer views = (Integer) lastYear.get("views");
38
        Integer year = (Integer) lastYear.get("year");
39

  
40
        Map<String,Object> usagestats = new HashMap<>();
41
        usagestats.put("number",String.valueOf(downloads+views));
42
        usagestats.put("year",year);
43

  
44
        return usagestats;
45
    }
46

  
47
    @Override
48
    protected Map getFallback() {
49
        return null;
50
    }
51

  
52
}
modules/uoa-repository-manager-service/branches/newmodel/src/main/java/eu/dnetlib/repo/manager/service/customHystrixCommands/PublicationHystrixCommand.java
1
package eu.dnetlib.repo.manager.service.customHystrixCommands;
2

  
3
import com.netflix.hystrix.HystrixCommand;
4
import com.netflix.hystrix.HystrixCommandGroupKey;
5
import org.springframework.http.HttpMethod;
6
import org.springframework.http.ResponseEntity;
7
import org.springframework.web.client.RestTemplate;
8
import org.springframework.web.util.UriComponents;
9
import org.springframework.web.util.UriComponentsBuilder;
10

  
11
import java.util.Map;
12

  
13
public class PublicationHystrixCommand extends HystrixCommand<String> {
14

  
15
    RestTemplate restTemplate;
16
    private String baseAddress;
17

  
18
    public PublicationHystrixCommand(String baseAddress, RestTemplate restTemplate) {
19
        super(HystrixCommandGroupKey.Factory.asKey("StatisticsGroup"));
20
        this.baseAddress = baseAddress;
21
        this.restTemplate = restTemplate;
22
    }
23

  
24
    @Override
25
    protected String run() throws Exception {
26
        String url = baseAddress + "/publications/count";
27

  
28
        UriComponents uriComponents = UriComponentsBuilder
29
                .fromHttpUrl(url)
30
                .queryParam("page", 0)
31
                .queryParam("size", 0)
32
                .queryParam("format", "json")
33
                .build().encode();
34

  
35
        ResponseEntity rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
36
        Map metadata = (Map) (rs.getBody());
37
        return String.valueOf(metadata.get("total"));
38
    }
39

  
40
    @Override
41
    protected String getFallback() {
42
        return null;
43
    }
44

  
45
}
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff