Revision 50087
Added by Panagiotis Kanakakis about 5 years ago
modules/uoa-repository-manager-service/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" xmlns:p="http://www.springframework.org/schema/p" |
|
4 |
xmlns:context="http://www.springframework.org/schema/context" |
|
5 |
xmlns:task="http://www.springframework.org/schema/task" xmlns:tx="http://www.springframework.org/schema/tx" |
|
6 |
xsi:schemaLocation="http://www.springframework.org/schema/beans |
|
7 |
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd |
|
8 |
http://www.springframework.org/schema/context |
|
9 |
http://www.springframework.org/schema/context/spring-context-4.0.xsd |
|
10 |
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> |
|
11 |
|
|
12 |
<import resource="classpath:META-INF/cxf/cxf.xml"/> |
|
13 |
<import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml"/> |
|
14 |
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/> |
|
15 |
<import resource="classpath*:/cxf.xml"/> |
|
16 |
<import resource="classpath*:/eu/dnetlib/repos/ehcacher/springContext-repos-ehcacher.xml"/> |
|
17 |
<import resource="classpath*:/eu/dnetlib/soap/cxf/applicationContext-eprbuilders.xml"/> |
|
18 |
<import resource="classpath*:/eu/dnetlib/clients/ws/springContext-locatorFactory.xml"/> |
|
19 |
<import resource="classpath*:/eu/dnetlib/users/springContext-users-ldap.xml"/> |
|
20 |
<import resource="classpath*:/gr/uoa/di/driver/util/springContext-locators.xml"/> |
|
21 |
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupFactory.xml"/> |
|
22 |
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupClients.xml"/> |
|
23 |
<import resource="classpath*:/eu/dnetlib/enabling/hcm/springContext-hcmService.xml"/> |
|
24 |
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-commons.xml"/> |
|
25 |
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml"/> |
|
26 |
<import resource="classpath*:/eu/dnetlib/repos/springContext-repos-dms-cached.xml"/> |
|
27 |
<context:property-placeholder location="classpath*:/eu/**/application.properties" /> |
|
28 |
<tx:annotation-driven transaction-manager="txManager"/> |
|
29 |
|
|
30 |
<bean class="eu.dnetlib.repo.manager.service.config.CascadingPropertyLoader" id="propertyLoader"> |
|
31 |
<property name="order" value="2" /> |
|
32 |
<property name="properties"> |
|
33 |
<bean class="eu.dnetlib.conf.WebappContextProperyFactory"> |
|
34 |
<property name="propertyFetcher"> |
|
35 |
<bean class="eu.dnetlib.conf.PropertyFetcher" /> |
|
36 |
</property> |
|
37 |
</bean> |
|
38 |
</property> |
|
39 |
<property name="ignoreUnresolvablePlaceholders" value="true" /> |
|
40 |
<property name="locations"> |
|
41 |
<list> |
|
42 |
<value>classpath*:/gr/**/springContext-*.properties</value> |
|
43 |
<value>classpath*:/eu/**/springContext-*.properties</value> |
|
44 |
|
|
45 |
<value>classpath*:/eu/dnetlib/repo/manager/service/email-texts.properties</value> |
|
46 |
|
|
47 |
<value>classpath*:dnet-site-wizard.properties</value> |
|
48 |
<value>classpath*:dnet-site-override.properties</value> |
|
49 |
<value>classpath*:dnet-wizard.properties</value> |
|
50 |
<value>classpath*:dnet-override.properties</value> |
|
51 |
<value>classpath*:dnet-validator-wizard.properties</value> |
|
52 |
<value>classpath*:dnet-validator-override.properties</value> |
|
53 |
<value>classpath*:dnet-site-force-override.properties</value> |
|
54 |
<value>classpath*:dnet-force-override.properties</value> |
|
55 |
</list> |
|
56 |
</property> |
|
57 |
</bean> |
|
58 |
|
|
59 |
<bean id="repomanager.dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> |
|
60 |
<property name="driverClassName" value="${repomanager.db.driverClassName}" /> |
|
61 |
<property name="url" value="${repomanager.db.url}" /> |
|
62 |
<property name="username" value="${repomanager.db.username}" /> |
|
63 |
<property name="password" value="${repomanager.db.password}" /> |
|
64 |
<property name="maxIdle" value="10" /> |
|
65 |
<property name="maxActive" value="100" /> |
|
66 |
<property name="maxWait" value="10000" /> |
|
67 |
<property name="validationQuery" value="SELECT 1;" /> |
|
68 |
<property name="testOnBorrow" value="true" /> |
|
69 |
<property name="testOnReturn" value="true" /> |
|
70 |
<property name="testWhileIdle" value="true" /> |
|
71 |
<property name="timeBetweenEvictionRunsMillis" value="1200000" /> |
|
72 |
<property name="minEvictableIdleTimeMillis" value="1800000" /> |
|
73 |
<property name="numTestsPerEvictionRun" value="5" /> |
|
74 |
<property name="poolPreparedStatements" value="true" /> |
|
75 |
<property name="defaultAutoCommit" value="true" /> |
|
76 |
</bean> |
|
77 |
|
|
78 |
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> |
|
79 |
<property name="dataSource" ref="repomanager.dataSource"/> |
|
80 |
</bean> |
|
81 |
|
|
82 |
</beans> |
modules/uoa-repository-manager-service/src/main/resources/eu/dnetlib/repo/manager/service/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/src/main/resources/eu/dnetlib/repo/manager/service/application.properties | ||
---|---|---|
1 |
infrastructure.name=integration |
|
2 |
|
|
3 |
# Container properties |
|
4 |
container.hostname = localhost |
|
5 |
container.context=repoManager |
|
6 |
container.port = 8080 |
|
7 |
|
|
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 |
#ISLookUpService.url = http://localhost:9190/is/services/isLookUp |
|
13 |
#ISRegistryService.url = http://localhost:9190/is/services/isRegistry |
|
14 |
#ISSNService.url = http://localhost:9190/is/services/isSN |
|
15 |
# LDAP |
|
16 |
services.users.ldap.address = 194.177.192.119 |
|
17 |
services.users.ldap.port = 389 |
|
18 |
services.users.ldap.username = cn=admin,dc=openaire,dc=eu |
|
19 |
services.users.ldap.password = serenata |
|
20 |
services.users.ldap.usersDN = ou=users,dc=openaire,dc=eu |
|
21 |
|
|
22 |
#services.repo-manager.repository.testing.mode = true |
|
23 |
|
|
24 |
ValidatorService.url=http://adonis.athenarc.gr:8080/validator-service/services/validatorWebService |
|
25 |
|
|
26 |
# Broker Service |
|
27 |
services.broker.url = http://broker1-dev-dnet.d4science.org |
|
28 |
#services.broker.url = http://localhost |
|
29 |
services.broker.port = 8080 |
|
30 |
#services.broker.port = 9090 |
|
31 |
services.broker.api = api/ |
|
32 |
services.broker.openaire = openaireBroker |
|
33 |
|
|
34 |
# |
|
35 |
# Configuration file classpath |
|
36 |
configurationFileClassPath=classpath:application-context.xml |
|
37 |
|
|
38 |
api.baseAddress=https://dev-openaire.d4science.org/openaire |
|
39 |
|
|
40 |
service.repository-rest-api.baseUrl = http://localhost:8080 |
|
41 |
|
|
42 |
|
|
43 |
# the address where validator is running and is accessible from the controllers of the web |
|
44 |
services.repo-manager.baseUrl = http://${container.hostname}:${container.port}/${container.context} |
|
45 |
|
|
46 |
# base address for soap web services |
|
47 |
transport.soap.baseAddress = http://${container.hostname}:${container.port}/${container.context} |
|
48 |
|
|
49 |
transport.soap.force.local.address = false |
|
50 |
|
|
51 |
# the email of the administrator |
|
52 |
# he will receive all the automatic bug reports and feedback created |
|
53 |
services.repo-manager.adminEmail = nikonas@di.uoa.gr |
|
54 |
|
|
55 |
# if set to true, getRepositories will return dummy repositories |
|
56 |
services.repo-manager.repository.testing.mode = false |
|
57 |
|
|
58 |
services.repo-manager.deploy.environment = development |
|
59 |
|
|
60 |
# the mailhost for the mail service |
|
61 |
services.validator.mail.host = smtp.gmail.com |
|
62 |
# the port where the mail service is running |
|
63 |
services.validator.mail.port = 465 |
|
64 |
# the address that appears in the from field in the mails send by the validator |
|
65 |
services.validator.mail.fromAddress = no-reply@openaire.eu |
|
66 |
# the reply-to field value in the mails send by the validator |
|
67 |
services.validator.mail.replyToAddress = no-reply@openaire.eu |
|
68 |
# the username of the account used to login in the mail server |
|
69 |
services.validator.mail.username = test.openaire@gmail.com |
|
70 |
# the password of the account used to login in the mail server |
|
71 |
services.validator.mail.password = ^($*@$)*!$ |
|
72 |
# if authentication should take place |
|
73 |
# if set to false username and password is not needed |
|
74 |
services.validator.mail.authenticate = true |
|
75 |
# is set to yes then all mails will not be sent to their targets but to the address specified in services.validator.mail.overrideEmail |
|
76 |
services.validator.mail.override = false |
|
77 |
# if set to true then no mails are send, they are only logged as a debug message |
|
78 |
services.validator.mail.logonly = false |
|
79 |
# the mode used for the mails send by the validator |
|
80 |
services.validator.mail.mode = ssl |
|
81 |
# used by eu.dnetlib.utils.MailLibrary to control debuggin messages |
|
82 |
services.validator.mail.debug = false |
|
83 |
# if services.validator.mail.override is true then all mails will be send only to this address |
|
84 |
services.validator.mail.overrideEmail = nikonas@di.uoa.gr |
|
85 |
# a comma-seperated list of address that will receive all mails about validations and repo registrations |
|
86 |
services.validator.mail.specialRecipients = nikonas@di.uoa.gr |
|
87 |
|
|
88 |
# a comma-seperated list of addresses that have the ability to register repos without the need for validation and registration |
|
89 |
services.validator.repoRegistration.override = nikonas@di.uoa.gr |
|
90 |
|
|
91 |
|
|
92 |
repomanager.db.driverClassName = org.postgresql.Driver |
|
93 |
repomanager.db.url = jdbc:postgresql://194.177.192.119:5432/repomanager |
|
94 |
repomanager.db.username = dnet |
|
95 |
repomanager.db.password = dnetPwd |
|
96 |
|
|
97 |
services.repomanager.analyticsURL = http://analytics.openaire.eu/addsite.php? |
modules/uoa-repository-manager-service/src/main/resources/eu/dnetlib/repo/manager/service/utils/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/src/main/resources/eu/dnetlib/repo/manager/service/utils/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/src/main/resources/eu/dnetlib/repo/manager/service/utils/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/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:context="http://www.springframework.org/schema/context" 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 |
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd |
|
8 |
http://www.springframework.org/schema/context |
|
9 |
http://www.springframework.org/schema/context/spring-context-4.0.xsd |
|
10 |
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd |
|
11 |
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd"> |
|
12 |
|
|
13 |
<import resource="classpath*:/application-context.xml"/> |
|
14 |
|
|
15 |
<!-- <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>--> |
|
16 |
|
|
17 |
<import resource="classpath:META-INF/cxf/cxf.xml"/> |
|
18 |
|
|
19 |
<import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml"/> |
|
20 |
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/> |
|
21 |
<import resource="classpath*:/cxf.xml"/> |
|
22 |
<import resource="classpath*:/eu/dnetlib/repos/ehcacher/springContext-repos-ehcacher.xml"/> |
|
23 |
<import resource="classpath*:/eu/dnetlib/soap/cxf/applicationContext-eprbuilders.xml"/> |
|
24 |
<import resource="classpath*:/eu/dnetlib/clients/ws/springContext-locatorFactory.xml"/> |
|
25 |
<import resource="classpath*:/eu/dnetlib/users/springContext-users-ldap.xml"/> |
|
26 |
<import resource="classpath*:/gr/uoa/di/driver/util/springContext-locators.xml"/> |
|
27 |
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupFactory.xml"/> |
|
28 |
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupClients.xml"/> |
|
29 |
<import resource="classpath*:/eu/dnetlib/enabling/hcm/springContext-hcmService.xml"/> |
|
30 |
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-commons.xml"/> |
|
31 |
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml"/> |
|
32 |
|
|
33 |
<import resource="classpath*:/eu/dnetlib/repos/springContext-repos-dms-cached.xml"/> |
|
34 |
<context:property-placeholder location="classpath*:/eu/**/application.properties" /> |
|
35 |
|
|
36 |
<bean class="eu.dnetlib.repo.manager.service.config.CascadingPropertyLoader" id="propertyLoader"> |
|
37 |
<property name="order" value="2" /> |
|
38 |
<property name="properties"> |
|
39 |
<bean class="eu.dnetlib.conf.WebappContextProperyFactory"> |
|
40 |
<property name="propertyFetcher"> |
|
41 |
<bean class="eu.dnetlib.conf.PropertyFetcher" /> |
|
42 |
</property> |
|
43 |
</bean> |
|
44 |
</property> |
|
45 |
<property name="ignoreUnresolvablePlaceholders" value="true" /> |
|
46 |
<property name="locations"> |
|
47 |
<list> |
|
48 |
<value>classpath*:/gr/**/springContext-*.properties</value> |
|
49 |
<value>classpath*:/eu/**/springContext-*.properties</value> |
|
50 |
|
|
51 |
<value>classpath*:/eu/dnetlib/repo/manager/service/email-texts.properties</value> |
|
52 |
|
|
53 |
<value>classpath*:dnet-site-wizard.properties</value> |
|
54 |
<value>classpath*:dnet-site-override.properties</value> |
|
55 |
<value>classpath*:dnet-wizard.properties</value> |
|
56 |
<value>classpath*:dnet-override.properties</value> |
|
57 |
<value>classpath*:dnet-validator-wizard.properties</value> |
|
58 |
<value>classpath*:dnet-validator-override.properties</value> |
|
59 |
<value>classpath*:dnet-site-force-override.properties</value> |
|
60 |
<value>classpath*:dnet-force-override.properties</value> |
|
61 |
</list> |
|
62 |
</property> |
|
63 |
</bean> |
|
64 |
|
|
65 |
<bean id="repomanager.dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> |
|
66 |
<property name="driverClassName" value="${repomanager.db.driverClassName}" /> |
|
67 |
<property name="url" value="${repomanager.db.url}" /> |
|
68 |
<property name="username" value="${repomanager.db.username}" /> |
|
69 |
<property name="password" value="${repomanager.db.password}" /> |
|
70 |
<property name="maxIdle" value="10" /> |
|
71 |
<property name="maxActive" value="100" /> |
|
72 |
<property name="maxWait" value="10000" /> |
|
73 |
<property name="validationQuery" value="SELECT 1;" /> |
|
74 |
<property name="testOnBorrow" value="true" /> |
|
75 |
<property name="testOnReturn" value="true" /> |
|
76 |
<property name="testWhileIdle" value="true" /> |
|
77 |
<property name="timeBetweenEvictionRunsMillis" value="1200000" /> |
|
78 |
<property name="minEvictableIdleTimeMillis" value="1800000" /> |
|
79 |
<property name="numTestsPerEvictionRun" value="5" /> |
|
80 |
<property name="poolPreparedStatements" value="true" /> |
|
81 |
<property name="defaultAutoCommit" value="true" /> |
|
82 |
</bean> |
|
83 |
|
|
84 |
<tx:annotation-driven transaction-manager="txManager"/> |
|
85 |
|
|
86 |
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> |
|
87 |
<property name="dataSource" ref="repomanager.dataSource"/> |
|
88 |
</bean> |
|
89 |
|
|
90 |
<mvc:resources mapping="swagger-ui.html" location="classpath:/META-INF/resources/"/> |
|
91 |
<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/> |
|
92 |
<bean class="eu.dnetlib.repo.manager.service.config.SwaggerConfig"/> |
|
93 |
</beans> |
modules/uoa-repository-manager-service/src/main/webapp/WEB-INF/log4j.properties | ||
---|---|---|
1 |
log4j.rootLogger = WARN, R |
|
2 |
|
|
3 |
log4j.logger.eu.dnetlib = DEBUG |
|
4 |
log4j.logger.eu.dnetlib.clients.data.datasourcemanager.ws.Converter = FATAL |
|
5 |
log4j.logger.org.springframework = DEBUG, S |
|
6 |
log4j.additivity.org.springframework = false |
|
7 |
|
|
8 |
log4j.logger.com.opensymphony.xwork2.ognl.OgnlValueStack = FATAL |
|
9 |
log4j.logger.com.opensymphony.xwork2.ObjectFactory = FATAL |
|
10 |
|
|
11 |
log4j.logger.eu.dnetlib.repo.manager=DEBUG |
|
12 |
|
|
13 |
log4j.appender.R=org.apache.log4j.RollingFileAppender |
|
14 |
#log4j.appender.R.File=/var/log/dnet/repo-manager/repo-manager-gui.log |
|
15 |
log4j.appender.R.File=/tmp/repo-manager-service.log |
|
16 |
log4j.appender.R.MaxFileSize=10MB |
|
17 |
log4j.appender.R.MaxBackupIndex=10 |
|
18 |
log4j.appender.R.layout=org.apache.log4j.PatternLayout |
|
19 |
log4j.appender.R.layout.ConversionPattern= %d %p %t [%c] - %m%n |
|
20 |
|
|
21 |
log4j.appender.S=org.apache.log4j.RollingFileAppender |
|
22 |
#log4j.appender.S.File=/var/log/dnet/repo-manager/repo-manager-gui-spring.log |
|
23 |
log4j.appender.S.File=/tmp/repo-manager-service-spring.log |
|
24 |
log4j.appender.S.MaxFileSize=10MB |
|
25 |
log4j.appender.S.MaxBackupIndex=10 |
|
26 |
log4j.appender.S.layout=org.apache.log4j.PatternLayout |
|
27 |
log4j.appender.S.layout.ConversionPattern= %d %p %t [%c] - %m%n |
|
28 |
|
|
29 |
|
|
30 |
#org.apache.cxf.Logger=org.apache.cxf.common.logging.Log4jLogger |
|
31 |
# |
|
32 |
#log4j.rootLogger=INFO, CONSOLE |
|
33 |
#log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender |
|
34 |
#log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout |
|
35 |
#log4j.appender.CONSOLE.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n |
|
36 |
# |
|
37 |
#log4j.logger.eu.dnetlib.repo.manager=DEBUG |
modules/uoa-repository-manager-service/src/main/webapp/WEB-INF/web.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd |
|
5 |
http://xmlns.jcp.org/xml/ns/javaee " |
|
6 |
version="3.1"> |
|
7 |
|
|
8 |
<context-param> |
|
9 |
<param-name>log4jConfigLocation</param-name> |
|
10 |
<param-value>/WEB-INF/log4j.properties</param-value> |
|
11 |
</context-param> |
|
12 |
<context-param> |
|
13 |
<param-name>log4jRefreshInterval</param-name> |
|
14 |
<param-value>1000</param-value> |
|
15 |
</context-param> |
|
16 |
<context-param> |
|
17 |
<param-name>log4jExposeWebAppRoot</param-name> |
|
18 |
<param-value>false</param-value> |
|
19 |
</context-param> |
|
20 |
<listener> |
|
21 |
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> |
|
22 |
</listener> |
|
23 |
|
|
24 |
|
|
25 |
<listener> |
|
26 |
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> |
|
27 |
</listener> |
|
28 |
|
|
29 |
<context-param> |
|
30 |
<param-name>contextConfigLocation</param-name> |
|
31 |
<param-value>/WEB-INF/applicationContext.xml |
|
32 |
</param-value> |
|
33 |
</context-param> |
|
34 |
|
|
35 |
|
|
36 |
<servlet> |
|
37 |
<servlet-name>spring</servlet-name> |
|
38 |
<servlet-class> |
|
39 |
org.springframework.web.servlet.DispatcherServlet |
|
40 |
</servlet-class> |
|
41 |
<load-on-startup>1</load-on-startup> |
|
42 |
</servlet> |
|
43 |
|
|
44 |
<servlet-mapping> |
|
45 |
<servlet-name>spring</servlet-name> |
|
46 |
<url-pattern>/</url-pattern> |
|
47 |
</servlet-mapping> |
|
48 |
|
|
49 |
</web-app> |
modules/uoa-repository-manager-service/src/main/webapp/WEB-INF/spring-servlet.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<beans:beans xmlns="http://www.springframework.org/schema/mvc" |
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xmlns:beans="http://www.springframework.org/schema/beans" |
|
5 |
xmlns:task="http://www.springframework.org/schema/task" |
|
6 |
xmlns:mvc="http://www.springframework.org/schema/mvc" |
|
7 |
xmlns:context="http://www.springframework.org/schema/context" |
|
8 |
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd |
|
9 |
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd |
|
10 |
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> |
|
11 |
|
|
12 |
<context:property-placeholder location="classpath*:/eu/**/application.properties" /> |
|
13 |
<context:annotation-config/> |
|
14 |
<context:component-scan base-package="eu.dnetlib.repo.manager.service.controllers"/> |
|
15 |
<mvc:annotation-driven/> |
|
16 |
</beans:beans> |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/config/RepoManagerContextLoaderListener.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.config; |
|
2 |
|
|
3 |
import org.apache.commons.lang.ArrayUtils; |
|
4 |
import org.apache.log4j.Logger; |
|
5 |
import org.springframework.beans.BeansException; |
|
6 |
import org.springframework.context.support.ClassPathXmlApplicationContext; |
|
7 |
import org.springframework.web.context.ContextLoaderListener; |
|
8 |
import org.springframework.web.context.WebApplicationContext; |
|
9 |
import org.springframework.web.context.support.XmlWebApplicationContext; |
|
10 |
|
|
11 |
import javax.servlet.ServletContext; |
|
12 |
import java.util.Properties; |
|
13 |
|
|
14 |
public class RepoManagerContextLoaderListener extends ContextLoaderListener { |
|
15 |
private static Logger logger = Logger.getLogger(RepoManagerContextLoaderListener.class); |
|
16 |
|
|
17 |
|
|
18 |
public RepoManagerContextLoaderListener() { |
|
19 |
super(); |
|
20 |
} |
|
21 |
|
|
22 |
public RepoManagerContextLoaderListener(WebApplicationContext context) { |
|
23 |
super(context); |
|
24 |
} |
|
25 |
|
|
26 |
@Override |
|
27 |
protected WebApplicationContext createWebApplicationContext( |
|
28 |
ServletContext servletContext) |
|
29 |
throws BeansException { |
|
30 |
logger.debug("Creating web application context"); |
|
31 |
Properties props = this.loadProperties(); |
|
32 |
String repoMode = props.getProperty("services.validator.mode.repo"); |
|
33 |
String userMode = props.getProperty("services.validator.mode.user"); |
|
34 |
Boolean standaloneMode = Boolean.parseBoolean(props.getProperty("services.validator.mode.standalone")); |
|
35 |
|
|
36 |
logger.info("User mode: " + userMode); |
|
37 |
logger.info("Repo mode: " + repoMode); |
|
38 |
logger.info("Standalone mode: " + standaloneMode); |
|
39 |
// logger.info("Dnet workflow enabled: " + repoMode); |
|
40 |
XmlWebApplicationContext ctx = new XmlWebApplicationContext(); |
|
41 |
|
|
42 |
ctx.setServletContext(servletContext); |
|
43 |
|
|
44 |
String userApiContext = null; |
|
45 |
if (userMode.equalsIgnoreCase("local")) |
|
46 |
userApiContext = "eu/dnetlib/validator/web/api/impls/users/springContext-validator-user-local.xml"; |
|
47 |
else if (userMode.equalsIgnoreCase("ldap")) |
|
48 |
userApiContext = "eu/dnetlib/users/springContext-users-ldap.xml"; |
|
49 |
|
|
50 |
String[] springContextCore = new String[] { |
|
51 |
"classpath:META-INF/cxf/cxf.xml", |
|
52 |
"classpath:META-INF/cxf/cxf-extension-soap.xml", |
|
53 |
"classpath:META-INF/cxf/cxf-extension-jaxws.xml", |
|
54 |
"classpath:META-INF/cxf/cxf-servlet.xml", |
|
55 |
"classpath*:/cxf.xml", |
|
56 |
"classpath*:/eu/dnetlib/repos/ehcacher/springContext-repos-ehcacher.xml", |
|
57 |
"classpath*:/eu/dnetlib/clients/ws/springContext-locatorFactory.xml", |
|
58 |
"classpath*:/eu/dnetlib/soap/cxf/applicationContext-eprbuilders.xml", |
|
59 |
// "classpath*:/eu/dnetlib/validator/web/actions/springContext-validator-struts.xml", |
|
60 |
// "classpath*:/eu/dnetlib/validator/web/actions/springContext-validator-emailer.xml", |
|
61 |
// "classpath*:/eu/dnetlib/validator/web/config/springContext-validator.xml", |
|
62 |
"classpath*:/eu/dnetlib/repo/manager/server/config/springContext-repo-manager-config.xml", |
|
63 |
// "classpath*:/eu/dnetlib/validator/commons/dao/springContext-*.xml", |
|
64 |
"classpath*:/eu/dnetlib/repos/springContext-repos-" + repoMode + ".xml", |
|
65 |
"classpath*:/" + userApiContext |
|
66 |
}; |
|
67 |
|
|
68 |
|
|
69 |
String[] springContextForStandalone = new String[] { |
|
70 |
}; |
|
71 |
|
|
72 |
String[] springContextForIS = new String[] { |
|
73 |
"classpath*:/gr/uoa/di/driver/util/springContext-locators.xml", |
|
74 |
"classpath*:/gr/uoa/di/driver/app/springContext-lookupFactory.xml", |
|
75 |
"classpath*:/gr/uoa/di/driver/app/springContext-lookupClients.xml", |
|
76 |
"classpath*:/eu/dnetlib/enabling/hcm/springContext-hcmService.xml", |
|
77 |
"classpath*:/gr/uoa/di/driver/app/springContext-commons.xml", |
|
78 |
"classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml" |
|
79 |
}; |
|
80 |
|
|
81 |
if (standaloneMode) { |
|
82 |
logger.debug("Loading contexts for standalone mode"); |
|
83 |
ctx.setConfigLocations((String[])ArrayUtils.addAll(springContextCore,springContextForStandalone)); |
|
84 |
} else { |
|
85 |
logger.debug("Loading contexts for dnet"); |
|
86 |
ctx.setConfigLocations((String[])ArrayUtils.addAll(springContextCore,springContextForIS)); |
|
87 |
} |
|
88 |
|
|
89 |
ctx.refresh(); |
|
90 |
|
|
91 |
logger.debug("done"); |
|
92 |
|
|
93 |
return ctx; |
|
94 |
} |
|
95 |
|
|
96 |
private Properties loadProperties() { |
|
97 |
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] { |
|
98 |
"classpath*:/eu/dnetlib/repo/manager/server/config/springContext-repo-manager-config.xml" |
|
99 |
}); |
|
100 |
|
|
101 |
CascadingPropertyLoader pLoader = (CascadingPropertyLoader) ctx.getBean("propertyLoader"); |
|
102 |
Properties props = pLoader.getProperties(); |
|
103 |
|
|
104 |
ctx.destroy(); |
|
105 |
ctx.close(); |
|
106 |
return props; |
|
107 |
} |
|
108 |
|
|
109 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/config/SwaggerConfig.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.config; |
|
2 |
|
|
3 |
import eu.dnetlib.repo.manager.service.controllers.MonitorApi; |
|
4 |
import eu.dnetlib.repo.manager.service.controllers.PiWikApi; |
|
5 |
import eu.dnetlib.repo.manager.service.controllers.RepositoryApi; |
|
6 |
import eu.dnetlib.repo.manager.service.controllers.ValidatorApi; |
|
7 |
import org.springframework.context.annotation.Bean; |
|
8 |
import org.springframework.context.annotation.ComponentScan; |
|
9 |
import org.springframework.context.annotation.Configuration; |
|
10 |
import org.springframework.web.servlet.config.annotation.EnableWebMvc; |
|
11 |
import springfox.documentation.builders.PathSelectors; |
|
12 |
import springfox.documentation.builders.RequestHandlerSelectors; |
|
13 |
import springfox.documentation.service.ApiInfo; |
|
14 |
import springfox.documentation.service.Contact; |
|
15 |
import springfox.documentation.service.VendorExtension; |
|
16 |
import springfox.documentation.spi.DocumentationType; |
|
17 |
import springfox.documentation.spring.web.plugins.Docket; |
|
18 |
import springfox.documentation.swagger2.annotations.EnableSwagger2; |
|
19 |
import java.util.ArrayList; |
|
20 |
|
|
21 |
|
|
22 |
/** |
|
23 |
* Created by panagiotis on 16/11/2017. |
|
24 |
*/ |
|
25 |
@Configuration |
|
26 |
@EnableSwagger2 |
|
27 |
@EnableWebMvc |
|
28 |
@ComponentScan(basePackageClasses = { |
|
29 |
RepositoryApi.class, |
|
30 |
MonitorApi.class, |
|
31 |
ValidatorApi.class, |
|
32 |
PiWikApi.class |
|
33 |
}) |
|
34 |
public class SwaggerConfig { |
|
35 |
|
|
36 |
@Bean |
|
37 |
public Docket productApi() { |
|
38 |
return new Docket(DocumentationType.SWAGGER_2) |
|
39 |
.select() |
|
40 |
.apis(RequestHandlerSelectors.any()) |
|
41 |
.paths(PathSelectors.any()) |
|
42 |
.build() |
|
43 |
.pathMapping("/") |
|
44 |
.apiInfo(getApiInfo()); |
|
45 |
} |
|
46 |
|
|
47 |
private ApiInfo getApiInfo() { |
|
48 |
return new ApiInfo("Repository Manager Dashboard API Documentation", |
|
49 |
"Repository Manager Dashboard API Documentation", |
|
50 |
"1.0", |
|
51 |
"urn:tos", |
|
52 |
new Contact("", "", ""), |
|
53 |
"Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0", |
|
54 |
new ArrayList<VendorExtension>()); |
|
55 |
} |
|
56 |
|
|
57 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/config/CascadingPropertyLoader.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.config; |
|
2 |
|
|
3 |
import org.springframework.beans.BeansException; |
|
4 |
import org.springframework.beans.factory.InitializingBean; |
|
5 |
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; |
|
6 |
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; |
|
7 |
|
|
8 |
import java.util.Properties; |
|
9 |
|
|
10 |
/** |
|
11 |
* CascadingPropertyLoader loads a number of property files and mergers them together, so that the last properties |
|
12 |
* override the previous. It also supports property expansion like: |
|
13 |
* |
|
14 |
* <code> |
|
15 |
* something = 1 |
|
16 |
* somethingelse = 2 |
|
17 |
* test = ${something}/${somethingelse} |
|
18 |
* </code> |
|
19 |
* |
|
20 |
* <p> |
|
21 |
* And if you override something to XX, then test will become XX/2 |
|
22 |
* </p> |
|
23 |
* |
|
24 |
* |
|
25 |
* @author marko |
|
26 |
* |
|
27 |
*/ |
|
28 |
public class CascadingPropertyLoader extends PropertyPlaceholderConfigurer implements InitializingBean { |
|
29 |
|
|
30 |
private Properties properties; |
|
31 |
|
|
32 |
public void afterPropertiesSet() throws Exception { |
|
33 |
this.properties = mergeProperties(); |
|
34 |
|
|
35 |
// Convert the merged properties, if necessary. |
|
36 |
convertProperties(this.properties); |
|
37 |
|
|
38 |
logger.debug("Properties: " + properties); |
|
39 |
} |
|
40 |
|
|
41 |
@Override |
|
42 |
protected void processProperties(final ConfigurableListableBeanFactory beanFactoryToProcess, final Properties props) throws BeansException { |
|
43 |
super.processProperties(beanFactoryToProcess, props); |
|
44 |
} |
|
45 |
|
|
46 |
public Properties getProperties() { |
|
47 |
return properties; |
|
48 |
} |
|
49 |
|
|
50 |
public void setProperties(final Properties properties) { |
|
51 |
super.setProperties(properties); |
|
52 |
|
|
53 |
this.properties = properties; |
|
54 |
} |
|
55 |
} |
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/controllers/RepositoryApiImpl.java | ||
---|---|---|
1 |
package eu.dnetlib.repo.manager.service.controllers; |
|
2 |
|
|
3 |
import com.fasterxml.jackson.databind.DeserializationFeature; |
|
4 |
import com.fasterxml.jackson.databind.ObjectMapper; |
|
5 |
import eu.dnetlib.domain.data.Repository; |
|
6 |
import eu.dnetlib.domain.data.RepositoryInterface; |
|
7 |
import eu.dnetlib.domain.enabling.Vocabulary; |
|
8 |
import eu.dnetlib.repo.manager.service.utils.Converter; |
|
9 |
import eu.dnetlib.repo.manager.shared.Aggregations; |
|
10 |
import eu.dnetlib.repo.manager.shared.Constants; |
|
11 |
import eu.dnetlib.repo.manager.shared.Country; |
|
12 |
import eu.dnetlib.repo.manager.shared.Timezone; |
|
13 |
import gr.uoa.di.driver.enabling.vocabulary.VocabularyLoader; |
|
14 |
import org.apache.log4j.Logger; |
|
15 |
import org.json.JSONArray; |
|
16 |
import org.json.JSONException; |
|
17 |
import org.json.JSONObject; |
|
18 |
import org.springframework.beans.factory.annotation.Autowired; |
|
19 |
import org.springframework.beans.factory.annotation.Value; |
|
20 |
import org.springframework.http.HttpEntity; |
|
21 |
import org.springframework.http.HttpHeaders; |
|
22 |
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; |
|
23 |
import org.springframework.stereotype.Component; |
|
24 |
import org.springframework.web.bind.annotation.PathVariable; |
|
25 |
import org.springframework.web.bind.annotation.RequestBody; |
|
26 |
import org.springframework.web.bind.annotation.RequestParam; |
|
27 |
import org.springframework.web.client.RestTemplate; |
|
28 |
import org.springframework.web.util.UriComponents; |
|
29 |
import org.springframework.web.util.UriComponentsBuilder; |
|
30 |
|
|
31 |
import javax.annotation.PostConstruct; |
|
32 |
import javax.ws.rs.Path; |
|
33 |
import javax.ws.rs.QueryParam; |
|
34 |
import java.io.IOException; |
|
35 |
import java.sql.Timestamp; |
|
36 |
import java.text.Normalizer; |
|
37 |
import java.util.*; |
|
38 |
import java.util.concurrent.ConcurrentHashMap; |
|
39 |
|
|
40 |
@Component |
|
41 |
public class RepositoryApiImpl implements RepositoryApi { |
|
42 |
|
|
43 |
@Value("${api.baseAddress}") |
|
44 |
private String baseAddress; |
|
45 |
|
|
46 |
private RestTemplate restTemplate = null; |
|
47 |
|
|
48 |
private HttpHeaders httpHeaders; |
|
49 |
|
|
50 |
private final String[] vocabularyNames = {"dnet:countries", "dnet:datasource_typologies", "dnet:compatibilityLevel"}; |
|
51 |
|
|
52 |
private static final Logger LOGGER = Logger.getLogger(RepositoryApiImpl.class); |
|
53 |
|
|
54 |
@Autowired |
|
55 |
private VocabularyLoader vocabularyLoader; |
|
56 |
|
|
57 |
private Map<String, Vocabulary> vocabularyMap = new ConcurrentHashMap<String, Vocabulary>(); |
|
58 |
|
|
59 |
private Map<String, String> countriesMap = new HashMap<>(); |
|
60 |
private Map<String, String> inverseCountriesMap = new HashMap<>(); |
|
61 |
|
|
62 |
|
|
63 |
@PostConstruct |
|
64 |
private void init() { |
|
65 |
LOGGER.debug("Initialization method of repository api!"); |
|
66 |
|
|
67 |
restTemplate = new RestTemplate(); |
|
68 |
restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter()); |
|
69 |
|
|
70 |
httpHeaders = new HttpHeaders(); |
|
71 |
httpHeaders.set("Content-Type", "application/json"); |
|
72 |
|
|
73 |
for (String vocName : vocabularyNames) { |
|
74 |
vocabularyMap.put(vocName, vocabularyLoader.getVocabulary(vocName, Locale.ENGLISH, Locale.ROOT)); |
|
75 |
} |
|
76 |
|
|
77 |
Country[] countries = getCountries(); |
|
78 |
for (Country c : countries) { |
|
79 |
countriesMap.put(c.getName(), c.getCode()); |
|
80 |
inverseCountriesMap.put(c.getCode(), c.getName()); |
|
81 |
} |
|
82 |
|
|
83 |
|
|
84 |
} |
|
85 |
|
|
86 |
@Override |
|
87 |
public List<String> testAggregations() throws JSONException { |
|
88 |
|
|
89 |
int page = 0; |
|
90 |
int size = 1000; |
|
91 |
|
|
92 |
UriComponents uriComponents = UriComponentsBuilder |
|
93 |
.fromHttpUrl(baseAddress + "/ds/list/") |
|
94 |
.path("/{page}/{size}/") |
|
95 |
.build().expand(page, size).encode(); |
|
96 |
|
|
97 |
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class); |
|
98 |
List<String> ids = new ArrayList<>(); |
|
99 |
while (!rs.equals("[]")) { |
|
100 |
|
|
101 |
ids.addAll(getIdsWithNonEmptyAggregations(rs)); |
|
102 |
|
|
103 |
LOGGER.debug("Checked " + (page + 1) * size + " records!"); |
|
104 |
|
|
105 |
page += 1; |
|
106 |
uriComponents = UriComponentsBuilder |
|
107 |
.fromHttpUrl(baseAddress + "/ds/list/") |
|
108 |
.path("/{page}/{size}/") |
|
109 |
.build().expand(page, size).encode(); |
|
110 |
rs = restTemplate.getForObject(uriComponents.toUri(), String.class); |
|
111 |
} |
|
112 |
|
|
113 |
return ids; |
|
114 |
} |
|
115 |
|
|
116 |
private List<String> getIdsWithNonEmptyAggregations(String rs) throws JSONException { |
|
117 |
|
|
118 |
JSONArray ids = new JSONArray(rs); |
|
119 |
List<String> agg_ids = new ArrayList<>(); |
|
120 |
for (int i = 0; i < ids.length(); i++) { |
|
121 |
String id = ids.getString(i); |
|
122 |
Aggregations aggregations = getRepositoryAggregations(id); |
|
123 |
if (aggregations.getAggregationHistory() != null) |
|
124 |
agg_ids.add(id); |
|
125 |
} |
|
126 |
return agg_ids; |
|
127 |
} |
|
128 |
|
|
129 |
@Override |
|
130 |
public Country[] getCountries() { |
|
131 |
UriComponents uriComponents = UriComponentsBuilder |
|
132 |
.fromHttpUrl(baseAddress + "/ds/countries") |
|
133 |
.build().encode(); |
|
134 |
return restTemplate.getForObject(uriComponents.toUri(), Country[].class); |
|
135 |
} |
|
136 |
|
|
137 |
|
|
138 |
@Override |
|
139 |
public List<Repository> getRepositoriesByCountry(@PathVariable("country") String country, |
|
140 |
@PathVariable("mode") String mode) throws JSONException { |
|
141 |
|
|
142 |
LOGGER.debug("Getting repositories by country!"); |
|
143 |
int page = 0; |
|
144 |
int size = 100; |
|
145 |
|
|
146 |
String countryCode = countriesMap.get(country); |
|
147 |
String filterKey = "UNKNOWN"; |
|
148 |
if (mode.equalsIgnoreCase("opendoar")) { |
|
149 |
filterKey = "openaire____::opendoar"; |
|
150 |
} else if (mode.equalsIgnoreCase("re3data")) { |
|
151 |
filterKey = "openaire____::re3data"; |
|
152 |
} else if (mode.equalsIgnoreCase("jour_aggr")) { |
|
153 |
filterKey = "infrastruct_::openaire"; |
|
154 |
} |
|
155 |
|
|
156 |
LOGGER.debug("Country code equals : " + countryCode); |
|
157 |
LOGGER.debug("Filter mode equals : " + filterKey); |
|
158 |
UriComponents uriComponents = UriComponentsBuilder |
|
159 |
.fromHttpUrl(baseAddress + "/ds/search/country/") |
|
160 |
.path("/{page}/{size}/") |
|
161 |
.queryParam("country", countryCode) |
|
162 |
.build().expand(page, size).encode(); |
|
163 |
|
|
164 |
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class); |
|
165 |
List<Repository> resultSet = new ArrayList<>(); |
|
166 |
while (!rs.equals("[]")) { |
|
167 |
List<Repository> rep = Converter.jsonToRepositoryList(new JSONArray(rs)); |
|
168 |
|
|
169 |
Collection<Repository> repos = this.getRepositoriesByMode(filterKey, rep); |
|
170 |
resultSet.addAll(repos); |
|
171 |
|
|
172 |
page += 1; |
|
173 |
uriComponents = UriComponentsBuilder |
|
174 |
.fromHttpUrl(baseAddress + "/ds/search/country/") |
|
175 |
.path("/{page}/{size}/") |
|
176 |
.queryParam("country", countryCode) |
|
177 |
.build().expand(page, size).encode(); |
|
178 |
rs = restTemplate.getForObject(uriComponents.toUri(), String.class); |
|
179 |
} |
|
180 |
for (Repository r : resultSet){ |
|
181 |
r.setInterfaces(this.getRepositoryInterface(r.getId())); |
|
182 |
r.setCountryName(getCountryName(r.getCountryCode())); |
|
183 |
} |
|
184 |
|
|
185 |
return resultSet; |
|
186 |
} |
|
187 |
|
|
188 |
|
|
189 |
private Collection<Repository> getRepositoriesByMode(String mode, List<Repository> rs) { |
|
190 |
|
|
191 |
List<Repository> reps = new ArrayList<>(); |
|
192 |
for (Repository r : rs) { |
|
193 |
if (r.getCollectedFrom().equals(mode)) |
|
194 |
reps.add(r); |
|
195 |
} |
|
196 |
return reps; |
|
197 |
} |
|
198 |
|
|
199 |
@Override |
|
200 |
public List<Repository> getRepositoriesOfUser(@PathVariable("userEmail") String userEmail, |
|
201 |
@PathVariable("page") String page, |
|
202 |
@PathVariable("size") String size) throws JSONException { |
|
203 |
|
|
204 |
LOGGER.debug("Retreiving repositories of user : " + userEmail ); |
|
205 |
UriComponents uriComponents = UriComponentsBuilder |
|
206 |
.fromHttpUrl(baseAddress + "/ds/search/registeredby/") |
|
207 |
.path("/{page}/{size}/") |
|
208 |
.queryParam("registeredBy", userEmail) |
|
209 |
.build().expand(page, size).encode(); |
|
210 |
|
|
211 |
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class); |
|
212 |
List<Repository> repos = Converter.jsonToRepositoryList(new JSONArray(rs)); |
|
213 |
for (Repository r : repos){ |
|
214 |
r.setInterfaces(this.getRepositoryInterface(r.getId())); |
|
215 |
r.setCountryName(getCountryName(r.getCountryCode())); |
|
216 |
} |
|
217 |
|
|
218 |
return repos; |
|
219 |
} |
|
220 |
|
|
221 |
@Override |
|
222 |
public Repository getRepositoryById(@PathVariable("id") String id) throws JSONException { |
|
223 |
|
|
224 |
UriComponents uriComponents = UriComponentsBuilder |
|
225 |
.fromHttpUrl(baseAddress + "/ds/get/") |
|
226 |
.path("/{id}/") |
|
227 |
.build().expand(id).encode(); |
|
228 |
|
|
229 |
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class); |
|
230 |
Repository repo = Converter.jsonToRepositoryObject(new JSONObject(rs)); |
|
231 |
if (repo != null) { |
|
232 |
repo.setCountryName(getCountryName(repo.getCountryCode())); |
|
233 |
repo.setInterfaces(this.getRepositoryInterface(repo.getId())); |
|
234 |
} |
|
235 |
return repo; |
|
236 |
} |
|
237 |
|
|
238 |
|
|
239 |
@Override |
|
240 |
public Aggregations getRepositoryAggregations(@PathVariable("id") String id) throws JSONException { |
|
241 |
|
|
242 |
UriComponents uriComponents = UriComponentsBuilder |
|
243 |
.fromHttpUrl(baseAddress + "/ds/get/") |
|
244 |
.path("/{id}/") |
|
245 |
.build().expand(id).encode(); |
|
246 |
|
|
247 |
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class); |
|
248 |
JSONObject repository = new JSONObject(rs); |
|
249 |
|
|
250 |
Aggregations aggregations = new Aggregations(); |
|
251 |
|
|
252 |
try { |
|
253 |
aggregations.setAggregationHistory(Converter.getAggregationHistoryFromJson(repository)); |
|
254 |
aggregations.setLastCollection(Converter.getLastCollectionFromJson(repository)); |
|
255 |
aggregations.setLastTransformation(Converter.getLastTransformationFromJson(repository)); |
|
256 |
return aggregations; |
|
257 |
} catch (JSONException e) { |
|
258 |
LOGGER.debug("JSON aggregation exception ", e); |
|
259 |
throw e; |
|
260 |
} |
|
261 |
|
|
262 |
} |
|
263 |
|
|
264 |
@Override |
|
265 |
public List<Repository> getRepositoriesByName(@PathVariable("name") String name, |
|
266 |
@PathVariable("page") String page, |
|
267 |
@PathVariable("size") String size) throws JSONException { |
|
268 |
UriComponents uriComponents = UriComponentsBuilder |
|
269 |
.fromHttpUrl(baseAddress + "/ds/search/name/") |
|
270 |
.path("/{page}/{size}") |
|
271 |
.queryParam("name", name) |
|
272 |
.build().expand(page, size).encode(); |
|
273 |
|
|
274 |
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class); |
|
275 |
List<Repository> repos = Converter.jsonToRepositoryList(new JSONArray(rs)); |
|
276 |
for (Repository r : repos){ |
|
277 |
// r.setInterfaces(this.getRepositoryInterface(r.getId())); |
|
278 |
r.setCountryName(getCountryName(r.getCountryCode())); |
|
279 |
} |
|
280 |
return repos; |
|
281 |
} |
|
282 |
|
|
283 |
@Override |
|
284 |
public List<RepositoryInterface> getRepositoryInterface(@PathVariable("id") String id) throws JSONException { |
|
285 |
|
|
286 |
UriComponents uriComponents = UriComponentsBuilder |
|
287 |
.fromHttpUrl(baseAddress + "/ds/api/") |
|
288 |
.path("/{id}/") |
|
289 |
.build().expand(id).encode(); |
|
290 |
|
|
291 |
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class); |
|
292 |
return Converter.jsonToRepositoryInterfaceList(new JSONArray(rs)); |
|
293 |
} |
|
294 |
|
|
295 |
@Override |
|
296 |
public void addRepository(@RequestParam("datatype") String datatype, |
|
297 |
@RequestBody Repository repository) throws Exception { |
|
298 |
|
|
299 |
/*JSONObject json_params = new JSONObject(params); |
|
300 |
String datatype = json_params.getString("datatype"); |
|
301 |
String json_repository = json_params.getString("repository"); |
|
302 |
Repository repository = null;*/ |
|
303 |
ObjectMapper mapper = new ObjectMapper(); |
|
304 |
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); |
|
305 |
try { |
|
306 |
String json_repo = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(repository); |
|
307 |
LOGGER.debug("repository -> " + json_repo); |
|
308 |
// repository = mapper.readValue(json_repository, Repository.class); |
|
309 |
} catch (Exception e) { |
|
310 |
LOGGER.debug("Error parsing repository ", e); |
|
311 |
throw e; |
|
312 |
} |
|
313 |
repository = this.setRepositoryFeatures(datatype,repository); |
|
314 |
|
|
315 |
LOGGER.debug("storing " + datatype + " repository with id: " + repository.getId()); |
|
316 |
if (!datatype.equalsIgnoreCase("opendoar") && !datatype.equalsIgnoreCase("re3data")) { |
|
317 |
if (datatype.equalsIgnoreCase("journal") || datatype.equalsIgnoreCase("aggregator")) { |
|
318 |
LOGGER.debug("looking if " + datatype + " " + repository.getOfficialName() + " is already in datasources"); |
|
319 |
if (getRepositoryById(repository.getId()) != null) { |
|
320 |
String retMessage = datatype + " '" + repository.getOfficialName() + "' is already in datasources."; |
|
321 |
repository.getInterfaces().clear(); |
|
322 |
LOGGER.debug(retMessage); |
|
323 |
} else { |
|
324 |
LOGGER.debug(datatype + " " + repository.getOfficialName() + " is not in datasources. Inserting.."); |
|
325 |
this.storeRepository(repository); |
|
326 |
} |
|
327 |
} |
|
328 |
} else { |
|
329 |
this.updateRepository(repository); |
|
330 |
} |
|
331 |
|
|
332 |
LOGGER.debug("Inserting Interfaces"); |
|
333 |
Iterator var11 = repository.getInterfaces().iterator(); |
|
334 |
|
|
335 |
while (var11.hasNext()) { |
|
336 |
RepositoryInterface iFace = (RepositoryInterface) var11.next(); |
|
337 |
if (!iFace.getBaseUrl().isEmpty() && !iFace.getDesiredCompatibilityLevel().isEmpty()) { |
|
338 |
if (iFace.getId() != null && !iFace.getId().isEmpty()) { |
|
339 |
LOGGER.debug("updating iface.."); |
|
340 |
this.updateInterface(datatype,iFace); |
|
341 |
LOGGER.debug("updated successfully"); |
|
342 |
} else { |
|
343 |
LOGGER.debug("adding new iface.."); |
|
344 |
this.registerRepositoryInterface(repository.getId(),iFace,datatype); |
|
345 |
} |
|
346 |
} |
|
347 |
} |
|
348 |
} |
|
349 |
|
|
350 |
private void updateRepository(Repository repository) { |
|
351 |
this.updateRegisteredByValue(repository.getId(),repository.getRegisteredBy()); |
|
352 |
this.updateEnglishName(repository.getId(),repository.getEnglishName()); |
|
353 |
this.updateLogoUrl(repository.getId(),repository.getLogoUrl()); |
|
354 |
this.updateTimezone(repository.getId(), String.valueOf(repository.getTimezone())); |
|
355 |
//TODO update datasource type |
|
356 |
} |
|
357 |
|
|
358 |
private void updateRegisteredByValue(String id, String registeredBy) { |
|
359 |
|
|
360 |
LOGGER.debug("Updating registered by value with : " + registeredBy ); |
|
361 |
UriComponents uriComponents = UriComponentsBuilder |
|
362 |
.fromHttpUrl(baseAddress + "/ds/registeredby/") |
|
363 |
.queryParam("dsId",id) |
|
364 |
.queryParam("registeredBy", registeredBy) |
|
365 |
.build() |
|
366 |
.encode(); |
|
367 |
|
|
368 |
restTemplate.postForObject(uriComponents.toUri(), null,String.class); |
|
369 |
} |
|
370 |
|
|
371 |
private Repository setRepositoryFeatures(String datatype, Repository repository) { |
|
372 |
|
|
373 |
//TODO update map |
|
374 |
repository.setCountryCode(countriesMap.get(repository.getCountryName())); |
|
375 |
|
|
376 |
repository.setActivationId(UUID.randomUUID().toString()); |
|
377 |
// repo.setRegisteredBy((String) session.get(LocalVocabularies.loggedInField)); |
|
378 |
|
|
379 |
if (datatype.equals("opendoar") || datatype.equals("re3data")) { |
|
380 |
repository.setProvenanceActionClass("sysimport:crosswalk:entityregistry"); |
|
381 |
} else if (datatype.equals("journal")) { |
|
382 |
repository.setProvenanceActionClass("user:insert"); |
|
383 |
repository.setCollectedFrom("infrastruct_::openaire"); |
|
384 |
if (repository.getIssn() != null && repository.getIssn().length() == 0) |
|
385 |
repository.setIssn(com.unboundid.util.Base64.encode(repository.getOfficialName()).substring(0, 8)); |
|
386 |
repository.setId("openaire____::issn" + repository.getIssn()); |
|
387 |
repository.setNamespacePrefix("issn" + repository.getIssn()); |
|
388 |
} else if (datatype.equals("aggregator")) { |
|
389 |
repository.setProvenanceActionClass("user:insert"); |
|
390 |
repository.setCollectedFrom("infrastruct_::openaire"); |
|
391 |
repository.setId("openaire____::" + com.unboundid.util.Base64.encode(repository.getOfficialName())); |
|
392 |
repository.setNamespacePrefix(Normalizer.normalize(repository.getOfficialName().toLowerCase().replace(" ", "_"), Normalizer.Form.NFD).replaceAll("[^a-zA-Z0-9]", "")); |
|
393 |
if (repository.getNamespacePrefix().length() > 12) { |
|
394 |
repository.setNamespacePrefix(repository.getNamespacePrefix().substring(0, 12)); |
|
395 |
} else { |
|
396 |
while (repository.getNamespacePrefix().length() < 12) |
|
397 |
repository.setNamespacePrefix(repository.getNamespacePrefix().concat("_")); |
|
398 |
} |
|
399 |
} |
|
400 |
return repository; |
|
401 |
} |
|
402 |
|
|
403 |
private void updateInterface(String datatype,RepositoryInterface iFace) { |
|
404 |
//TODO call update base url |
|
405 |
//((DatasourceManagerService) this.dmService.getService()).updateBaseUrl(repo.getId(), iFace.getId(), iFace.getBaseUrl()); |
|
406 |
if (!iFace.getAccessSet().isEmpty()) { |
|
407 |
LOGGER.debug("set not empty: " + iFace.getAccessSet()); |
|
408 |
//TODO call update method for access params |
|
409 |
// ((DatasourceManagerService) this.dmService.getService()).updateAccessParam(repo.getId(), iFace.getId(), "set", iFace.getAccessSet(), false); |
|
410 |
} else { |
|
411 |
//TODO call deleteAccessParamOrExtraField |
|
412 |
//((DatasourceManagerService) this.dmService.getService()).deleteAccessParamOrExtraField(repo.getId(), iFace.getId(), "set"); |
|
413 |
} |
|
414 |
//TODO update content description |
|
415 |
//((DatasourceManagerService) this.dmService.getService()).updateContentDescription(repo.getId(), iFace.getId(), "metadata"); |
|
416 |
if (datatype.equals("re3data")) { |
|
417 |
//TODO call update access params |
|
418 |
// ((DatasourceManagerService) this.dmService.getService()).updateAccessParam(repo.getId(), iFace.getId(), "format", "oai_datacite", false); |
|
419 |
iFace.setAccessFormat("oai_datacite"); |
|
420 |
} else { |
|
421 |
//TODO call update access params |
|
422 |
//((DatasourceManagerService) this.dmService.getService()).updateAccessParam(repo.getId(), iFace.getId(), "format", "oai_dc", false); |
|
423 |
iFace.setAccessFormat("oai_dc"); |
|
424 |
} |
|
425 |
|
|
426 |
} |
|
427 |
|
|
428 |
private RepositoryInterface createRepositoryInterface(Repository repo, RepositoryInterface iFace, String datatype) { |
|
429 |
|
|
430 |
iFace.setContentDescription("metadata"); |
|
431 |
iFace.setCompliance("UNKNOWN"); |
|
432 |
if (datatype.equals("re3data")) { |
|
433 |
iFace.setAccessFormat("oai_datacite"); |
|
434 |
} else { |
|
435 |
iFace.setAccessFormat("oai_dc"); |
|
436 |
} |
|
437 |
|
|
438 |
if (repo.getDatasourceClass() != null && !repo.getDatasourceClass().isEmpty()) { |
|
439 |
iFace.setTypology(repo.getDatasourceClass()); |
|
440 |
} else if (datatype.equalsIgnoreCase("journal")) { |
|
441 |
iFace.setTypology("pubsrepository::journal"); |
|
442 |
} else if (datatype.equalsIgnoreCase("aggregator")) { |
|
443 |
iFace.setTypology("aggregator::pubsrepository::unknown"); |
|
444 |
} else if (datatype.equalsIgnoreCase("opendoar")) { |
|
445 |
iFace.setTypology("pubsrepository::unknown"); |
|
446 |
} else if (datatype.equalsIgnoreCase("re3data")) { |
|
447 |
iFace.setTypology("datarepository::unknown"); |
|
448 |
} |
|
449 |
|
|
450 |
iFace.setRemovable(true); |
|
451 |
iFace.setAccessProtocol("oai"); |
|
452 |
iFace.setMetadataIdentifierPath("//*[local-name()='header']/*[local-name()='identifier']"); |
|
453 |
// iFace.setId("api_________::" + repo.getId() + "::" + UUID.randomUUID().toString().substring(0, 8)); |
|
454 |
if (iFace.getAccessSet().isEmpty()) { |
|
455 |
LOGGER.debug("set is empty: " + iFace.getAccessSet()); |
|
456 |
iFace.removeAccessSet(); |
|
457 |
} |
|
458 |
return iFace; |
|
459 |
} |
|
460 |
|
|
461 |
private void storeRepository(Repository repository) throws JSONException { |
|
462 |
|
|
463 |
Date utilDate = new Date(); |
|
464 |
Timestamp date = new Timestamp(utilDate.getTime()); |
|
465 |
repository.setDateOfCollection(date); |
|
466 |
repository.setAggregator("OPENAIRE"); |
|
467 |
|
|
468 |
UriComponents uriComponents = UriComponentsBuilder |
|
469 |
.fromHttpUrl(baseAddress + "/ds/add/") |
|
470 |
.build() |
|
471 |
.encode(); |
|
472 |
String json_repository = Converter.repositoryObjectToJson(repository); |
|
473 |
HttpEntity<String> httpEntity = new HttpEntity <String> (json_repository,httpHeaders); |
|
474 |
restTemplate.postForObject(uriComponents.toUri(),httpEntity,String.class); |
|
475 |
} |
|
476 |
|
|
477 |
@Override |
|
478 |
public void deleteRepositoryInterface(@PathVariable("id") String id){ |
|
479 |
UriComponents uriComponents = UriComponentsBuilder |
|
480 |
.fromHttpUrl(baseAddress + "/ds/api/") |
|
481 |
.path("/{id}/") |
|
482 |
.build().expand(id).encode(); |
|
483 |
restTemplate.delete(uriComponents.toUri()); |
|
484 |
} |
|
485 |
|
|
486 |
@Override |
|
487 |
public RepositoryInterface addRepositoryInterface(@RequestParam("datatype") String datatype, |
|
488 |
@RequestParam("repoId") String repoId, |
|
489 |
@RequestBody RepositoryInterface repositoryInterface) throws JSONException { |
|
490 |
|
|
491 |
/* JSONObject json_params = new JSONObject(params); |
|
492 |
// LOGGER.debug(params); |
|
493 |
//TODO iFace parameter from gui. Object to json |
|
494 |
String datatype = json_params.getString("datatype"); |
|
495 |
String repoId = json_params.getString("repoId"); |
|
496 |
String json_iFace = json_params.getString("iFace"); |
|
497 |
RepositoryInterface iFace = null; |
|
498 |
|
|
499 |
ObjectMapper mapper = new ObjectMapper(); |
|
500 |
try { |
|
501 |
iFace = mapper.readValue(json_iFace, RepositoryInterface.class); |
|
502 |
} catch (Exception e1) { |
|
503 |
LOGGER.debug("Error parsing repository interface ", e1); |
|
504 |
}*/ |
|
505 |
return registerRepositoryInterface(repoId,repositoryInterface,datatype); |
|
506 |
} |
|
507 |
|
|
508 |
private RepositoryInterface registerRepositoryInterface(String repoId, RepositoryInterface iFace, String datatype) { |
|
509 |
Repository e = null; |
|
510 |
try { |
|
511 |
e = this.getRepositoryById(repoId); |
|
512 |
iFace = createRepositoryInterface(e,iFace,datatype); |
|
513 |
ObjectMapper mapper = new ObjectMapper(); |
|
514 |
|
|
515 |
String json_interface = Converter.repositoryInterfaceObjectToJson(e,iFace); |
|
516 |
LOGGER.debug("iFace equals -> " + json_interface); |
|
517 |
UriComponents uriComponents = UriComponentsBuilder |
|
518 |
.fromHttpUrl(baseAddress + "/ds/api/add/") |
|
519 |
.build() |
|
520 |
.encode(); |
|
521 |
|
|
522 |
|
|
523 |
HttpEntity<String> httpEntity = new HttpEntity <String> (json_interface,httpHeaders); |
|
524 |
restTemplate.postForObject(uriComponents.toUri(),httpEntity,String.class); |
|
525 |
return iFace; |
|
526 |
|
|
527 |
} catch (JSONException e1) { |
|
528 |
LOGGER.debug("Error parsing json ",e1); |
|
529 |
} |
|
530 |
return null; |
|
531 |
} |
|
532 |
|
|
533 |
@Override |
|
534 |
public List<String> getDnetCountries() { |
|
535 |
LOGGER.debug("Getting dnet-countries!"); |
|
536 |
return Converter.readFile("countries.txt"); |
|
537 |
} |
|
538 |
|
|
539 |
@Override |
|
540 |
public List<String> getTypologies() { |
|
541 |
return Converter.readFile("typologies.txt"); |
|
542 |
} |
|
543 |
|
|
544 |
@Override |
|
545 |
public List<Timezone> getTimezones() { |
|
546 |
List<String> timezones = Converter.readFile("timezones.txt"); |
|
547 |
return Converter.toTimezones(timezones); |
|
548 |
} |
|
549 |
|
|
550 |
@Override |
|
551 |
public String updateManagedStatus(@RequestParam(value = "id") String id, |
|
552 |
@RequestParam(value = "managed") String managed) { |
|
553 |
|
|
554 |
UriComponents uriComponents = UriComponentsBuilder |
|
555 |
.fromHttpUrl(baseAddress + "/ds/manage/") |
|
556 |
.queryParam("id",id) |
|
557 |
.queryParam("managed",managed) |
|
558 |
.build().encode(); |
|
559 |
|
|
560 |
return restTemplate.postForObject(uriComponents.toUri(), null,String.class); |
|
561 |
} |
|
562 |
|
|
563 |
@Override |
|
564 |
public String updateEnglishName(@RequestParam(value = "id") String id, |
|
565 |
@RequestParam(value = "englishname") String englishName) { |
|
566 |
|
|
567 |
UriComponents uriComponents = UriComponentsBuilder |
|
568 |
.fromHttpUrl(baseAddress + "/ds/englishname/") |
|
569 |
.queryParam("dsId",id) |
|
570 |
.queryParam("englishname",englishName) |
|
571 |
.build().encode(); |
|
572 |
return restTemplate.postForObject(uriComponents.toUri(), null,String.class); |
|
573 |
|
Also available in: Unified diff
1. Create trunk folder.