diff --git a/Dockerfile b/Dockerfile index cf702bc..18d6038 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,9 @@ FROM tomcat:8.5-jre8-alpine MAINTAINER "pkanakakis@di.uoa.gr" RUN ["rm", "-fr", "/usr/local/tomcat/webapps/ROOT"] COPY ./target/uoa-repository-manager-service.war /usr/local/tomcat/webapps/uoa-repository-manager-service.war -COPY ./src/main/resources/eu/dnetlib/repo/manager/service/application.properties /usr/local/tomcat/lib/application.properties -COPY ./src/main/resources/eu/dnetlib/repo/manager/service/email-texts.properties /usr/local/tomcat/lib/email-texts.properties +COPY src/main/resources/dnet-override.properties /usr/local/tomcat/lib/dnet-override.properties +#COPY src/main/resources/application.properties /usr/local/tomcat/lib/application.properties +#COPY src/main/resources/email-texts.properties /usr/local/tomcat/lib/email-texts.properties VOLUME /var/log/uoa-repository-manager-service:/var/log/uoa-repository-manager-service/ CMD ["catalina.sh", "run"] diff --git a/pom.xml b/pom.xml index 7119646..e96a8b9 100644 --- a/pom.xml +++ b/pom.xml @@ -253,26 +253,26 @@ - - com.googlecode.maven-download-plugin - download-maven-plugin - 1.3.0 - - - process-resources - - wget - - - - https://github.com/ostranme/swagger-ui-themes/archive/v3.0.0.zip - - true - ${project.build.directory} - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/eu/dnetlib/repo/manager/service/config/Config.java b/src/main/java/eu/dnetlib/repo/manager/service/config/Config.java index 142f474..9b462ab 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/config/Config.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/config/Config.java @@ -15,7 +15,7 @@ import javax.annotation.PostConstruct; @Configuration @EnableRedisHttpSession -@PropertySource(value = { "classpath:eu/dnetlib/repo/manager/service/application.properties"} ) +@PropertySource(value = {"classpath:application.properties"} ) @ComponentScan(basePackages = "eu.dnetlib.repo.manager.service.controllers") public class Config { @@ -51,8 +51,8 @@ public class Config { DefaultCookieSerializer serializer = new DefaultCookieSerializer(); serializer.setCookieName("openAIRESession"); serializer.setCookiePath("/"); - // serializer.setDomainName(".openaire.eu"); - serializer.setDomainName(".di.uoa.gr"); +// serializer.setDomainName(".openaire.eu"); +// serializer.setDomainName(".athenarc.gr"); LOGGER.info("Serializer : " + serializer); return serializer; } diff --git a/src/main/java/eu/dnetlib/repo/manager/service/config/FrontEndLinkURIAuthenticationSuccessHandler.java b/src/main/java/eu/dnetlib/repo/manager/service/config/FrontEndLinkURIAuthenticationSuccessHandler.java index 90c93bb..48087dd 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/config/FrontEndLinkURIAuthenticationSuccessHandler.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/config/FrontEndLinkURIAuthenticationSuccessHandler.java @@ -56,20 +56,21 @@ public class FrontEndLinkURIAuthenticationSuccessHandler implements Authenticati .getSource().getAsJsonArray("edu_person_entitlements").toString(), "UTF-8") + ""); - Gson gson = new GsonBuilder().create(); Cookie openAIREUser = new Cookie("openAIREUser", new Gson().toJson(userInfo) ); - openAIREUser .setMaxAge(14400); + openAIREUser.setMaxAge(14400); + openAIREUser.setPath("/"); // openAIREUser .setDomain(".openaire.eu"); - openAIREUser .setDomain(".di.uoa.gr"); +// openAIREUser.setDomain(".athenarc.gr"); response.addCookie(openAIREUser); Cookie accessToken = new Cookie("AccessToken", authOIDC.getAccessTokenValue()); accessToken.setMaxAge(14400); // accessToken.setDomain(".openaire.eu"); - accessToken.setDomain(".di.uoa.gr"); - response.addCookie(accessToken); + accessToken.setPath("/"); +// accessToken.setDomain(".athenarc.gr"); + response.addCookie(accessToken); response.sendRedirect(frontEndURI); } diff --git a/src/main/java/eu/dnetlib/repo/manager/service/config/RepoManagerContextLoaderListener.java b/src/main/java/eu/dnetlib/repo/manager/service/config/RepoManagerContextLoaderListener.java index 15d5cec..261d474 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/config/RepoManagerContextLoaderListener.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/config/RepoManagerContextLoaderListener.java @@ -32,7 +32,7 @@ public class RepoManagerContextLoaderListener extends ContextLoaderListener { String repoMode = props.getProperty("services.validator.mode.repo"); String userMode = props.getProperty("services.validator.mode.user"); Boolean standaloneMode = Boolean.parseBoolean(props.getProperty("services.validator.mode.standalone")); - + logger.info("User mode: " + userMode); logger.info("Repo mode: " + repoMode); logger.info("Standalone mode: " + standaloneMode); @@ -77,7 +77,7 @@ public class RepoManagerContextLoaderListener extends ContextLoaderListener { "classpath*:/gr/uoa/di/driver/app/springContext-commons.xml", "classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml" }; - + if (standaloneMode) { logger.debug("Loading contexts for standalone mode"); ctx.setConfigLocations((String[])ArrayUtils.addAll(springContextCore,springContextForStandalone)); @@ -85,22 +85,22 @@ public class RepoManagerContextLoaderListener extends ContextLoaderListener { logger.debug("Loading contexts for dnet"); ctx.setConfigLocations((String[])ArrayUtils.addAll(springContextCore,springContextForIS)); } - + ctx.refresh(); - + logger.debug("done"); - + return ctx; - } - + } + private Properties loadProperties() { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] { "classpath*:/eu/dnetlib/repo/manager/server/config/springContext-repo-manager-config.xml" }); - + CascadingPropertyLoader pLoader = (CascadingPropertyLoader) ctx.getBean("propertyLoader"); Properties props = pLoader.getProperties(); - + ctx.destroy(); ctx.close(); return props; diff --git a/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApi.java b/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApi.java index 9f2ad3b..a7aad1b 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApi.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApi.java @@ -4,9 +4,11 @@ import eu.dnetlib.repo.manager.shared.BrokerException; import eu.dnetlib.repo.manager.shared.Term; import eu.dnetlib.repo.manager.shared.broker.*; import io.swagger.annotations.Api; -import io.swagger.annotations.ApiParam; import org.json.JSONException; import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PostAuthorize; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.io.IOException; @@ -23,7 +25,7 @@ public interface BrokerApi { @ResponseBody DatasourcesBroker getDatasourcesOfUser(String user,String includeShared,String includeByOthers) throws BrokerException, JSONException; - @RequestMapping(value = "/getTopicsForDatasource/{datasourceName}" , method = RequestMethod.GET, + @RequestMapping(value = "/getTopicsForDatasource/{datasourceName:.+}" , method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody List getTopicsForDatasource(String datasourceName) throws BrokerException; @@ -35,7 +37,7 @@ public interface BrokerApi { String size, AdvQueryObject advQueryObject) throws BrokerException, JSONException ,IOException; - @RequestMapping(value = "/showEvents/{datasourceName}/{topic}/{page}" , method = RequestMethod.GET, + @RequestMapping(value = "/showEvents/{datasourceName:.+}/{topic}/{page}" , method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody EventsPage showEvents(String datasourceName, @@ -56,7 +58,7 @@ public interface BrokerApi { @RequestMapping(value = "/unsubscribe/{subscriptionId}" , method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody - void unsubscribe(String subscriptionId) throws BrokerException; + ResponseEntity unsubscribe(String subscriptionId) throws BrokerException; @RequestMapping(value = "/getSubscription/{subscriptionId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody diff --git a/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApiImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApiImpl.java index 4de4a6d..22f8d43 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApiImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/controllers/BrokerApiImpl.java @@ -9,14 +9,10 @@ import eu.dnetlib.repo.manager.shared.Tuple; import eu.dnetlib.repo.manager.shared.broker.*; import io.swagger.annotations.ApiParam; import org.json.JSONException; -import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.ParameterizedTypeReference; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.ResponseEntity; +import org.springframework.http.*; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Component; @@ -284,7 +280,7 @@ public class BrokerApiImpl implements BrokerApi { } @Override - @PreAuthorize("hasRole('ROLE_USER')") + @PreAuthorize("hasRole('ROLE_USER') ") public Subscription subscribe(@RequestBody OpenaireSubscription obj) throws BrokerException { final String service = "/subscribe"; @@ -316,7 +312,7 @@ public class BrokerApiImpl implements BrokerApi { @Override @PreAuthorize("hasRole('ROLE_USER')") - public void unsubscribe(@PathVariable("subscriptionId") String subscriptionId) throws BrokerException { + public ResponseEntity unsubscribe(@PathVariable("subscriptionId") String subscriptionId) throws BrokerException { final String service = "/subscriptions/" + subscriptionId; //build the uri params @@ -335,6 +331,7 @@ public class BrokerApiImpl implements BrokerApi { emailUtils.reportException(e); throw new BrokerException(e); } + return new ResponseEntity<>("OK",HttpStatus.OK); } @Override diff --git a/src/main/java/eu/dnetlib/repo/manager/service/controllers/EmailUtilsImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/controllers/EmailUtilsImpl.java index 5e6e2fa..0ddc7e3 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/controllers/EmailUtilsImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/controllers/EmailUtilsImpl.java @@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; +import javax.annotation.PostConstruct; import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; @@ -39,6 +40,13 @@ public class EmailUtilsImpl implements EmailUtils { @Value("${services.repomanager.usagestats.adminEmail}") private String usageStatsAdminEmail; + + @PostConstruct + public void init(){ + System.out.println("base url -> " + this.baseUrl); + } + + @Override public void reportException(Exception exception) { Writer writer = new StringWriter(); diff --git a/src/main/java/eu/dnetlib/repo/manager/service/controllers/GenericControllerAdvice.java b/src/main/java/eu/dnetlib/repo/manager/service/controllers/GenericControllerAdvice.java new file mode 100644 index 0000000..7960366 --- /dev/null +++ b/src/main/java/eu/dnetlib/repo/manager/service/controllers/GenericControllerAdvice.java @@ -0,0 +1,57 @@ +package eu.dnetlib.repo.manager.service.controllers; + + +import eu.dnetlib.api.functionality.ValidatorServiceException; +import eu.dnetlib.repo.manager.service.exception.ResourceNotFoundException; +import eu.dnetlib.repo.manager.service.exception.ServerError; +import eu.dnetlib.repo.manager.shared.BrokerException; +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; +import org.json.JSONException; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; +import org.springframework.http.HttpStatus; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.net.UnknownHostException; + + +@ControllerAdvice +@Order(Ordered.HIGHEST_PRECEDENCE) +public class GenericControllerAdvice { + + private Logger logger = LogManager.getLogger(GenericControllerAdvice.class); + + + @ResponseStatus(HttpStatus.NOT_FOUND) + @ExceptionHandler(ResourceNotFoundException.class) + @ResponseBody + ServerError securityException(HttpServletRequest req, Exception ex) { + return new ServerError(req.getRequestURL().toString(),ex); + } + + @ResponseStatus(HttpStatus.FORBIDDEN) + @ExceptionHandler(AccessDeniedException.class) + @ResponseBody + ServerError accessDeniedException(HttpServletRequest req, Exception ex) { + return new ServerError(req.getRequestURL().toString(),ex); + } + + @ResponseStatus(HttpStatus.NOT_FOUND) + @ExceptionHandler(UnknownHostException.class) + @ResponseBody + ServerError unknownHostException(HttpServletRequest req, Exception ex) { + return new ServerError(req.getRequestURL().toString(),ex); + } + + @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) + @ExceptionHandler({JSONException.class,BrokerException.class,ValidatorServiceException.class}) + @ResponseBody + ServerError internalException(HttpServletRequest req, Exception ex) { + return new ServerError(req.getRequestURL().toString(),ex); + } + + +} diff --git a/src/main/java/eu/dnetlib/repo/manager/service/controllers/MonitorApi.java b/src/main/java/eu/dnetlib/repo/manager/service/controllers/MonitorApi.java index 815a26f..518d5a4 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/controllers/MonitorApi.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/controllers/MonitorApi.java @@ -6,6 +6,7 @@ import eu.dnetlib.repo.manager.shared.JobsOfUser; import io.swagger.annotations.Api; import org.json.JSONException; import org.springframework.http.MediaType; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @RestController diff --git a/src/main/java/eu/dnetlib/repo/manager/service/controllers/PiWikApi.java b/src/main/java/eu/dnetlib/repo/manager/service/controllers/PiWikApi.java index 8c8e0b7..bf5803f 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/controllers/PiWikApi.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/controllers/PiWikApi.java @@ -2,11 +2,10 @@ package eu.dnetlib.repo.manager.service.controllers; import eu.dnetlib.domain.data.PiwikInfo; -import eu.dnetlib.domain.data.Repository; -import eu.dnetlib.domain.functionality.UserProfile; import eu.dnetlib.repo.manager.shared.RepositoryServiceException; import io.swagger.annotations.Api; import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.List; @@ -29,7 +28,7 @@ public interface PiWikApi { @RequestMapping(value = "/approvePiwikSite/{repositoryId}" , method = RequestMethod.GET) @ResponseBody - void approvePiwikSite(String repositoryId); + ResponseEntity approvePiwikSite(String repositoryId); @RequestMapping(value = "/getOpenaireId/{repositoryId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody @@ -39,9 +38,9 @@ public interface PiWikApi { @RequestMapping(value = "/markPiwikSiteAsValidated/{repositoryId}" , method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody - void markPiwikSiteAsValidated(String repositoryId) throws RepositoryServiceException; + ResponseEntity markPiwikSiteAsValidated(String repositoryId) throws RepositoryServiceException; @RequestMapping(value = "/enableMetricsForRepository", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) - void enableMetricsForRepository(String officialName,String repoWebsite,PiwikInfo piwikInfo) throws RepositoryServiceException; + PiwikInfo enableMetricsForRepository(String officialName,String repoWebsite,PiwikInfo piwikInfo) throws RepositoryServiceException; } diff --git a/src/main/java/eu/dnetlib/repo/manager/service/controllers/PiWikApiImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/controllers/PiWikApiImpl.java index 7f5e28a..45eb8b2 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/controllers/PiWikApiImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/controllers/PiWikApiImpl.java @@ -2,15 +2,18 @@ package eu.dnetlib.repo.manager.service.controllers; import com.fasterxml.jackson.databind.ObjectMapper; import eu.dnetlib.domain.data.PiwikInfo; -import eu.dnetlib.domain.data.Repository; import eu.dnetlib.repo.manager.shared.RepositoryServiceException; import org.apache.commons.codec.digest.DigestUtils; +import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.dao.EmptyResultDataAccessException; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; +import org.springframework.security.access.prepost.PostAuthorize; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.PathVariable; @@ -29,8 +32,8 @@ import java.util.Map; @Component public class PiWikApiImpl implements PiWikApi{ - @Autowired @Qualifier("repomanager.dataSource") + @Autowired private DataSource dataSource; @@ -42,7 +45,7 @@ public class PiWikApiImpl implements PiWikApi{ @Qualifier("emailUtils") EmailUtils emailUtils; - private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger + private static final Logger LOGGER = Logger .getLogger(PiWikApiImpl.class); private final static String GET_PIWIK_SITE = "select repositoryid, siteid, authenticationtoken, creationdate, requestorname, requestoremail, validated, validationdate, comment, repositoryname, country from piwik_site where repositoryid = ?;"; @@ -92,8 +95,9 @@ public class PiWikApiImpl implements PiWikApi{ @Override @PreAuthorize("hasRole('ROLE_ADMIN')") - public void approvePiwikSite(@PathVariable("repositoryId") String repositoryId) { + public ResponseEntity approvePiwikSite(@PathVariable("repositoryId") String repositoryId) { new JdbcTemplate(dataSource).update(APPROVE_PIWIK_SITE, new Object[] {repositoryId}, new int[] {Types.VARCHAR}); + return new ResponseEntity<>("OK",HttpStatus.OK); } @Override @@ -105,7 +109,7 @@ public class PiWikApiImpl implements PiWikApi{ @Override @PreAuthorize("hasRole('ROLE_ADMIN')") - public void markPiwikSiteAsValidated(@PathVariable("repositoryId") String repositoryId) throws RepositoryServiceException { + public ResponseEntity markPiwikSiteAsValidated(@PathVariable("repositoryId") String repositoryId) throws RepositoryServiceException { try { approvePiwikSite(repositoryId); @@ -121,13 +125,14 @@ public class PiWikApiImpl implements PiWikApi{ LOGGER.error("Error while sending email to administrator or user about the enabling of metrics", e); emailUtils.reportException(e); } + return new ResponseEntity<>("OK",HttpStatus.OK); } @Override - @PreAuthorize("hasRole('ROLE_USER')") - public void enableMetricsForRepository(@RequestParam("officialName") String officialName, - @RequestParam("repoWebsite") String repoWebsite, - @RequestBody PiwikInfo piwikInfo) throws RepositoryServiceException { + @PreAuthorize("hasRole('ROLE_ADMIN') or (hasRole('ROLE_USER') and #piwikInfo.requestorEmail == authentication.userInfo.email)") + public PiwikInfo enableMetricsForRepository(@RequestParam("officialName") String officialName, + @RequestParam("repoWebsite") String repoWebsite, + @RequestBody PiwikInfo piwikInfo) throws RepositoryServiceException { try { @@ -155,6 +160,7 @@ public class PiWikApiImpl implements PiWikApi{ LOGGER.error("Error while sending email to administrator or user about the request to enable metrics", e); emailUtils.reportException(e); } + return piwikInfo; } diff --git a/src/main/java/eu/dnetlib/repo/manager/service/controllers/RepositoryApi.java b/src/main/java/eu/dnetlib/repo/manager/service/controllers/RepositoryApi.java index 9b236ec..242a8cd 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/controllers/RepositoryApi.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/controllers/RepositoryApi.java @@ -2,11 +2,12 @@ package eu.dnetlib.repo.manager.service.controllers; import eu.dnetlib.domain.data.Repository; import eu.dnetlib.domain.data.RepositoryInterface; -import eu.dnetlib.domain.functionality.UserProfile; +import eu.dnetlib.repo.manager.service.exception.ResourceNotFoundException; import eu.dnetlib.repo.manager.shared.*; import io.swagger.annotations.Api; import org.json.JSONException; import org.springframework.http.MediaType; +import org.springframework.security.access.prepost.PostAuthorize; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -38,16 +39,21 @@ public interface RepositoryApi { @RequestMapping(value = "/getRepositoryById/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody - Repository getRepositoryById(String id) throws JSONException; + Repository getRepositoryById(String id) throws JSONException, ResourceNotFoundException; @RequestMapping(value = "/getRepositoryAggregations/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody - Aggregations getRepositoryAggregations(String id) throws JSONException; + List getRepositoryAggregations(String id) throws JSONException; + + @RequestMapping(value = "/getRepositoryAggregationsByYear/{id}", method = RequestMethod.GET, + produces = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + Map> getRepositoryAggregationsByYear(String id) throws JSONException; - @RequestMapping(value = "/getRepositoriesByName/{name}/{page}/{size}/", method = RequestMethod.GET, + @RequestMapping(value = "/getRepositoriesByName/{name:.+}/{page}/{size}/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody List getRepositoriesByName(String name, @@ -66,14 +72,15 @@ public interface RepositoryApi { @RequestMapping(value = "/deleteInterface/", method = RequestMethod.DELETE) - void deleteRepositoryInterface(String id); + void deleteRepositoryInterface(String id,String registeredBy); @RequestMapping(value = "/addInterface", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody RepositoryInterface addRepositoryInterface(String datatype, String repoId, - RepositoryInterface iFace) throws JSONException; + String registeredBy, + RepositoryInterface iFace) throws JSONException,ResourceNotFoundException; @RequestMapping(value = "/getDnetCountries", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @@ -133,7 +140,7 @@ public interface RepositoryApi { @RequestMapping(value = "/updateRepositoryInterface", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody - RepositoryInterface updateRepositoryInterface(String repositoryId,RepositoryInterface repositoryInterface) throws JSONException; + RepositoryInterface updateRepositoryInterface(String repositoryId,String registeredBy,RepositoryInterface repositoryInterface) throws JSONException; diff --git a/src/main/java/eu/dnetlib/repo/manager/service/controllers/RepositoryApiImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/controllers/RepositoryApiImpl.java index ed4dec0..712ada0 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/controllers/RepositoryApiImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/controllers/RepositoryApiImpl.java @@ -6,8 +6,9 @@ import com.fasterxml.jackson.databind.SerializationFeature; import eu.dnetlib.domain.data.Repository; import eu.dnetlib.domain.data.RepositoryInterface; import eu.dnetlib.domain.enabling.Vocabulary; -import eu.dnetlib.repo.manager.service.utils.Converter; import eu.dnetlib.repo.manager.service.domain.RequestFilter; +import eu.dnetlib.repo.manager.service.exception.ResourceNotFoundException; +import eu.dnetlib.repo.manager.service.utils.Converter; import eu.dnetlib.repo.manager.shared.*; import gr.uoa.di.driver.enabling.vocabulary.VocabularyLoader; import org.apache.commons.codec.digest.DigestUtils; @@ -18,8 +19,13 @@ import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.ParameterizedTypeReference; -import org.springframework.http.*; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.security.access.annotation.Secured; +import org.springframework.security.access.prepost.PostAuthorize; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.PathVariable; @@ -32,9 +38,10 @@ import org.springframework.web.util.UriComponentsBuilder; import javax.annotation.PostConstruct; import java.sql.Timestamp; -import java.text.Normalizer; import java.util.*; import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; +import java.util.stream.Collectors; @Component public class RepositoryApiImpl implements RepositoryApi { @@ -174,7 +181,7 @@ public class RepositoryApiImpl implements RepositoryApi { jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo"); } for (Repository r : resultSet) - this.getRepositoryInfo(r); + this.updateRepositoryInfo(r); return resultSet; }catch (Exception e){ @@ -186,7 +193,7 @@ public class RepositoryApiImpl implements RepositoryApi { } - private void getRepositoryInfo(Repository r) throws JSONException { + private Repository updateRepositoryInfo(Repository r) throws JSONException { /* * from datasource class @@ -196,6 +203,7 @@ public class RepositoryApiImpl implements RepositoryApi { r.setInterfaces(this.getRepositoryInterface(r.getId())); r.setPiwikInfo(piWikApi.getPiwikSiteForRepo(r.getId())); r.setCountryName(getCountryName(r.getCountryCode())); + return r; } @@ -226,7 +234,7 @@ public class RepositoryApiImpl implements RepositoryApi { List repos = Converter.jsonToRepositoryList(new JSONObject(rs)); for (Repository r : repos) - this.getRepositoryInfo(r); + this.updateRepositoryInfo(r); return repos; }catch (Exception e){ @@ -237,7 +245,7 @@ public class RepositoryApiImpl implements RepositoryApi { } @Override - public Repository getRepositoryById(@PathVariable("id") String id) throws JSONException { + public Repository getRepositoryById(@PathVariable("id") String id) throws JSONException,ResourceNotFoundException { LOGGER.debug("Retreiving repositories with id : " + id ); Repository repo = null; @@ -248,12 +256,13 @@ public class RepositoryApiImpl implements RepositoryApi { try{ String rs = restTemplate.postForObject(uriComponents.toUri(),requestFilter, String.class); JSONArray jsonArray = (JSONArray) new JSONObject(rs).get("datasourceInfo"); - if(jsonArray.length() > 0) - repo = Converter.jsonToRepositoryObject(jsonArray.getJSONObject(0)); - if (repo != null) - getRepositoryInfo(repo); - return repo; - }catch (Exception e){ + + if(jsonArray.length() == 0) + throw new ResourceNotFoundException(); + + repo = Converter.jsonToRepositoryObject(jsonArray.getJSONObject(0)); + return updateRepositoryInfo(repo); + }catch (JSONException e){ LOGGER.debug("Exception on getRepositoryById" , e); emailUtils.reportException(e); throw e; @@ -263,22 +272,23 @@ public class RepositoryApiImpl implements RepositoryApi { @Override - public Aggregations getRepositoryAggregations(@PathVariable("id") String id) throws JSONException { + public List getRepositoryAggregations(@PathVariable("id") String id) throws JSONException { LOGGER.debug("Retreiving aggregations for repository with id : " + id ); UriComponents uriComponents = searchDatasource("0","100"); RequestFilter requestFilter = new RequestFilter(); requestFilter.setId(id); - Aggregations aggregations = new Aggregations(); + + List aggregationHistory = new ArrayList<>(); try { String rs = restTemplate.postForObject(uriComponents.toUri(),requestFilter, String.class); JSONObject repository = new JSONObject(rs); - - aggregations.setAggregationHistory(Converter.getAggregationHistoryFromJson(repository.getJSONArray("datasourceInfo").getJSONObject(0))); - aggregations.setLastCollection(Converter.getLastCollectionFromJson(repository.getJSONArray("datasourceInfo").getJSONObject(0))); - aggregations.setLastTransformation(Converter.getLastTransformationFromJson(repository.getJSONArray("datasourceInfo").getJSONObject(0))); - return aggregations; + aggregationHistory.addAll(Converter.getAggregationHistoryFromJson(repository.getJSONArray("datasourceInfo").getJSONObject(0))); + return aggregationHistory.size() == 0? aggregationHistory : aggregationHistory.stream() + .sorted(Comparator.comparing(AggregationDetails::getDate).reversed()) + .limit(20) + .collect(Collectors.toList()); } catch (JSONException e) { LOGGER.debug("Exception on getRepositoryAggregations" , e); emailUtils.reportException(e); @@ -287,6 +297,39 @@ public class RepositoryApiImpl implements RepositoryApi { } + @Override + public Map> getRepositoryAggregationsByYear(@PathVariable("id") String id) throws JSONException { + LOGGER.debug("Retreiving aggregations (by year) for repository with id : " + id ); + UriComponents uriComponents = searchDatasource("0","100"); + RequestFilter requestFilter = new RequestFilter(); + requestFilter.setId(id); + + List aggregationHistory = new ArrayList<>(); + Map> aggregationByYear = new HashMap<>(); + try { + String rs = restTemplate.postForObject(uriComponents.toUri(),requestFilter, String.class); + JSONObject repository = new JSONObject(rs); + aggregationHistory.addAll(Converter.getAggregationHistoryFromJson(repository.getJSONArray("datasourceInfo").getJSONObject(0))); + return aggregationHistory.size() == 0? aggregationByYear:createYearMap(aggregationHistory); + + } catch (JSONException e) { + LOGGER.debug("Exception on getRepositoryAggregations" , e); + emailUtils.reportException(e); + throw e; + } + } + + private Map> createYearMap(List aggregationHistory) { + Map> aggregationByYear; + aggregationHistory = aggregationHistory.stream() + .sorted(Comparator.comparing(AggregationDetails::getDate).reversed()) + .collect(Collectors.toList()); + + return aggregationHistory.stream() + .collect(Collectors.groupingBy(AggregationDetails::getYear)); + } + + @Override public List getRepositoriesByName(@PathVariable("name") String name, @PathVariable("page") String page, @@ -301,7 +344,7 @@ public class RepositoryApiImpl implements RepositoryApi { String rs = restTemplate.postForObject(uriComponents.toUri(),requestFilter, String.class); List repos = Converter.jsonToRepositoryList(new JSONObject(rs)); for (Repository r : repos) - getRepositoryInfo(r); + updateRepositoryInfo(r); return repos; }catch (Exception e){ LOGGER.debug("Exception on getRepositoriesByName" , e); @@ -331,7 +374,7 @@ public class RepositoryApiImpl implements RepositoryApi { } @Override - @PreAuthorize("hasRole('ROLE_USER')") + @PreAuthorize("hasRole('ROLE_USER') and #repository.registeredBy == authentication.userInfo.email") public Repository addRepository(@RequestParam("datatype") String datatype, @RequestBody Repository repository) throws Exception { @@ -342,7 +385,7 @@ public class RepositoryApiImpl implements RepositoryApi { } @Override - @PreAuthorize("hasRole('ROLE_USER')") + @PreAuthorize("hasRole('ROLE_USER') and #repository.registeredBy == authentication.userInfo.email") public Repository updateRepository(@RequestBody Repository repository) throws JSONException { UriComponents uriComponents = UriComponentsBuilder .fromHttpUrl(baseAddress + "/ds/update/") @@ -432,8 +475,9 @@ public class RepositoryApiImpl implements RepositoryApi { } @Override - @PreAuthorize("hasRole('ROLE_USER')") - public void deleteRepositoryInterface(@RequestParam("id") String id){ + @PreAuthorize("hasRole('ROLE_USER') and #registeredBy == authentication.userInfo.email") + public void deleteRepositoryInterface(@RequestParam("id") String id , + @RequestParam("registeredBy") String registeredBy){ UriComponents uriComponents = UriComponentsBuilder .fromHttpUrl(baseAddress + "/ds/api/") .path("/{id}") @@ -443,10 +487,11 @@ public class RepositoryApiImpl implements RepositoryApi { } @Override - @PreAuthorize("hasRole('ROLE_USER')") + @PreAuthorize("hasRole('ROLE_USER') and #registeredBy == authentication.userInfo.email") public RepositoryInterface addRepositoryInterface(@RequestParam("datatype") String datatype, @RequestParam("repoId") String repoId, - @RequestBody RepositoryInterface repositoryInterface) throws JSONException { + @RequestParam("registeredBy") String registeredBy, + @RequestBody RepositoryInterface repositoryInterface) throws JSONException,ResourceNotFoundException { try { Repository e = this.getRepositoryById(repoId); repositoryInterface = createRepositoryInterface(e,repositoryInterface,datatype); @@ -670,8 +715,9 @@ public class RepositoryApiImpl implements RepositoryApi { } @Override - @PreAuthorize("hasRole('ROLE_USER')") + @PreAuthorize("hasRole('ROLE_USER') and #registeredBy == authentication.userInfo.email") public RepositoryInterface updateRepositoryInterface(@RequestParam("repoId") String repoId, + @RequestParam("registeredBy") String registeredBy, @RequestBody RepositoryInterface repositoryInterface) throws JSONException { this.updateBaseUrl(repoId,repositoryInterface.getId(),repositoryInterface.getBaseUrl()); diff --git a/src/main/java/eu/dnetlib/repo/manager/service/controllers/ValidatorApi.java b/src/main/java/eu/dnetlib/repo/manager/service/controllers/ValidatorApi.java index 1fbadcd..646c50c 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/controllers/ValidatorApi.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/controllers/ValidatorApi.java @@ -9,6 +9,7 @@ import eu.dnetlib.repo.manager.shared.ValidationServiceException; import io.swagger.annotations.Api; import org.json.JSONException; import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.List; @@ -19,13 +20,17 @@ import java.util.List; @Api(description = "Validator API", tags = {"validator"}) public interface ValidatorApi { - @RequestMapping(value = "/submitJobForValidation",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE ) + @RequestMapping(value = "/submitJobForValidation",method = RequestMethod.POST, + consumes = MediaType.APPLICATION_JSON_VALUE, + produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody - void submitJobForValidation(JobForValidation jobForValidation); + JobForValidation submitJobForValidation(JobForValidation jobForValidation) throws ValidatorServiceException; - @RequestMapping(value = "/reSubmitJobForValidation/{jobId}",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE ) + @RequestMapping(value = "/reSubmitJobForValidation/{email}/{jobId}",method = RequestMethod.POST, + consumes = MediaType.APPLICATION_JSON_VALUE, + produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody - void reSubmitJobForValidation(String jobId) throws JSONException; + ResponseEntity reSubmitJobForValidation(String email,String jobId) throws JSONException, ValidatorServiceException; @RequestMapping(value = "/getRuleSets/{mode}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody diff --git a/src/main/java/eu/dnetlib/repo/manager/service/controllers/ValidatorApiImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/controllers/ValidatorApiImpl.java index 2bbda4a..7ab25f4 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/controllers/ValidatorApiImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/controllers/ValidatorApiImpl.java @@ -17,6 +17,8 @@ import io.swagger.annotations.ApiParam; import org.apache.log4j.Logger; import org.json.JSONException; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.PathVariable; @@ -86,20 +88,23 @@ public class ValidatorApiImpl implements ValidatorApi{ } @Override - @PreAuthorize("hasRole('ROLE_USER')") - public void submitJobForValidation(@RequestBody JobForValidation jobForValidation) { + @PreAuthorize("hasRole('ROLE_USER') and #jobForValidation.userEmail == authentication.userInfo.email") + public JobForValidation submitJobForValidation(@RequestBody JobForValidation jobForValidation) throws ValidatorServiceException { LOGGER.debug("Submit job for validation with id : " + jobForValidation.getDatasourceId()); try { this.getValidationService().submitValidationJob(jobForValidation); } catch (ValidatorServiceException e) { LOGGER.debug("Exception on submitJobForValidation" , e); emailUtils.reportException(e); + throw e; } + return jobForValidation; } @Override - @PreAuthorize("hasRole('ROLE_USER')") - public void reSubmitJobForValidation(@PathVariable("jobId") String jobId) throws JSONException { + @PreAuthorize("hasRole('ROLE_USER') and #email == authentication.userInfo.email") + public ResponseEntity reSubmitJobForValidation(@PathVariable("email") String email, + @PathVariable("jobId") String jobId) throws JSONException, ValidatorServiceException { LOGGER.debug("Resubmit validation job with id : " + jobId); StoredJob job = monitorApi.getJobSummary(jobId,"all"); Set contentRules = new HashSet(); @@ -125,6 +130,7 @@ public class ValidatorApiImpl implements ValidatorApi{ if (!usageRules.isEmpty()) job.setSelectedUsageRules(usageRules); this.submitJobForValidation(job); + return new ResponseEntity<>("OK",HttpStatus.OK); } @Override diff --git a/src/main/java/eu/dnetlib/repo/manager/service/exception/ResourceNotFoundException.java b/src/main/java/eu/dnetlib/repo/manager/service/exception/ResourceNotFoundException.java new file mode 100644 index 0000000..dbf6bb2 --- /dev/null +++ b/src/main/java/eu/dnetlib/repo/manager/service/exception/ResourceNotFoundException.java @@ -0,0 +1,15 @@ +package eu.dnetlib.repo.manager.service.exception; + +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.ResponseStatus; + +@ResponseStatus(HttpStatus.NOT_FOUND) +public class ResourceNotFoundException extends Exception { + public ResourceNotFoundException() { + super("Resource Not Found"); + } + + public ResourceNotFoundException(String id, String resourceType) { + super(resourceType + " with id " + id + " was not found"); + } +} diff --git a/src/main/java/eu/dnetlib/repo/manager/service/exception/ServerError.java b/src/main/java/eu/dnetlib/repo/manager/service/exception/ServerError.java new file mode 100644 index 0000000..9ba5239 --- /dev/null +++ b/src/main/java/eu/dnetlib/repo/manager/service/exception/ServerError.java @@ -0,0 +1,21 @@ +package eu.dnetlib.repo.manager.service.exception; + +public class ServerError { + + public final String url; + public final String error; + + public ServerError(String url, Exception ex) { + this.url = url; + this.error = ex.getMessage(); + } + + public String getUrl() { + return this.url; + } + + public String getError() { + return this.error; + } + +} diff --git a/src/main/java/eu/dnetlib/repo/manager/service/utils/Converter.java b/src/main/java/eu/dnetlib/repo/manager/service/utils/Converter.java index 01f9854..d8fa789 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/utils/Converter.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/utils/Converter.java @@ -29,8 +29,8 @@ public class Converter { JSONObject datasource = repositoryObject.getJSONObject("datasource"); - if( datasource.equals(null)) - return null; + //if( datasource.equals(null)) + // return null; repository.setId(datasource.get("id").toString()); repository.setOfficialName(datasource.get("officialname").toString()); @@ -321,8 +321,8 @@ public class Converter { public static List getAggregationHistoryFromJson(JSONObject datasourceInfo) throws JSONException { - if(datasourceInfo.get("aggregationHistory").toString().equals("[]")) - return null; + // if(datasourceInfo.get("aggregationHistory").toString().equals("[]")) + // return null; JSONArray rs = new JSONArray(datasourceInfo.get("aggregationHistory").toString()); List aggregationDetailsList = new ArrayList<>(); diff --git a/src/main/java/eu/dnetlib/repo/manager/shared/AggregationDetails.java b/src/main/java/eu/dnetlib/repo/manager/shared/AggregationDetails.java index c535943..95e66ed 100644 --- a/src/main/java/eu/dnetlib/repo/manager/shared/AggregationDetails.java +++ b/src/main/java/eu/dnetlib/repo/manager/shared/AggregationDetails.java @@ -2,6 +2,7 @@ package eu.dnetlib.repo.manager.shared; import com.google.gwt.user.client.rpc.IsSerializable; +import java.util.Calendar; import java.util.Date; public class AggregationDetails implements IsSerializable{ @@ -46,4 +47,10 @@ public class AggregationDetails implements IsSerializable{ public void setNumberOfRecords(int numberOfRecords) { this.numberOfRecords = numberOfRecords; } + + public String getYear() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(getDate()); + return String.valueOf(calendar.get(Calendar.YEAR)); + } } diff --git a/src/main/resources/application-context.xml b/src/main/resources/application-context.xml index 1078192..57e38d8 100644 --- a/src/main/resources/application-context.xml +++ b/src/main/resources/application-context.xml @@ -1,19 +1,13 @@ + 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"> - - + classpath*:/gr/**/springContext-*.properties classpath*:/eu/**/springContext-*.properties - classpath*:/eu/dnetlib/repo/manager/service/email-texts.properties + classpath*:/application.properties + classpath*:email-texts.properties classpath*:dnet-site-wizard.properties classpath*:dnet-site-override.properties diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..acd14a9 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,78 @@ +infrastructure.name=integration +# +## Container properties +container.hostname=aleka.athenarc.gr +container.context=uoa-repository-manager-service +container.port = 8480 +# +## IS +ISLookUpService.url = http://node6.t.openaire.research-infrastructures.eu/is/services/isLookUp +ISRegistryService.url = http://node6.t.openaire.research-infrastructures.eu/is/services/isRegistry +ISSNService.url = http://node6.t.openaire.research-infrastructures.eu/is/services/isSN +# +# +ValidatorService.url=http://adonis.athenarc.gr:8080/validator-service/services/validatorWebService +# +## Broker Service +services.broker.url = http://broker1-dev-dnet.d4science.org +services.broker.port = 8080 +services.broker.api = api/ +services.broker.openaire = openaireBroker +# +# +api.baseAddress=https://dev-openaire.d4science.org/openaire +##api.baseAddress=http://beta.services.openaire.eu:8080/openaire +# +service.repository-rest-api.baseUrl =http://${container.hostname}:${container.port} +services.repo-manager.baseUrl = http://${container.hostname}:${container.port}/${container.context} +# +transport.soap.baseAddress = http://${container.hostname}:${container.port}/${container.context} +transport.soap.force.local.address = false +# +services.repo-manager.adminEmail = pkanakakis@di.uoa.gr +services.repo-manager.repository.testing.mode = false +services.repo-manager.deploy.environment = development +services.validator.mail.host = smtp.gmail.com +services.validator.mail.port = 465 +services.validator.mail.fromAddress = no-reply@openaire.eu +services.validator.mail.replyToAddress = no-reply@openaire.eu +services.validator.mail.username = test.openaire@gmail.com +services.validator.mail.password = ^($*@$)*!$ +services.validator.mail.authenticate = true +services.validator.mail.override = false +services.validator.mail.logonly = false +services.validator.mail.mode = ssl +services.validator.mail.debug = false +services.validator.mail.overrideEmail = pkanakakis@di.uoa.gr +services.validator.mail.specialRecipients = pkanakakis@di.uoa.gr +# +services.validator.repoRegistration.override = pkanakakis@di.uoa.gr +# +# +repomanager.db.driverClassName = org.postgresql.Driver +repomanager.db.url = jdbc:postgresql://194.177.192.119:5432/repomanager +repomanager.db.username = dnet +repomanager.db.password = dnetPwd +# +services.repomanager.analyticsURL = http://analytics.openaire.eu/addsite.php? +# +topic_types.url = https://beta.services.openaire.eu/provision/mvc/vocabularies/dnet:topic_types.json +# +oidc.issuer = https://aai.openaire.eu/oidc/ +oidc.id = 767422b9-5461-4807-a80a-f9a2072d3a7d +oidc.secret = AMQtGlbTXNjwjhF0st28LmM6V0XypMdaVS7tJmGuYFlmH36iIv4t7tVqYuLYrNPkhnZ_GPUJvhymBhFupdgb6aU +# +#oidc.dev.home = http://koulis.athenarc.gr:4200/uoa-repository-manager-service/openid_connect_login +#webapp.dev.front = http://koulis.athenarc.gr:4200/landing +oidc.dev.home = http://aleka.athenarc.gr:4200/uoa-repository-manager-service/openid_connect_login +webapp.dev.front = http://aleka.athenarc.gr:4200/landing +# +redis.host = audrey.athenarc.gr +redis.port = 6379 +redis.password = E#Szvnidd +# +services.repomanager.usageStatisticsDiagramsBaseURL = https://beta.openaire.eu/stats3/ +services.repomanager.usageStatisticsNumbersBaseURL = https://beta.services.openaire.eu/usagestats/datasources/ +services.repomanager.usagestats.adminEmail = pkanakakis@di.uoa.gr + + diff --git a/src/main/resources/eu/dnetlib/repo/manager/service/email-texts.properties b/src/main/resources/email-texts.properties similarity index 100% rename from src/main/resources/eu/dnetlib/repo/manager/service/email-texts.properties rename to src/main/resources/email-texts.properties diff --git a/src/main/resources/eu/dnetlib/repo/manager/service/application.properties b/src/main/resources/eu/dnetlib/repo/manager/service/application.properties deleted file mode 100644 index efdfe7c..0000000 --- a/src/main/resources/eu/dnetlib/repo/manager/service/application.properties +++ /dev/null @@ -1,125 +0,0 @@ -infrastructure.name=integration - -# Container properties -container.hostname = localhost -container.context=repoManager -container.port = 8080 - -# IS -ISLookUpService.url = http://node6.t.openaire.research-infrastructures.eu/is/services/isLookUp -ISRegistryService.url = http://node6.t.openaire.research-infrastructures.eu/is/services/isRegistry -ISSNService.url = http://node6.t.openaire.research-infrastructures.eu/is/services/isSN -#ISLookUpService.url = http://localhost:9190/is/services/isLookUp -#ISRegistryService.url = http://localhost:9190/is/services/isRegistry -#ISSNService.url = http://localhost:9190/is/services/isSN -# LDAP -services.users.ldap.address = 194.177.192.119 -services.users.ldap.port = 389 -services.users.ldap.username = cn=admin,dc=openaire,dc=eu -services.users.ldap.password = serenata -services.users.ldap.usersDN = ou=users,dc=openaire,dc=eu - -#services.repo-manager.repository.testing.mode = true - -ValidatorService.url=http://adonis.athenarc.gr:8080/validator-service/services/validatorWebService - -# Broker Service -services.broker.url = http://broker1-dev-dnet.d4science.org -#services.broker.url = http://beta.lbs.openaire.eu -#services.broker.url = http://localhost -services.broker.port = 8080 -#services.broker.port = 9090 -services.broker.api = api/ -services.broker.openaire = openaireBroker - -# -# Configuration file classpath -configurationFileClassPath=classpath:application-context.xml - -api.baseAddress=https://dev-openaire.d4science.org/openaire -#api.baseAddress=http://beta.services.openaire.eu:8080/openaire - -service.repository-rest-api.baseUrl = http://localhost:8080 - - -# the address where validator is running and is accessible from the controllers of the web -services.repo-manager.baseUrl = http://${container.hostname}:${container.port}/${container.context} - -# base address for soap web services -transport.soap.baseAddress = http://${container.hostname}:${container.port}/${container.context} - -transport.soap.force.local.address = false - -# the email of the administrator -# he will receive all the automatic bug reports and feedback created -services.repo-manager.adminEmail = pkanakakis@di.uoa.gr - -# if set to true, getRepositories will return dummy repositories -services.repo-manager.repository.testing.mode = false - -services.repo-manager.deploy.environment = development - -# the mailhost for the mail service -services.validator.mail.host = smtp.gmail.com -# the port where the mail service is running -services.validator.mail.port = 465 -# the address that appears in the from field in the mails send by the validator -services.validator.mail.fromAddress = no-reply@openaire.eu -# the reply-to field value in the mails send by the validator -services.validator.mail.replyToAddress = no-reply@openaire.eu -# the username of the account used to login in the mail server -services.validator.mail.username = test.openaire@gmail.com -# the password of the account used to login in the mail server -services.validator.mail.password = ^($*@$)*!$ -# if authentication should take place -# if set to false username and password is not needed -services.validator.mail.authenticate = true -# is set to yes then all mails will not be sent to their targets but to the address specified in services.validator.mail.overrideEmail -services.validator.mail.override = false -# if set to true then no mails are send, they are only logged as a debug message -services.validator.mail.logonly = false -# the mode used for the mails send by the validator -services.validator.mail.mode = ssl -# used by eu.dnetlib.utils.MailLibrary to control debuggin messages -services.validator.mail.debug = false -# if services.validator.mail.override is true then all mails will be send only to this address -services.validator.mail.overrideEmail = pkanakakis@di.uoa.gr -# a comma-seperated list of address that will receive all mails about validations and repo registrations -services.validator.mail.specialRecipients = pkanakakis@di.uoa.gr - -# a comma-seperated list of addresses that have the ability to register repos without the need for validation and registration -services.validator.repoRegistration.override = pkanakakis@di.uoa.gr - - -repomanager.db.driverClassName = org.postgresql.Driver -repomanager.db.url = jdbc:postgresql://194.177.192.119:5432/repomanager -repomanager.db.username = dnet -repomanager.db.password = dnetPwd - -services.repomanager.analyticsURL = http://analytics.openaire.eu/addsite.php? - -topic_types.url = https://beta.services.openaire.eu/provision/mvc/vocabularies/dnet:topic_types.json - -#oidc.issuer = https://aai.openminted.eu/oidc/ -#oidc.id = 24e83176-1312-4ba3-bc0b-ffeebea1603e -#oidc.secret = U_gLOupYu2trYIOwfxGgZkkZoOHG_zGfaViOUsXcZ7qVQuF1rcJeQYKIDX1TY3z27CIoHaqq9ht2rmAiUmBRYQ - -oidc.issuer = https://aai.openaire.eu/oidc/ -oidc.id = 767422b9-5461-4807-a80a-f9a2072d3a7d -oidc.secret = AMQtGlbTXNjwjhF0st28LmM6V0XypMdaVS7tJmGuYFlmH36iIv4t7tVqYuLYrNPkhnZ_GPUJvhymBhFupdgb6aU - -#oidc.dev.home = http://194.177.192.121:8380/repomanager-service-dev/openid_connect_login -#webapp.dev.front = http://194.177.192.121:3000 - -oidc.dev.home = http://audrey.athenarc.gr:8380/repomanager-service-dev/openid_connect_login -webapp.dev.front = http://audrey.athenarc.gr:3000/dashboard - - -redis.host = aleka.athenarc.gr -redis.port = 6379 -redis.password = E#Szvnidd - -services.repomanager.usageStatisticsDiagramsBaseURL = https://beta.openaire.eu/stats3/ -services.repomanager.usageStatisticsNumbersBaseURL = https://beta.services.openaire.eu/usagestats/datasources/ -#services.repomanager.usagestats.adminEmail = repositoryusagestats@openaire.eu -services.repomanager.usagestats.adminEmail = pkanakakis@di.uoa.gr \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/aai-security.xml b/src/main/webapp/WEB-INF/aai-security.xml index 2992858..d6e84bd 100644 --- a/src/main/webapp/WEB-INF/aai-security.xml +++ b/src/main/webapp/WEB-INF/aai-security.xml @@ -18,7 +18,7 @@ - + - + + diff --git a/src/main/webapp/WEB-INF/applicationContext.xml b/src/main/webapp/WEB-INF/applicationContext.xml index 8a5f20d..41423aa 100644 --- a/src/main/webapp/WEB-INF/applicationContext.xml +++ b/src/main/webapp/WEB-INF/applicationContext.xml @@ -49,7 +49,8 @@ classpath*:/gr/**/springContext-*.properties classpath*:/eu/**/springContext-*.properties - classpath*:/eu/dnetlib/repo/manager/service/email-texts.properties + classpath*:/application.properties + classpath*:/email-texts.properties classpath*:dnet-site-wizard.properties classpath*:dnet-site-override.properties diff --git a/src/main/webapp/WEB-INF/spring-servlet.xml b/src/main/webapp/WEB-INF/spring-servlet.xml index 192f32c..d8964ef 100644 --- a/src/main/webapp/WEB-INF/spring-servlet.xml +++ b/src/main/webapp/WEB-INF/spring-servlet.xml @@ -18,8 +18,6 @@ class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler"/> - - \ No newline at end of file