Project

General

Profile

« Previous | Next » 

Revision 49378

View differences:

modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/main/Application.java
1
/*
2
package eu.dnetlib.repo.manager.service.main;
3

  
4

  
5
import org.springframework.boot.SpringApplication;
6
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
7
import org.springframework.boot.autoconfigure.SpringBootApplication;
8
import org.springframework.context.annotation.ImportResource;
9

  
10

  
11
@SpringBootApplication
12
@EnableAutoConfiguration
13
@ImportResource("${configurationFileClassPath}")
14
public class Application {
15
    public static void main(String[] args) {
16
        SpringApplication.run(Application.class, args);
17
    }
18
}
19
*/
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/controllers/ValidatorApi.java
4 4
import eu.dnetlib.domain.functionality.validator.RuleSet;
5 5
import org.json.JSONException;
6 6
import org.springframework.http.MediaType;
7
import org.springframework.web.bind.annotation.RequestBody;
8
import org.springframework.web.bind.annotation.RequestMapping;
9
import org.springframework.web.bind.annotation.RequestMethod;
10
import org.springframework.web.bind.annotation.RestController;
7
import org.springframework.web.bind.annotation.*;
11 8

  
12 9
import java.util.List;
13 10

  
......
17 14
public interface ValidatorApi {
18 15

  
19 16
    @RequestMapping(value = "/submitJobForValidation",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE )
17
    @ResponseBody
20 18
    void submitJobForValidation(@RequestBody JobForValidation jobForValidation);
21 19

  
22 20
    @RequestMapping(value = "/reSubmitJobForValidation/",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE )
21
    @ResponseBody
23 22
    void reSubmitJobForValidation(@RequestBody String jobId) throws JSONException;
24 23

  
25 24
    @RequestMapping(value = "/getRuleSets" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
25
    @ResponseBody
26 26
    List<RuleSet> getRuleSets();
27 27

  
28 28
    @RequestMapping(value = "/getSetsOfRepository/{url}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
29
    @ResponseBody
29 30
    List<String> getSetsOfRepository(String url);
30 31

  
31 32
}
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/controllers/ValidatorApiImpl.java
14 14
import org.json.JSONException;
15 15
import org.json.JSONObject;
16 16
import org.springframework.beans.factory.annotation.Autowired;
17
import org.springframework.beans.factory.annotation.Qualifier;
17 18
import org.springframework.beans.factory.annotation.Value;
18 19
import org.springframework.stereotype.Component;
19 20
import org.springframework.web.bind.annotation.PathVariable;
20 21

  
21 22
import javax.annotation.PostConstruct;
22 23

  
23
@Component(value = "validationService")
24 24
public class ValidatorApiImpl implements ValidatorApi{
25 25

  
26 26
    @Autowired
27 27
    private MonitorApiImpl monitorApi;
28 28

  
29
    @Autowired
30 29
    private ServiceLocator<ValidatorService> validatorServiceLocator;
31 30

  
32 31
    private ValidatorService getValidationService() {
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/controllers/MonitorApiImpl.java
6 6
import gr.uoa.di.driver.util.ServiceLocator;
7 7
import org.json.JSONException;
8 8
import org.json.JSONObject;
9
import org.springframework.beans.factory.annotation.Autowired;
10
import org.springframework.stereotype.Component;
11 9
import java.util.List;
12 10

  
13
@Component
14 11
public class MonitorApiImpl implements MonitorApi {
15 12

  
16
    @Autowired
13

  
17 14
    private ServiceLocator<ValidatorService> validatorServiceLocator;
18 15

  
19 16
    private ValidatorService getValidationService() {
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/controllers/RepositoryApi.java
2 2

  
3 3
import eu.dnetlib.domain.data.Repository;
4 4
import eu.dnetlib.domain.data.RepositoryInterface;
5
import eu.dnetlib.repo.manager.service.shared.Country;
6
import eu.dnetlib.repo.manager.service.shared.Vocabulary;
5 7
import org.json.JSONException;
6 8
import org.springframework.http.MediaType;
7 9
import org.springframework.web.bind.annotation.RequestMapping;
8 10
import org.springframework.web.bind.annotation.RequestMethod;
11
import org.springframework.web.bind.annotation.ResponseBody;
9 12
import org.springframework.web.bind.annotation.RestController;
10 13
import java.util.List;
11 14

  
......
14 17
public interface RepositoryApi {
15 18

  
16 19
    @RequestMapping(value = "/getCountries", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
17
    String getCountries() ;
20
    @ResponseBody
21
    Country[] getCountries() ;
18 22

  
19 23
    @RequestMapping(value = "/getRepositoriesByCountry/{country}/{page}/{size}/", method = RequestMethod.GET,
20 24
            produces = MediaType.APPLICATION_JSON_VALUE)
25
    @ResponseBody
21 26
    List<Repository> getRepositoriesByCountry(String country,
22 27
                                          String page,
23 28
                                          String size) throws JSONException;
24 29

  
25 30
    @RequestMapping(value = "/getRepositoriesOfUser/{userEmail}/{page}/{size}")
31
    @ResponseBody
26 32
    List<Repository> getRepositoriesOfUser( String userEmail,
27 33
                                        String page,
28 34
                                        String size) throws JSONException;
29 35

  
30 36
    @RequestMapping(value = "/getRepositoryById/{id}", method = RequestMethod.GET,
31 37
            produces = MediaType.APPLICATION_JSON_VALUE)
38
    @ResponseBody
32 39
    Repository getRepositoryById(String id) throws JSONException;
33 40

  
34 41
    @RequestMapping(value = "/getRepositoriesByName/{name}/{page}/{size}/", method = RequestMethod.GET,
35 42
            produces = MediaType.APPLICATION_JSON_VALUE)
43
    @ResponseBody
36 44
    List<Repository> getRepositoriesByName(String name,
37 45
                                          String page,
38 46
                                          String size) throws JSONException;
39 47

  
40 48
    @RequestMapping(value = "/getRepositoryInterface/{id}", method = RequestMethod.GET,
41 49
            produces = MediaType.APPLICATION_JSON_VALUE)
50
    @ResponseBody
42 51
    RepositoryInterface getRepositoyInterface(String id) throws JSONException;
43 52

  
44 53
    @RequestMapping(value = "/addRepository", method = RequestMethod.POST,
45 54
            consumes = MediaType.APPLICATION_JSON_VALUE)
55
    @ResponseBody
46 56
    String addRepository(Repository repository) throws JSONException;
47 57

  
48 58
    @RequestMapping(value = "/addInterface", method = RequestMethod.POST,
49 59
            consumes = MediaType.APPLICATION_JSON_VALUE)
60
    @ResponseBody
50 61
    String addRepositoryInterface(RepositoryInterface repositoryInterface) throws JSONException;
51 62

  
52 63
    @RequestMapping(value = "/getDnetCountries", method = RequestMethod.GET,
53 64
            produces = MediaType.APPLICATION_JSON_VALUE)
65
    @ResponseBody
54 66
    List<String> getDnetCountries();
55 67

  
56 68
    @RequestMapping(value = "/getTypologies", method = RequestMethod.GET,
57 69
            produces = MediaType.APPLICATION_JSON_VALUE)
70
    @ResponseBody
58 71
    List<String> getTypologies();
59 72

  
60 73
    @RequestMapping(value = "/getTimezones", method = RequestMethod.GET,
61 74
            produces = MediaType.APPLICATION_JSON_VALUE)
75
    @ResponseBody
62 76
    List<String> getTimezones();
63 77

  
64 78
    @RequestMapping(value = "/updateManagedStatus", method = RequestMethod.POST,
65 79
            produces = MediaType.APPLICATION_JSON_VALUE)
80
    @ResponseBody
66 81
    String updateManagedStatus(String id,String managed);
67 82

  
68 83
    @RequestMapping(value = "/updateEnglishName", method = RequestMethod.POST,
69 84
            produces = MediaType.APPLICATION_JSON_VALUE)
85
    @ResponseBody
70 86
    String updateEnglishName(String id,String englishName);
71 87

  
72 88
    @RequestMapping(value = "/updateLatitude", method = RequestMethod.POST,
73 89
            produces = MediaType.APPLICATION_JSON_VALUE)
90
    @ResponseBody
74 91
    String updateLatitude(String id,String latitude);
75 92

  
76 93
    @RequestMapping(value = "/updateLongitude", method = RequestMethod.POST,
77 94
            produces = MediaType.APPLICATION_JSON_VALUE)
95
    @ResponseBody
78 96
    String updateLongitude(String id,String longitude);
79 97

  
80 98
    @RequestMapping(value = "/updateOfficialName", method = RequestMethod.POST,
81 99
            produces = MediaType.APPLICATION_JSON_VALUE)
100
    @ResponseBody
82 101
    String updateOfficialName(String id,String officialName);
83 102

  
84 103
    @RequestMapping(value = "/getUrlsOfUserRepos",method = RequestMethod.GET,
85 104
            produces = MediaType.APPLICATION_JSON_VALUE)
105
    @ResponseBody
86 106
    String getUrlsOfUserRepos(String user_email);
87 107

  
88 108
}
modules/uoa-repository-manager-service/src/main/java/eu/dnetlib/repo/manager/service/controllers/RepositoryApiImpl.java
1 1
package eu.dnetlib.repo.manager.service.controllers;
2 2

  
3
import eu.dnetlib.repo.manager.service.shared.Country;
3 4
import eu.dnetlib.repo.manager.service.utils.Converter;
4 5
import eu.dnetlib.domain.data.Repository;
5 6
import eu.dnetlib.domain.data.RepositoryInterface;
......
12 13
import org.springframework.web.bind.annotation.PathVariable;
13 14
import org.springframework.web.bind.annotation.RequestBody;
14 15
import org.springframework.web.bind.annotation.RequestParam;
16
import org.springframework.web.bind.annotation.ResponseBody;
15 17
import org.springframework.web.client.RestTemplate;
16 18
import org.springframework.web.util.UriComponents;
17 19
import org.springframework.web.util.UriComponentsBuilder;
......
35 37
    }
36 38

  
37 39
    @Override
38
    public String getCountries()  {
40
    public Country[] getCountries()  {
39 41
        UriComponents uriComponents = UriComponentsBuilder
40 42
                .fromHttpUrl(baseAddress + "/ds/countries")
41 43
                .build().encode();
42
        return restTemplate.getForObject(uriComponents.toUri(), String.class);
44
        return restTemplate.getForObject(uriComponents.toUri(),Country[].class);
43 45
    }
44 46

  
45 47

  
......
47 49
    public List<Repository> getRepositoriesByCountry(@PathVariable("country") String country,
48 50
                                                     @PathVariable("page") String page,
49 51
                                                     @PathVariable("size") String size) throws JSONException {
50
       /* String vars = page+"/"+size+"?country="+country;
51
        String uri = baseAddress+ "/ds/search/country/" + vars;
52
        JSONArray jsonArray = new JSONArray(RestService.executeGET(uri));
53
        return Converter.jsonToRepositoryList(jsonArray);*/
54 52

  
55 53
        UriComponents uriComponents = UriComponentsBuilder
56 54
                                            .fromHttpUrl(baseAddress + "/ds/search/country/")
modules/uoa-repository-manager-service/src/main/resources/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/application-context.xml
15 15
    </bean>-->
16 16

  
17 17
    <context:property-placeholder location="classpath*:/application.properties" />
18
    <context:component-scan base-package="eu.dnetlib.repo.manager.service.*"/>
19
    <context:component-scan base-package="gr.uoa.di.driver.util"/>
20
    <context:annotation-config/>
21

  
22 18
</beans>
modules/uoa-repository-manager-service/pom.xml
62 62
    </build>
63 63

  
64 64
    <dependencies>
65

  
65 66
        <dependency>
67
            <groupId>org.springframework</groupId>
68
            <artifactId>spring-webmvc</artifactId>
69
            <version>${spring.version}</version>
70
        </dependency>
71

  
72
        <dependency>
73
            <groupId>org.hibernate</groupId>
74
            <artifactId>hibernate-validator-annotation-processor</artifactId>
75
            <version>4.1.0.Final</version>
76
        </dependency>
77

  
78
        <dependency>
66 79
            <groupId>log4j</groupId>
67 80
            <artifactId>log4j</artifactId>
68 81
            <version>(1.2, 1.5]</version>

Also available in: Unified diff