parent
deae3b8b54
commit
1a4df2b852
|
@ -0,0 +1,10 @@
|
|||
# Provide
|
||||
|
||||
[...]
|
||||
|
||||
## Install and run:
|
||||
- Run **git clone** and then **cd uoa-repository-manager-service**.
|
||||
- Provide all not-set or redacted configurations, inside the **src/main/resources/application.properties** file.
|
||||
- Execute the **installAndRun.sh** script which installs and runs the app.
|
||||
- If you want to just run the app, then run the script with the argument "1": **./installAndRun.sh 1**
|
||||
- If you want to just install the app, then run the script with the argument "2": **./installAndRun.sh 2**
|
|
@ -12,7 +12,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|||
@EnableTransactionManagement
|
||||
public class DatasourceConfiguration {
|
||||
|
||||
private static Logger LOGGER = Logger.getLogger(DatasourceConfiguration.class);
|
||||
private static Logger logger = Logger.getLogger(DatasourceConfiguration.class);
|
||||
|
||||
@Value("${services.provide.db.driverClassName}")
|
||||
private String driverClassname;
|
||||
|
|
|
@ -22,10 +22,10 @@ public class FrontEndLinkURIAuthenticationSuccessHandler implements Authenticati
|
|||
|
||||
private String frontEndURI;
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(FrontEndLinkURIAuthenticationSuccessHandler.class);
|
||||
private static final Logger logger = Logger.getLogger(FrontEndLinkURIAuthenticationSuccessHandler.class);
|
||||
|
||||
public void init() {
|
||||
LOGGER.debug("Front end uri : " + frontEndURI);
|
||||
logger.debug("Front end uri : " + frontEndURI);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import javax.annotation.PostConstruct;
|
|||
@EnableRedisHttpSession
|
||||
public class RedisConfiguration {
|
||||
|
||||
private static Logger LOGGER = Logger.getLogger(RedisConfiguration.class);
|
||||
private static Logger logger = Logger.getLogger(RedisConfiguration.class);
|
||||
|
||||
@Value("${services.provide.redis.host}")
|
||||
private String host;
|
||||
|
@ -34,12 +34,12 @@ public class RedisConfiguration {
|
|||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
LOGGER.info(String.format("Redis : %s Port : %s Password : %s", host, port, password));
|
||||
logger.info(String.format("Redis : %s Port : %s Password : %s", host, port, password));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JedisConnectionFactory connectionFactory() {
|
||||
LOGGER.info(String.format("Redis : %s Port : %s Password : %s", host, port, password));
|
||||
logger.info(String.format("Redis : %s Port : %s Password : %s", host, port, password));
|
||||
JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory();
|
||||
jedisConnectionFactory.setHostName(host);
|
||||
jedisConnectionFactory.setPort(Integer.parseInt(port));
|
||||
|
@ -54,7 +54,7 @@ public class RedisConfiguration {
|
|||
serializer.setCookieName("openAIRESession");
|
||||
serializer.setCookiePath("/");
|
||||
serializer.setDomainName(domain);
|
||||
LOGGER.info("Serializer : " + serializer);
|
||||
logger.info("Serializer : " + serializer);
|
||||
return serializer;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
@Api(description = "Monitor API", tags = {"monitor"})
|
||||
public class MonitorController {
|
||||
|
||||
private static final Logger LOGGER = Logger
|
||||
.getLogger(MonitorController.class);
|
||||
private static final Logger logger = Logger.getLogger(MonitorController.class);
|
||||
|
||||
@Autowired
|
||||
private MonitorServiceImpl monitorService;
|
||||
|
|
|
@ -33,7 +33,7 @@ import java.util.List;
|
|||
@Api(description = "Piwik API", tags = {"piwik"})
|
||||
public class PiWikController {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(PiWikController.class);
|
||||
private static final Logger logger = Logger.getLogger(PiWikController.class);
|
||||
|
||||
@Autowired
|
||||
private PiWikServiceImpl piWikService;
|
||||
|
@ -120,7 +120,7 @@ public class PiWikController {
|
|||
writer.write(sb.toString());
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
LOGGER.error(e.getMessage());
|
||||
logger.error(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.io.File;
|
|||
@RestController
|
||||
@RequestMapping("/actuator/prometheus")
|
||||
public class PrometheusController { // TODO: remove this with migration to Spring Boot 2
|
||||
private static final Logger LOGGER = Logger.getLogger(PrometheusController.class);
|
||||
private static final Logger logger = Logger.getLogger(PrometheusController.class);
|
||||
|
||||
private final PiWikService piWikService;
|
||||
private final RepositoryService repositoryService;
|
||||
|
@ -52,7 +52,7 @@ public class PrometheusController { // TODO: remove this with migration to Sprin
|
|||
try (JvmGcMetrics jvmGcMetrics = new JvmGcMetrics() ) {
|
||||
jvmGcMetrics.bindTo(registry);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("", e);
|
||||
logger.error("", e);
|
||||
}
|
||||
new JvmMemoryMetrics().bindTo(registry);
|
||||
new DiskSpaceMetrics(new File("/")).bindTo(registry);
|
||||
|
|
|
@ -16,19 +16,17 @@ public class RestTemplateResponseErrorHandler implements ResponseErrorHandler {
|
|||
|
||||
@Override
|
||||
public boolean hasError(ClientHttpResponse httpResponse) throws IOException {
|
||||
return (httpResponse.getStatusCode().series() == CLIENT_ERROR
|
||||
|| httpResponse.getStatusCode().series() == SERVER_ERROR);
|
||||
HttpStatus.Series seriesError = httpResponse.getStatusCode().series();
|
||||
return ( (seriesError == CLIENT_ERROR) || (seriesError == SERVER_ERROR) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleError(ClientHttpResponse httpResponse) throws IOException {
|
||||
|
||||
if (httpResponse.getStatusCode().series() == HttpStatus.Series.SERVER_ERROR) {
|
||||
HttpStatus statusCode = httpResponse.getStatusCode();
|
||||
if ( statusCode == HttpStatus.NOT_FOUND )
|
||||
throw new IOException();
|
||||
else if (statusCode.series() == SERVER_ERROR)
|
||||
throw new EndPointException();
|
||||
} else if (httpResponse.getStatusCode().series() == HttpStatus.Series.CLIENT_ERROR) {
|
||||
if (httpResponse.getStatusCode() == HttpStatus.NOT_FOUND) {
|
||||
throw new IOException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,8 +40,7 @@ public class BrokerServiceImpl implements BrokerService {
|
|||
@Value("${services.provide.topic_types.url}")
|
||||
private String topicsURL;
|
||||
|
||||
private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger
|
||||
.getLogger(BrokerServiceImpl.class);
|
||||
private static final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(BrokerServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
RestTemplate restTemplate;
|
||||
|
@ -56,14 +55,14 @@ public class BrokerServiceImpl implements BrokerService {
|
|||
httpHeaders = new HttpHeaders();
|
||||
httpHeaders.set("Content-Type", "application/json");
|
||||
|
||||
LOGGER.debug("Init dnet topics!");
|
||||
logger.debug("Init dnet topics!");
|
||||
try (InputStream is = new URL(topicsURL).openStream()) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
JsonNode root = mapper.readTree(is);
|
||||
for (JsonNode term : root.path("terms"))
|
||||
topics.put(term.path("code").textValue(), parseTerm(term));
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("Exception on initDnetTopicsMap", e);
|
||||
logger.error("Exception on initDnetTopicsMap", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,7 +88,7 @@ public class BrokerServiceImpl implements BrokerService {
|
|||
// ret.setDatasourcesOfOthers(getDatasourcesOfUserType(getRepositoriesOfUser(user)));
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Exception on getDatasourcesOfUser", e);
|
||||
logger.error("Exception on getDatasourcesOfUser", e);
|
||||
}
|
||||
long end = System.currentTimeMillis();
|
||||
System.out.println("Getting datasources of user in " + (end - start) + "ms");
|
||||
|
@ -213,7 +212,7 @@ public class BrokerServiceImpl implements BrokerService {
|
|||
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(openairePath + service)
|
||||
.queryParam("email", userEmail);
|
||||
|
||||
LOGGER.debug(builder.build().encode().toUri());
|
||||
logger.debug(builder.build().encode().toUri());
|
||||
ResponseEntity<Map<String, List<SimpleSubscriptionDesc>>> resp;
|
||||
try {
|
||||
resp = restTemplate.exchange(
|
||||
|
|
|
@ -34,7 +34,6 @@ public class DashboardServiceImpl implements DashboardService {
|
|||
List<RepositorySummaryInfo> repositorySummaryInfoList = new ArrayList<>();
|
||||
|
||||
try {
|
||||
|
||||
List<RepositorySnippet> repositoriesOfUser = repositoryService.getRepositoriesSnippetsOfUser(userEmail, page, size);
|
||||
for (RepositorySnippet repository : repositoriesOfUser) {
|
||||
RepositorySummaryInfo repositorySummaryInfo = new RepositorySummaryInfo();
|
||||
|
@ -53,35 +52,29 @@ public class DashboardServiceImpl implements DashboardService {
|
|||
}
|
||||
}
|
||||
long end = System.currentTimeMillis();
|
||||
|
||||
System.out.println("Got repo aggregations in " + (end - start) + "ms");
|
||||
|
||||
try {
|
||||
|
||||
MetricsInfo metricsInfo = repositoryService.getMetricsInfoForRepository(repository.getId());
|
||||
repositorySummaryInfo.setTotalDownloads(metricsInfo.getMetricsNumbers().getTotalDownloads());
|
||||
repositorySummaryInfo.setTotalViews(metricsInfo.getMetricsNumbers().getTotalViews());
|
||||
|
||||
} catch (RepositoryServiceException e) {
|
||||
logger.error("Exception getting metrics info for repository: " + repository.getId(), e);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
List<BrowseEntry> events = brokerService.getTopicsForDatasource(repository.getOfficialname());
|
||||
Long totalEvents = 0L;
|
||||
for (BrowseEntry browseEntry : events)
|
||||
totalEvents += browseEntry.getSize();
|
||||
repositorySummaryInfo.setEnrichmentEvents(totalEvents);
|
||||
|
||||
|
||||
} catch (BrokerException e) {
|
||||
logger.error("Exception getting broker events for repository: " + repository.getId(), e);
|
||||
}
|
||||
|
||||
repositorySummaryInfoList.add(repositorySummaryInfo);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Something baad happened!", e);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.stream.Collectors;
|
|||
@Component("emailUtils")
|
||||
public class EmailUtilsImpl implements EmailUtils {
|
||||
|
||||
private final static Logger LOGGER = Logger.getLogger(EmailUtilsImpl.class);
|
||||
private final static Logger logger = Logger.getLogger(EmailUtilsImpl.class);
|
||||
|
||||
private final MailLibrary mailLibrary;
|
||||
private final RepositoryService repositoryService;
|
||||
|
@ -65,7 +65,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(this.usageStatsAdminEmail, subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending request to enable metrics email to administrator: " + this.usageStatsAdminEmail, e);
|
||||
logger.error("Error while sending request to enable metrics email to administrator: " + this.usageStatsAdminEmail, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(piwikInfo.getRequestorEmail(), subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending request to enable metrics email to user: " + piwikInfo.getRequestorEmail(), e);
|
||||
logger.error("Error while sending request to enable metrics email to user: " + piwikInfo.getRequestorEmail(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(this.usageStatsAdminEmail, subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending metrics enabled notification email to administator: " + this.usageStatsAdminEmail, e);
|
||||
logger.error("Error while sending metrics enabled notification email to administator: " + this.usageStatsAdminEmail, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(piwikInfo.getRequestorEmail(), subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending metrics enabled notification email to user: " + piwikInfo.getRequestorEmail(), e);
|
||||
logger.error("Error while sending metrics enabled notification email to user: " + piwikInfo.getRequestorEmail(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(this.provideAdminEmail, subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending registration notification email to the administrator", e);
|
||||
logger.error("Error while sending registration notification email to the administrator", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(repository.getRegisteredby(), subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(this.provideAdminEmail, subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending registration of interface notification email to the administrator", e);
|
||||
logger.error("Error while sending registration of interface notification email to the administrator", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(repository.getRegisteredby(), subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending registration of interface notification email to user: " + repository.getRegisteredby(), e);
|
||||
logger.error("Error while sending registration of interface notification email to user: " + repository.getRegisteredby(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(repository.getRegisteredby(), subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(this.provideAdminEmail, subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(repository.getRegisteredby(), subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(this.provideAdminEmail, subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(issuer, subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending registration notification email to the administrator", e);
|
||||
logger.error("Error while sending registration notification email to the administrator", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(this.provideAdminEmail, subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending registration notification email to the administrator", e);
|
||||
logger.error("Error while sending registration notification email to the administrator", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -473,7 +473,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(issuer, subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(this.provideAdminEmail, subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -524,7 +524,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(issuer, subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending validation submission notification email to user: " + issuer, e);
|
||||
logger.error("Error while sending validation submission notification email to user: " + issuer, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -545,7 +545,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(this.provideAdminEmail, subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending validation submission notification email to user: " + issuer, e);
|
||||
logger.error("Error while sending validation submission notification email to user: " + issuer, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -563,7 +563,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(this.provideAdminEmail, subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending validation submission notification email to user: " + issuer, e);
|
||||
logger.error("Error while sending validation submission notification email to user: " + issuer, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -583,7 +583,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(this.provideAdminEmail, subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending registration notification email to the administrator", e);
|
||||
logger.error("Error while sending registration notification email to the administrator", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -604,7 +604,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(repository.getRegisteredby(), subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -635,7 +635,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(this.provideAdminEmail, subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending registration notification email to the administrator", e);
|
||||
logger.error("Error while sending registration notification email to the administrator", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -666,7 +666,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(repository.getRegisteredby(), subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||
logger.error("Error while sending registration notification email to user: " + repository.getRegisteredby(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
this.sendMail(jobForValidation.getUserEmail(), subject, message);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending validation submission notification email to user: " + jobForValidation.getUserEmail(), e);
|
||||
logger.error("Error while sending validation submission notification email to user: " + jobForValidation.getUserEmail(), e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -742,10 +742,10 @@ public class EmailUtilsImpl implements EmailUtils {
|
|||
|
||||
public void sendMail(List<String> recipients, String subject, String message) throws Exception {
|
||||
try {
|
||||
LOGGER.debug("Sending e-mail\nRecipients: " + recipients + "\nSubject: " + subject + "\nMessage: " + message);
|
||||
logger.debug("Sending e-mail\nRecipients: " + recipients + "\nSubject: " + subject + "\nMessage: " + message);
|
||||
mailLibrary.sendEmail(recipients.toArray(new String[]{}), subject, message);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error sending e-mail\nRecipients: " + recipients + "\nSubject: " + subject + "\nMessage: " + message, e);
|
||||
logger.error("Error sending e-mail\nRecipients: " + recipients + "\nSubject: " + subject + "\nMessage: " + message, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ import java.util.stream.Collectors;
|
|||
@Service("monitorService")
|
||||
public class MonitorServiceImpl implements MonitorService {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(MonitorServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private MapJobDao crisJobs;
|
||||
|
||||
|
@ -41,9 +43,6 @@ public class MonitorServiceImpl implements MonitorService {
|
|||
}
|
||||
|
||||
|
||||
private static final Logger LOGGER = Logger
|
||||
.getLogger(MonitorServiceImpl.class);
|
||||
|
||||
@Override
|
||||
public JobsOfUser getJobsOfUser(String user,
|
||||
String jobType,
|
||||
|
@ -54,8 +53,8 @@ public class MonitorServiceImpl implements MonitorService {
|
|||
String validationStatus,
|
||||
String includeJobsTotal) throws JSONException, ValidatorServiceException {
|
||||
|
||||
LOGGER.debug("Getting jobs of user : " + user);
|
||||
LOGGER.debug(user + "/" + jobType + "/" + offset + "/" + dateFrom + "/" + dateTo + "/" + validationStatus + "/" + includeJobsTotal);
|
||||
logger.debug("Getting jobs of user : " + user
|
||||
+ "\n" + user + "/" + jobType + "/" + offset + "/" + dateFrom + "/" + dateTo + "/" + validationStatus + "/" + includeJobsTotal);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
// FIXME: this is a hack for CRIS Jan Dvorak Validator, should be implemented properly //
|
||||
|
@ -154,7 +153,7 @@ public class MonitorServiceImpl implements MonitorService {
|
|||
public int getJobsOfUserPerValidationStatus(String user,
|
||||
String jobType,
|
||||
String validationStatus) throws JSONException {
|
||||
LOGGER.debug("Getting job with validation status : " + validationStatus);
|
||||
logger.debug("Getting job with validation status : " + validationStatus);
|
||||
|
||||
if (jobType.equalsIgnoreCase("cris")) {
|
||||
return crisJobs.getJobs(user, validationStatus).size();
|
||||
|
@ -163,7 +162,7 @@ public class MonitorServiceImpl implements MonitorService {
|
|||
try {
|
||||
return getValidationService().getStoredJobsTotalNumberNew(user, jobType, validationStatus);
|
||||
} catch (ValidatorServiceException e) {
|
||||
LOGGER.error(e);
|
||||
logger.error(e);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -171,12 +170,12 @@ public class MonitorServiceImpl implements MonitorService {
|
|||
@Override
|
||||
public StoredJob getJobSummary(String jobId,
|
||||
String groupBy) throws JSONException {
|
||||
LOGGER.debug("Getting job summary with id : " + jobId);
|
||||
logger.debug("Getting job summary with id : " + jobId);
|
||||
StoredJob job = null;
|
||||
try {
|
||||
job = getValidationService().getStoredJob(Integer.parseInt(jobId), groupBy);
|
||||
} catch (ValidatorServiceException e) {
|
||||
LOGGER.error(e);
|
||||
logger.error(e);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
// FIXME: this is a hack for CRIS Jan Dvorak Validator, should be implemented properly //
|
||||
|
|
|
@ -32,6 +32,9 @@ import java.util.Map;
|
|||
@Service("piwikService")
|
||||
public class PiWikServiceImpl implements PiWikService {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(PiWikServiceImpl.class);
|
||||
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
|
||||
|
@ -47,8 +50,6 @@ public class PiWikServiceImpl implements PiWikService {
|
|||
@Qualifier("emailUtils")
|
||||
private EmailUtils emailUtils;
|
||||
|
||||
private static final Logger LOGGER = Logger
|
||||
.getLogger(PiWikServiceImpl.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 = ?;";
|
||||
|
||||
|
@ -168,10 +169,10 @@ public class PiWikServiceImpl implements PiWikService {
|
|||
emailUtils.sendUserMetricsEnabled(piwikInfo);
|
||||
|
||||
} catch (EmptyResultDataAccessException e) {
|
||||
LOGGER.error("Error while approving piwik site: ", e);
|
||||
logger.error("Error while approving piwik site: ", e);
|
||||
throw new RepositoryServiceException("General error", RepositoryServiceException.ErrorCode.GENERAL_ERROR);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending email to administrator or user about the enabling of metrics", e);
|
||||
logger.error("Error while sending email to administrator or user about the enabling of metrics", e);
|
||||
throw new RepositoryServiceException(e, RepositoryServiceException.ErrorCode.GENERAL_ERROR);
|
||||
}
|
||||
return new ResponseEntity<>("OK", HttpStatus.OK);
|
||||
|
@ -202,13 +203,13 @@ public class PiWikServiceImpl implements PiWikService {
|
|||
emailUtils.sendAdministratorRequestToEnableMetrics(piwikInfo);
|
||||
emailUtils.sendUserRequestToEnableMetrics(piwikInfo);
|
||||
} catch (UnsupportedEncodingException uee) {
|
||||
LOGGER.error("Error while creating piwikScript URL", uee);
|
||||
logger.error("Error while creating piwikScript URL", uee);
|
||||
throw new RepositoryServiceException("login.generalError", RepositoryServiceException.ErrorCode.GENERAL_ERROR);
|
||||
} catch (IOException ioe) {
|
||||
LOGGER.error("Error while creating piwik site", ioe);
|
||||
logger.error("Error while creating piwik site", ioe);
|
||||
throw new RepositoryServiceException("login.generalError", RepositoryServiceException.ErrorCode.GENERAL_ERROR);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while sending email to administrator or user about the request to enable metrics", e);
|
||||
logger.error("Error while sending email to administrator or user about the request to enable metrics", e);
|
||||
throw new RepositoryServiceException(e, RepositoryServiceException.ErrorCode.GENERAL_ERROR);
|
||||
}
|
||||
return piwikInfo;
|
||||
|
|
|
@ -53,7 +53,7 @@ import static eu.dnetlib.repo.manager.utils.DateUtils.getYear;
|
|||
@Service("repositoryService")
|
||||
public class RepositoryServiceImpl implements RepositoryService {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(RepositoryServiceImpl.class);
|
||||
private static final Logger logger = Logger.getLogger(RepositoryServiceImpl.class);
|
||||
|
||||
private final AuthorizationService authorizationService;
|
||||
private final RoleMappingService roleMappingService;
|
||||
|
@ -114,8 +114,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
LOGGER.debug("Initialization method of repository api!");
|
||||
LOGGER.debug("Updated version!");
|
||||
logger.debug("Initialization method of repository api! Updated version!");
|
||||
|
||||
for (String key : this.getVocabulary("dnet:datasource_typologies").getAsMap().keySet()) {
|
||||
if (key.contains("aggregator")) {
|
||||
|
@ -176,7 +175,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
@Override
|
||||
public List<Repository> getRepositories(List<String> ids, int page, int size) throws JSONException {
|
||||
List<Repository> repos = new ArrayList<>();
|
||||
LOGGER.debug("Retrieving repositories with ids : " + String.join(", ", ids));
|
||||
logger.debug("Retrieving repositories with ids : " + String.join(", ", ids));
|
||||
UriComponents uriComponents = searchDatasource(Integer.toString(Math.abs(page)), Integer.toString(Math.abs(size)));
|
||||
RequestFilter requestFilter = new RequestFilter();
|
||||
|
||||
|
@ -222,11 +221,11 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
mapper.getTypeFactory().constructCollectionType(List.class, RepositorySnippet.class)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.debug("Exception on getRepositoriesSnippetOfUser", e);
|
||||
logger.debug("Exception on getRepositoriesSnippetOfUser", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
LOGGER.debug("resultSet:" + resultSet);
|
||||
logger.debug("resultSet:" + resultSet);
|
||||
resultSet.parallelStream().forEach(repositorySnippet -> {
|
||||
repositorySnippet.setPiwikInfo(piWikService.getPiwikSiteForRepo(repositorySnippet.getId()));
|
||||
});
|
||||
|
@ -239,7 +238,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
String mode,
|
||||
Boolean managed) throws JSONException, IOException {
|
||||
|
||||
LOGGER.debug("Getting repositories by country!");
|
||||
logger.debug("Getting repositories by country!");
|
||||
int page = 0;
|
||||
int size = 100;
|
||||
List<RepositorySnippet> resultSet = new ArrayList<>();
|
||||
|
@ -252,8 +251,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
filterKey = "CRIS system";
|
||||
|
||||
|
||||
LOGGER.debug("Country code equals : " + country);
|
||||
LOGGER.debug("Filter mode equals : " + filterKey);
|
||||
logger.debug("Country code equals : " + country + " | Filter mode equals : " + filterKey);
|
||||
|
||||
UriComponents uriComponents = searchSnipperDatasource(String.valueOf(page), String.valueOf(size));
|
||||
RequestFilter requestFilter = new RequestFilter();
|
||||
|
@ -277,7 +275,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
public List<RepositorySnippet> searchRegisteredRepositories(String country, String typology, String englishName,
|
||||
String officialName, String requestSortBy, String order, int page, int pageSize) throws Exception {
|
||||
|
||||
LOGGER.debug("Searching registered repositories");
|
||||
logger.debug("Searching registered repositories");
|
||||
|
||||
Paging<RepositorySnippet> snippets = null;
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
@ -293,7 +291,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
try {
|
||||
String rs = restTemplate.postForObject(uriComponents.toUri(), requestFilter, String.class);
|
||||
if (rs == null) {
|
||||
LOGGER.error(String.format("DSM response is null : [url=%s]", uriComponents.toUri()));
|
||||
logger.error(String.format("DSM response is null : [url=%s]", uriComponents.toUri()));
|
||||
} else {
|
||||
JSONObject response = new JSONObject(rs);
|
||||
JSONArray jsonArray = (JSONArray) response.get("datasourceInfo");
|
||||
|
@ -305,7 +303,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error searching registered datasources", e);
|
||||
logger.error("Error searching registered datasources", e);
|
||||
throw e;
|
||||
}
|
||||
return snippets != null ? snippets.getResults() : null; // TODO: return paging when ui is compatible
|
||||
|
@ -330,14 +328,14 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
@Override
|
||||
public List<Repository> getRepositoriesOfUser(String page, String size) throws JSONException {
|
||||
String userEmail = ((OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication()).getUserInfo().getEmail();
|
||||
LOGGER.debug("Retrieving repositories of authenticated user : " + userEmail);
|
||||
logger.debug("Retrieving repositories of authenticated user : " + userEmail);
|
||||
Collection<String> repoIds = roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles());
|
||||
return getRepositories(new ArrayList<>(repoIds));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Repository> getRepositoriesOfUser(String userEmail, String page, String size) throws JSONException {
|
||||
LOGGER.debug("Retrieving repositories of authenticated user : " + userEmail);
|
||||
logger.debug("Retrieving repositories of authenticated user : " + userEmail);
|
||||
Collection<String> repoIds = roleMappingService.getRepoIdsByRoleIds(authorizationService.getUserRoles(userEmail));
|
||||
return getRepositories(new ArrayList<>(repoIds));
|
||||
}
|
||||
|
@ -369,7 +367,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
@Override
|
||||
public RepositorySnippet getRepositorySnippetById(String id) throws JSONException, ResourceNotFoundException {
|
||||
|
||||
LOGGER.debug("Retrieving repositories with id : " + id);
|
||||
logger.debug("Retrieving repositories with id : " + id);
|
||||
RepositorySnippet repo;
|
||||
UriComponents uriComponents = searchSnipperDatasource("0", "100");
|
||||
RequestFilter requestFilter = new RequestFilter();
|
||||
|
@ -388,7 +386,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
@Override
|
||||
public Repository getRepositoryById(String id) throws JSONException, ResourceNotFoundException {
|
||||
|
||||
LOGGER.debug("Retrieving repositories with id : " + id);
|
||||
logger.debug("Retrieving repositories with id : " + id);
|
||||
Repository repo;
|
||||
UriComponents uriComponents = searchDatasource("0", "100");
|
||||
RequestFilter requestFilter = new RequestFilter();
|
||||
|
@ -457,7 +455,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
String page,
|
||||
String size) throws JSONException {
|
||||
|
||||
LOGGER.debug("Retrieving repositories with official name : " + name);
|
||||
logger.debug("Retrieving repositories with official name : " + name);
|
||||
UriComponents uriComponents = searchDatasource("0", "100");
|
||||
RequestFilter requestFilter = new RequestFilter();
|
||||
requestFilter.setOfficialname(name);
|
||||
|
@ -481,7 +479,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
// String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
|
||||
ApiDetailsResponse rs = restTemplate.getForObject(uriComponents.toUri(), ApiDetailsResponse.class);
|
||||
if ( rs == null ) {
|
||||
LOGGER.error("The ApiDetailsResponse was null!");
|
||||
logger.error("The ApiDetailsResponse was null!");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -503,7 +501,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
@Override
|
||||
public Repository addRepository(String datatype, Repository repository) throws Exception {
|
||||
|
||||
LOGGER.debug("storing " + datatype + " repository with id: " + repository.getId());
|
||||
logger.debug("storing " + datatype + " repository with id: " + repository.getId());
|
||||
|
||||
repository.setActivationId(UUID.randomUUID().toString());
|
||||
repository.setCollectedfrom("infrastruct_::openaire");
|
||||
|
@ -542,10 +540,10 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
} catch (HttpClientErrorException e) {
|
||||
couId = registryCalls.getCouId(newRoleName);
|
||||
if (couId == null) {
|
||||
LOGGER.error(String.format("Could not create role '%s'", newRoleName), e);
|
||||
logger.error(String.format("Could not create role '%s'", newRoleName), e);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(String.format("Could not create role '%s'", newRoleName), e);
|
||||
logger.error(String.format("Could not create role '%s'", newRoleName), e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
@ -559,7 +557,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
// Add role to current user authorities
|
||||
authoritiesUpdater.addRole(roleMappingService.convertRepoIdToAuthority(repository.getId()));
|
||||
} catch (Exception e) {
|
||||
LOGGER.debug("Exception on assign role to user during add repository", e);
|
||||
logger.debug("Exception on assign role to user during add repository", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
@ -577,7 +575,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
|
||||
// FIXME: problematic
|
||||
// String json_repository = converter.toJson(repository);
|
||||
// LOGGER.debug("JSON to add(update) -> " + json_repository);
|
||||
// logger.debug("JSON to add(update) -> " + json_repository);
|
||||
|
||||
HttpEntity<Repository> httpEntity = new HttpEntity<>(repository, httpHeaders); // TODO: check if it works (Repository contains extra fields)
|
||||
ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity, ResponseEntity.class);
|
||||
|
@ -587,12 +585,12 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
emailUtils.sendUserRegistrationEmail(repository, authentication);
|
||||
emailUtils.sendAdminRegistrationEmail(repository, authentication);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error sending email", e);
|
||||
logger.error("Error sending email", e);
|
||||
}
|
||||
} else {
|
||||
Object responseBody = responseEntity.getBody();
|
||||
if ( responseBody != null )
|
||||
LOGGER.error("Error updating repository: " + responseBody);
|
||||
logger.error("Error updating repository: " + responseBody);
|
||||
}
|
||||
|
||||
return repository;
|
||||
|
@ -607,7 +605,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
|
||||
// FIXME: problematic
|
||||
// String json_repository = converter.toJson(repository);
|
||||
// LOGGER.debug("JSON to update -> " + json_repository);
|
||||
// logger.debug("JSON to update -> " + json_repository);
|
||||
|
||||
HttpEntity<Repository> httpEntity = new HttpEntity<>(repository, httpHeaders);
|
||||
ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity, ResponseEntity.class);
|
||||
|
@ -617,12 +615,12 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
emailUtils.sendUserUpdateRepositoryInfoEmail(repository, authentication);
|
||||
emailUtils.sendAdminUpdateRepositoryInfoEmail(repository, authentication);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error sending emails: " + e);
|
||||
logger.error("Error sending emails: " + e);
|
||||
}
|
||||
} else {
|
||||
Object responseBody = responseEntity.getBody();
|
||||
if ( responseBody != null )
|
||||
LOGGER.error("Error updating repository: " + responseBody);
|
||||
logger.error("Error updating repository: " + responseBody);
|
||||
}
|
||||
|
||||
return repository;
|
||||
|
@ -649,12 +647,12 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
emailUtils.sendUserRegistrationEmail(repository, authentication);
|
||||
emailUtils.sendAdminRegistrationEmail(repository, authentication);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error sending emails: " + e);
|
||||
logger.error("Error sending emails: " + e);
|
||||
}
|
||||
} else {
|
||||
Object responseBody = responseEntity.getBody();
|
||||
if ( responseBody != null )
|
||||
LOGGER.error("Error storing repository: " + responseBody);
|
||||
logger.error("Error storing repository: " + responseBody);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -665,7 +663,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
.fromHttpUrl(baseAddress + "/ds/api/")
|
||||
.path("/{id}")
|
||||
.build().expand(id).encode();
|
||||
LOGGER.debug(uriComponents.toUri());
|
||||
logger.debug(uriComponents.toUri());
|
||||
restTemplate.delete(uriComponents.toUri());
|
||||
}
|
||||
|
||||
|
@ -691,7 +689,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
emailUtils.sendAdminRegisterInterfaceEmail(e, comment, repositoryInterface, authentication);
|
||||
emailUtils.sendUserRegisterInterfaceEmail(e, comment, repositoryInterface, authentication);
|
||||
} catch (Exception ex) {
|
||||
LOGGER.error("Error sending emails: " + ex);
|
||||
logger.error("Error sending emails: " + ex);
|
||||
}
|
||||
|
||||
submitInterfaceValidation(e, getAuthenticatedUser().getEmail(), repositoryInterface, false);
|
||||
|
@ -714,10 +712,10 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
emailUtils.sendAdminUpdateInterfaceEmail(repository, comment, repositoryInterface, authentication);
|
||||
emailUtils.sendUserUpdateInterfaceEmail(repository, comment, repositoryInterface, authentication);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error sending emails: " + e);
|
||||
logger.error("Error sending emails: " + e);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOGGER.warn("Could not send emails", e);
|
||||
logger.warn("Could not send emails", e);
|
||||
}
|
||||
|
||||
submitInterfaceValidation(getRepositoryById(repoId), getAuthenticatedUser().getEmail(), repositoryInterface, true);
|
||||
|
@ -780,7 +778,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
iFace.setMetadataIdentifierPath("//*[local-name()='header']/*[local-name()='identifier']");
|
||||
iFace.setId("api_________::" + repo.getId() + "::" + UUID.randomUUID().toString().substring(0, 8));
|
||||
if (iFace.getAccessSet() == null || iFace.getAccessSet().isEmpty()) {
|
||||
LOGGER.debug("set is empty: " + iFace.getAccessSet());
|
||||
logger.debug("set is empty: " + iFace.getAccessSet());
|
||||
// iFace.removeAccessSet();
|
||||
iFace.setAccessSet("none");
|
||||
}
|
||||
|
@ -789,7 +787,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
|
||||
@Override
|
||||
public List<String> getDnetCountries() {
|
||||
LOGGER.debug("Getting dnet-countries!");
|
||||
logger.debug("Getting dnet-countries!");
|
||||
return converter.readFile("countries.txt");
|
||||
}
|
||||
|
||||
|
@ -831,7 +829,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
@Override
|
||||
public Map<String, String> getCompatibilityClasses(String mode) {
|
||||
|
||||
LOGGER.debug("Getting compatibility classes for mode: " + mode);
|
||||
logger.debug("Getting compatibility classes for mode: " + mode);
|
||||
Map<String, String> retMap = new HashMap<String, String>();
|
||||
|
||||
Map<String, String> compatibilityClasses = this.getVocabulary("dnet:compatibilityLevel").getAsMap();
|
||||
|
@ -866,7 +864,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
@Override
|
||||
public Map<String, String> getDatasourceClasses(String mode) {
|
||||
|
||||
LOGGER.debug("Getting datasource classes for mode: " + mode);
|
||||
logger.debug("Getting datasource classes for mode: " + mode);
|
||||
|
||||
Map<String, String> retMap = new HashMap<String, String>();
|
||||
|
||||
|
@ -927,7 +925,7 @@ public class RepositoryServiceImpl implements RepositoryService {
|
|||
return metricsInfo;
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while getting metrics info for repository: ", e);
|
||||
logger.error("Error while getting metrics info for repository: ", e);
|
||||
throw new RepositoryServiceException("General error", RepositoryServiceException.ErrorCode.GENERAL_ERROR);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import java.util.Objects;
|
|||
@Service("statsService")
|
||||
public class StatsServiceImpl implements StatsService {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(StatsServiceImpl.class);
|
||||
private static final Logger logger = Logger.getLogger(StatsServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
RestTemplate restTemplate;
|
||||
|
@ -67,10 +67,10 @@ public class StatsServiceImpl implements StatsService {
|
|||
Map metadata = (Map) ((Map<?, ?>) Objects.requireNonNull(rs.getBody())).get("meta");
|
||||
return String.valueOf(metadata.get("total"));
|
||||
} catch ( RestClientException rce ) {
|
||||
LOGGER.error(rce.getMessage());
|
||||
logger.error(rce.getMessage());
|
||||
return null;
|
||||
} catch ( Exception e ) {
|
||||
LOGGER.error("", e);
|
||||
logger.error("", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -94,15 +94,15 @@ public class StatsServiceImpl implements StatsService {
|
|||
ResponseEntity<Map> rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
|
||||
Map metadata = (Map) ((Map<?, ?>) Objects.requireNonNull(rs.getBody())).get("meta");
|
||||
if ( metadata == null ) {
|
||||
LOGGER.error("The metadata was null!");
|
||||
logger.error("The metadata was null!");
|
||||
return null;
|
||||
}
|
||||
return String.valueOf(metadata.get("total"));
|
||||
} catch ( RestClientException rce ) {
|
||||
LOGGER.error(rce.getMessage());
|
||||
logger.error(rce.getMessage());
|
||||
return null;
|
||||
} catch ( Exception e ) {
|
||||
LOGGER.error("", e);
|
||||
logger.error("", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -127,15 +127,15 @@ public class StatsServiceImpl implements StatsService {
|
|||
ResponseEntity<Map> rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
|
||||
Map metadata = (Map) ((Map<?, ?>) Objects.requireNonNull(rs.getBody())).get("meta");
|
||||
if ( metadata == null ) {
|
||||
LOGGER.error("The metadata was null!");
|
||||
logger.error("The metadata was null!");
|
||||
return null;
|
||||
}
|
||||
return String.valueOf(metadata.get("total"));
|
||||
} catch ( RestClientException rce ) {
|
||||
LOGGER.error(rce.getMessage());
|
||||
logger.error(rce.getMessage());
|
||||
return null;
|
||||
} catch ( Exception e ) {
|
||||
LOGGER.error("", e);
|
||||
logger.error("", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -159,15 +159,15 @@ public class StatsServiceImpl implements StatsService {
|
|||
ResponseEntity<Map> rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
|
||||
Map metadata = (Map) ((Map<?, ?>) Objects.requireNonNull(rs.getBody())).get("meta");
|
||||
if ( metadata == null ) {
|
||||
LOGGER.error("The metadata was null!");
|
||||
logger.error("The metadata was null!");
|
||||
return null;
|
||||
}
|
||||
return String.valueOf(metadata.get("total"));
|
||||
} catch ( RestClientException rce ) {
|
||||
LOGGER.error(rce.getMessage());
|
||||
logger.error(rce.getMessage());
|
||||
return null;
|
||||
} catch ( Exception e ) {
|
||||
LOGGER.error("", e);
|
||||
logger.error("", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -188,15 +188,15 @@ public class StatsServiceImpl implements StatsService {
|
|||
ResponseEntity<Map> rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
|
||||
Map metadata = (Map<?, ?>) rs.getBody();
|
||||
if ( metadata == null ) {
|
||||
LOGGER.error("The metadata was null!");
|
||||
logger.error("The metadata was null!");
|
||||
return null;
|
||||
}
|
||||
return String.valueOf(metadata.get("total"));
|
||||
} catch ( RestClientException rce ) {
|
||||
LOGGER.error(rce.getMessage());
|
||||
logger.error(rce.getMessage());
|
||||
return null;
|
||||
} catch ( Exception e ) {
|
||||
LOGGER.error("", e);
|
||||
logger.error("", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -217,15 +217,15 @@ public class StatsServiceImpl implements StatsService {
|
|||
ResponseEntity<Map> rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
|
||||
Map metadata = (Map<?, ?>) rs.getBody();
|
||||
if ( metadata == null ) {
|
||||
LOGGER.error("The metadata was null!");
|
||||
logger.error("The metadata was null!");
|
||||
return null;
|
||||
}
|
||||
return String.valueOf(metadata.get("total"));
|
||||
} catch ( RestClientException rce ) {
|
||||
LOGGER.error(rce.getMessage());
|
||||
logger.error(rce.getMessage());
|
||||
return null;
|
||||
} catch ( Exception e ) {
|
||||
LOGGER.error("", e);
|
||||
logger.error("", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -246,15 +246,15 @@ public class StatsServiceImpl implements StatsService {
|
|||
ResponseEntity<Map> rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
|
||||
Map metadata = (Map<?, ?>) rs.getBody();
|
||||
if ( metadata == null ) {
|
||||
LOGGER.error("The metadata was null!");
|
||||
logger.error("The metadata was null!");
|
||||
return null;
|
||||
}
|
||||
return String.valueOf(metadata.get("total"));
|
||||
} catch ( RestClientException rce ) {
|
||||
LOGGER.error(rce.getMessage());
|
||||
logger.error(rce.getMessage());
|
||||
return null;
|
||||
} catch ( Exception e ) {
|
||||
LOGGER.error("", e);
|
||||
logger.error("", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -280,10 +280,10 @@ public class StatsServiceImpl implements StatsService {
|
|||
usagestats.put("year", year);
|
||||
return usagestats;
|
||||
} catch ( RestClientException rce ) {
|
||||
LOGGER.error(rce.getMessage());
|
||||
logger.error(rce.getMessage());
|
||||
return null;
|
||||
} catch ( Exception e ) {
|
||||
LOGGER.error("", e);
|
||||
logger.error("", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ public class StatsServiceImpl implements StatsService {
|
|||
ResponseEntity<Map> rs = restTemplate.exchange(uriComponents.toUri(), HttpMethod.GET, null, Map.class);
|
||||
Map metadata = (Map) ((Map<?, ?>) Objects.requireNonNull(rs.getBody())).get("totals");
|
||||
if ( metadata == null ) {
|
||||
LOGGER.error("The metadata was null!");
|
||||
logger.error("The metadata was null!");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -309,10 +309,10 @@ public class StatsServiceImpl implements StatsService {
|
|||
|
||||
return (Integer) metadata.get("events");
|
||||
} catch ( RestClientException rce ) {
|
||||
LOGGER.error(rce.getMessage());
|
||||
logger.error(rce.getMessage());
|
||||
return null;
|
||||
} catch ( Exception e ) {
|
||||
LOGGER.error("", e);
|
||||
logger.error("", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class SushiliteServiceImpl implements SushiliteService {
|
|||
@Value("${services.provide.usagestats.sushiliteEndpoint}")
|
||||
private String usagestatsSushiliteEndpoint;
|
||||
|
||||
private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger.getLogger(SushiliteServiceImpl.class);
|
||||
private static final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(SushiliteServiceImpl.class);
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -85,19 +85,16 @@ public class SushiliteServiceImpl implements SushiliteService {
|
|||
}
|
||||
requestedItemList = resp.getBody().getReportResponse().getReportWrapper().getReport().getCustomer().getReportItems().subList(offset,upperIndex);
|
||||
}
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
LOGGER.debug("Exception on getReportResults - trying to cast strings to integers", e);
|
||||
logger.debug("Exception on getReportResults - trying to cast strings to integers", e);
|
||||
//emailUtils.reportException(e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ReportResponseWrapper newReportResponse = resp.getBody();
|
||||
newReportResponse.getReportResponse().getReportWrapper().getReport().getCustomer().setReportItems(requestedItemList);
|
||||
|
||||
|
||||
return newReportResponse;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,13 +16,13 @@ import java.util.stream.Collectors;
|
|||
@Service("userService")
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger
|
||||
private static final org.apache.log4j.Logger logger = org.apache.log4j.Logger
|
||||
.getLogger(UserServiceImpl.class);
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Object> login() {
|
||||
OIDCAuthenticationToken authentication = (OIDCAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
|
||||
LOGGER.debug("User authentication : " + authentication);
|
||||
logger.debug("User authentication : " + authentication);
|
||||
Map<String,Object> body = new HashMap<>();
|
||||
body.put("sub",authentication.getSub());
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public class ValidatorServiceImpl implements ValidatorService {
|
|||
|
||||
private Map<String, List<RuleSet>> rulesetMap = new ConcurrentHashMap<String, List<RuleSet>>();
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(ValidatorServiceImpl.class);
|
||||
private static final Logger logger = Logger.getLogger(ValidatorServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private EmailUtils emailUtils;
|
||||
|
@ -70,7 +70,7 @@ public class ValidatorServiceImpl implements ValidatorService {
|
|||
|
||||
@PostConstruct
|
||||
private void loadRules(){
|
||||
LOGGER.debug("PostConstruct method! Load rules!");
|
||||
logger.debug("PostConstruct method! Load rules!");
|
||||
try {
|
||||
for (RuleSet ruleSet : getValidationService().getRuleSets()) {
|
||||
if (ruleSet.getVisibility() != null && ruleSet.getVisibility().contains("development")) {
|
||||
|
@ -123,7 +123,7 @@ public class ValidatorServiceImpl implements ValidatorService {
|
|||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
} catch (ValidatorServiceException e) {
|
||||
LOGGER.error(e);
|
||||
logger.error(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -131,12 +131,12 @@ public class ValidatorServiceImpl implements ValidatorService {
|
|||
@Override
|
||||
@PreAuthorize("hasAuthority('REGISTERED_USER')")
|
||||
public JobForValidation submitJobForValidation(JobForValidation jobForValidation) throws ValidatorServiceException {
|
||||
LOGGER.debug("Submit job for validation with id : " + jobForValidation.getDatasourceId());
|
||||
logger.debug("Submit job for validation with id : " + jobForValidation.getDatasourceId());
|
||||
try {
|
||||
try {
|
||||
emailUtils.sendSubmitJobForValidationEmail(SecurityContextHolder.getContext().getAuthentication(), jobForValidation);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error sending email ", e);
|
||||
logger.error("Error sending email ", e);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
// FIXME: this is a hack for CRIS Jan Dvorak Validator, should be implemented properly //
|
||||
|
@ -153,7 +153,7 @@ public class ValidatorServiceImpl implements ValidatorService {
|
|||
// this.getValidationService().submitValidationJob(jobForValidation);
|
||||
} catch (Exception e) { // FIXME: replaced exception with log
|
||||
// throw new ValidatorServiceException(e);
|
||||
LOGGER.error(e);
|
||||
logger.error(e);
|
||||
}
|
||||
|
||||
return jobForValidation;
|
||||
|
@ -162,7 +162,7 @@ public class ValidatorServiceImpl implements ValidatorService {
|
|||
@Override
|
||||
public ResponseEntity<Object> reSubmitJobForValidation(String email,
|
||||
String jobId) throws JSONException, ValidatorServiceException {
|
||||
LOGGER.debug("Resubmit validation job with id : " + jobId);
|
||||
logger.debug("Resubmit validation job with id : " + jobId);
|
||||
StoredJob job = monitorApi.getJobSummary(jobId, "all");
|
||||
Set<Integer> contentRules = new HashSet<Integer>();
|
||||
Set<Integer> usageRules = new HashSet<Integer>();
|
||||
|
@ -197,20 +197,20 @@ public class ValidatorServiceImpl implements ValidatorService {
|
|||
|
||||
@Override
|
||||
public List<RuleSet> getRuleSets(String mode) {
|
||||
LOGGER.info("Getting rulesets for mode: " + mode);
|
||||
logger.info("Getting rulesets for mode: " + mode);
|
||||
return rulesetMap.get(mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSetsOfRepository(String url) {
|
||||
LOGGER.debug("Getting sets of repository with url : " + url);
|
||||
logger.debug("Getting sets of repository with url : " + url);
|
||||
|
||||
List<String> sets = null;
|
||||
|
||||
try {
|
||||
sets = OaiTools.getSetsOfRepo(url);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Exception on getSetsOfRepository" , e);
|
||||
logger.error("Exception on getSetsOfRepository" , e);
|
||||
}
|
||||
|
||||
return sets;
|
||||
|
@ -218,18 +218,18 @@ public class ValidatorServiceImpl implements ValidatorService {
|
|||
|
||||
@Override
|
||||
public boolean identifyRepo(String url) {
|
||||
LOGGER.debug("Identify repository with url : " + url);
|
||||
logger.debug("Identify repository with url : " + url);
|
||||
try {
|
||||
return OaiTools.identifyRepository(url);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error while identifying repository with url: " + url, e);
|
||||
logger.error("Error while identifying repository with url: " + url, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuleSet getRuleSet(String acronym) {
|
||||
LOGGER.debug("Getting ruleset with acronym : " + acronym);
|
||||
logger.debug("Getting ruleset with acronym : " + acronym);
|
||||
RuleSet ruleSet = null;
|
||||
try {
|
||||
for (List<RuleSet> ruleSets : this.rulesetMap.values()) {
|
||||
|
@ -241,7 +241,7 @@ public class ValidatorServiceImpl implements ValidatorService {
|
|||
}
|
||||
return ruleSet;
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error getting ruleset", e);
|
||||
logger.error("Error getting ruleset", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ public class ValidatorServiceImpl implements ValidatorService {
|
|||
@Override
|
||||
public InterfaceInformation getInterfaceInformation(String baseUrl) throws ValidationServiceException {
|
||||
try {
|
||||
LOGGER.debug("Getting interface information with url: " + baseUrl);
|
||||
logger.debug("Getting interface information with url: " + baseUrl);
|
||||
InterfaceInformation interfaceInformation = new InterfaceInformation();
|
||||
interfaceInformation.setIdentified(this.identifyRepo(baseUrl));
|
||||
if (interfaceInformation.isIdentified())
|
||||
|
@ -288,7 +288,7 @@ public class ValidatorServiceImpl implements ValidatorService {
|
|||
|
||||
return interfaceInformation;
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error getting interface information with url: " + baseUrl, e);
|
||||
logger.error("Error getting interface information with url: " + baseUrl, e);
|
||||
throw new ValidationServiceException("login.generalError", ValidationServiceException.ErrorCode.GENERAL_ERROR);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.Objects;
|
|||
@Component
|
||||
public class Converter {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(Converter.class);
|
||||
private static final Logger logger = Logger.getLogger(Converter.class);
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
|
@ -93,8 +93,7 @@ public class Converter {
|
|||
}
|
||||
br.close();
|
||||
} catch (Exception e) {
|
||||
LOGGER.debug("Error opening file!");
|
||||
LOGGER.error(e);
|
||||
logger.error("Error opening file!", e);
|
||||
}
|
||||
return list; // It may be empty.
|
||||
}
|
||||
|
|
|
@ -24,11 +24,11 @@ public class OaiTools {
|
|||
disableSslVerification();
|
||||
}
|
||||
|
||||
private static Logger LOGGER = Logger.getLogger(OaiTools.class);
|
||||
private static Logger logger = Logger.getLogger(OaiTools.class);
|
||||
|
||||
public static List<String> getSetsOfRepo(String baseUrl) throws Exception {
|
||||
try {
|
||||
LOGGER.debug("Getting sets of repository " + baseUrl);
|
||||
logger.debug("Getting sets of repository " + baseUrl);
|
||||
OaiPmhServer harvester = new OaiPmhServer(baseUrl);
|
||||
SetsList setList = harvester.listSets();
|
||||
ResumptionToken token = setList.getResumptionToken();
|
||||
|
@ -48,14 +48,14 @@ public class OaiTools {
|
|||
return ret;
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error getting sets of repository " + baseUrl, e);
|
||||
logger.error("Error getting sets of repository " + baseUrl, e);
|
||||
return new ArrayList<String>();
|
||||
//throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean identifyRepository(String baseUrl) throws Exception {
|
||||
LOGGER.debug("sending identify request to repo " + baseUrl);
|
||||
logger.debug("sending identify request to repo " + baseUrl);
|
||||
|
||||
OaiPmhServer harvester = new OaiPmhServer(baseUrl);
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class OaiTools {
|
|||
|
||||
return verifyIdentify(d);
|
||||
} catch (Exception e) {
|
||||
LOGGER.debug("Error verifying identify response", e);
|
||||
logger.debug("Error verifying identify response", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ public class OaiTools {
|
|||
private static void disableSslVerification() {
|
||||
try
|
||||
{
|
||||
LOGGER.debug("disabling ssl verification");
|
||||
logger.debug("disabling ssl verification");
|
||||
// Create a trust manager that does not validate certificate chains
|
||||
TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {
|
||||
public X509Certificate[] getAcceptedIssuers() {
|
||||
|
@ -139,9 +139,9 @@ public class OaiTools {
|
|||
// Install the all-trusting host verifier
|
||||
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
LOGGER.error("disabling ssl verification", e);
|
||||
logger.error("disabling ssl verification", e);
|
||||
} catch (KeyManagementException e) {
|
||||
LOGGER.error("error while disabling ssl verification", e);
|
||||
logger.error("error while disabling ssl verification", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue