change packages

This commit is contained in:
Michele Artini 2020-09-04 14:33:19 +02:00
parent 8dc4077fd6
commit e0a60c563c
82 changed files with 381 additions and 315 deletions

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs; package eu.dnetlib.broker;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs; package eu.dnetlib.broker;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -16,9 +16,9 @@ import org.springframework.data.elasticsearch.repository.config.EnableElasticsea
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import eu.dnetlib.lbs.elasticsearch.Event; import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.lbs.elasticsearch.Notification; import eu.dnetlib.broker.common.elasticsearch.Notification;
import eu.dnetlib.lbs.properties.ElasticSearchProperties; import eu.dnetlib.broker.common.properties.ElasticSearchProperties;
import io.prometheus.client.exporter.MetricsServlet; import io.prometheus.client.exporter.MetricsServlet;
import io.prometheus.client.hotspot.DefaultExports; import io.prometheus.client.hotspot.DefaultExports;
import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.builders.RequestHandlerSelectors;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.controllers; package eu.dnetlib.broker.controllers;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -10,20 +10,21 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import eu.dnetlib.lbs.controllers.objects.BufferStatus; import eu.dnetlib.broker.common.controllers.AbstractLbsController;
import eu.dnetlib.lbs.controllers.objects.CurrentStatus; import eu.dnetlib.broker.common.elasticsearch.EventRepository;
import eu.dnetlib.lbs.controllers.objects.DispatcherStatus; import eu.dnetlib.broker.common.elasticsearch.NotificationRepository;
import eu.dnetlib.lbs.controllers.objects.ThreadStatus; import eu.dnetlib.broker.common.subscriptions.SubscriptionRepository;
import eu.dnetlib.lbs.controllers.objects.Tool; import eu.dnetlib.broker.common.topics.TopicTypeRepository;
import eu.dnetlib.lbs.elasticsearch.EventRepository; import eu.dnetlib.broker.controllers.objects.BufferStatus;
import eu.dnetlib.lbs.elasticsearch.NotificationRepository; import eu.dnetlib.broker.controllers.objects.CurrentStatus;
import eu.dnetlib.lbs.events.output.DispatcherManager; import eu.dnetlib.broker.controllers.objects.DispatcherStatus;
import eu.dnetlib.lbs.events.output.NotificationDispatcher; import eu.dnetlib.broker.controllers.objects.ThreadStatus;
import eu.dnetlib.lbs.subscriptions.SubscriptionRepository; import eu.dnetlib.broker.controllers.objects.Tool;
import eu.dnetlib.lbs.topics.TopicTypeRepository; import eu.dnetlib.broker.events.output.DispatcherManager;
import eu.dnetlib.lbs.utils.LbsQueue; import eu.dnetlib.broker.events.output.NotificationDispatcher;
import eu.dnetlib.lbs.utils.QueueManager; import eu.dnetlib.broker.utils.LbsQueue;
import eu.dnetlib.lbs.utils.ThreadManager; import eu.dnetlib.broker.utils.QueueManager;
import eu.dnetlib.broker.utils.ThreadManager;
@RestController @RestController
@RequestMapping("/ajax") @RequestMapping("/ajax")

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.controllers; package eu.dnetlib.broker.controllers;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.controllers; package eu.dnetlib.broker.controllers;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
@ -23,13 +23,14 @@ import org.springframework.web.bind.annotation.RestController;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import eu.dnetlib.lbs.LiteratureBrokerServiceConfiguration; import eu.dnetlib.broker.LiteratureBrokerServiceConfiguration;
import eu.dnetlib.lbs.elasticsearch.Event; import eu.dnetlib.broker.common.controllers.AbstractLbsController;
import eu.dnetlib.lbs.elasticsearch.EventRepository; import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.lbs.elasticsearch.EventStatsManager; import eu.dnetlib.broker.common.elasticsearch.EventRepository;
import eu.dnetlib.lbs.elasticsearch.EventStatsManager.BrowseEntry; import eu.dnetlib.broker.common.elasticsearch.EventStatsManager;
import eu.dnetlib.lbs.subscriptions.Subscription; import eu.dnetlib.broker.common.elasticsearch.EventStatsManager.BrowseEntry;
import eu.dnetlib.lbs.subscriptions.SubscriptionRepository; import eu.dnetlib.broker.common.subscriptions.Subscription;
import eu.dnetlib.broker.common.subscriptions.SubscriptionRepository;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.controllers; package eu.dnetlib.broker.controllers;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
@ -9,9 +9,10 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import eu.dnetlib.lbs.LiteratureBrokerServiceConfiguration; import eu.dnetlib.broker.LiteratureBrokerServiceConfiguration;
import eu.dnetlib.lbs.elasticsearch.Notification; import eu.dnetlib.broker.common.controllers.AbstractLbsController;
import eu.dnetlib.lbs.elasticsearch.NotificationRepository; import eu.dnetlib.broker.common.elasticsearch.Notification;
import eu.dnetlib.broker.common.elasticsearch.NotificationRepository;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.controllers; package eu.dnetlib.broker.controllers;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -11,10 +11,11 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import eu.dnetlib.lbs.LiteratureBrokerServiceConfiguration; import eu.dnetlib.broker.LiteratureBrokerServiceConfiguration;
import eu.dnetlib.lbs.matchers.SubscriptionEventMatcher; import eu.dnetlib.broker.common.controllers.AbstractLbsController;
import eu.dnetlib.lbs.subscriptions.Subscription; import eu.dnetlib.broker.common.subscriptions.Subscription;
import eu.dnetlib.lbs.subscriptions.SubscriptionRepository; import eu.dnetlib.broker.common.subscriptions.SubscriptionRepository;
import eu.dnetlib.broker.matchers.SubscriptionEventMatcher;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.controllers; package eu.dnetlib.broker.controllers;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
@ -21,13 +21,14 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import eu.dnetlib.lbs.LiteratureBrokerServiceConfiguration; import eu.dnetlib.broker.LiteratureBrokerServiceConfiguration;
import eu.dnetlib.lbs.elasticsearch.NotificationRepository; import eu.dnetlib.broker.common.controllers.AbstractLbsController;
import eu.dnetlib.lbs.subscriptions.MapCondition; import eu.dnetlib.broker.common.elasticsearch.NotificationRepository;
import eu.dnetlib.lbs.subscriptions.NotificationFrequency; import eu.dnetlib.broker.common.subscriptions.MapCondition;
import eu.dnetlib.lbs.subscriptions.NotificationMode; import eu.dnetlib.broker.common.subscriptions.NotificationFrequency;
import eu.dnetlib.lbs.subscriptions.Subscription; import eu.dnetlib.broker.common.subscriptions.NotificationMode;
import eu.dnetlib.lbs.subscriptions.SubscriptionRepository; import eu.dnetlib.broker.common.subscriptions.Subscription;
import eu.dnetlib.broker.common.subscriptions.SubscriptionRepository;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.controllers; package eu.dnetlib.broker.controllers;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
@ -18,9 +18,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import eu.dnetlib.lbs.LiteratureBrokerServiceConfiguration; import eu.dnetlib.broker.LiteratureBrokerServiceConfiguration;
import eu.dnetlib.lbs.topics.TopicType; import eu.dnetlib.broker.common.controllers.AbstractLbsController;
import eu.dnetlib.lbs.topics.TopicTypeRepository; import eu.dnetlib.broker.common.topics.TopicType;
import eu.dnetlib.broker.common.topics.TopicTypeRepository;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -33,7 +34,7 @@ public class TopicsController extends AbstractLbsController {
private TopicTypeRepository topicTypeRepo; private TopicTypeRepository topicTypeRepo;
private final Predicate<String> verifyExpression = private final Predicate<String> verifyExpression =
Pattern.compile("^([a-zA-Z0-9._-]+|<[a-zA-Z0-9._-]+>)(\\/([a-zA-Z0-9._-]+|<[a-zA-Z0-9._-]+>))+$").asPredicate(); Pattern.compile("^([a-zA-Z0-9._-]+|<[a-zA-Z0-9._-]+>)(\\/([a-zA-Z0-9._-]+|<[a-zA-Z0-9._-]+>))+$").asPredicate();
@ApiOperation("Return the list of topic types") @ApiOperation("Return the list of topic types")
@GetMapping("") @GetMapping("")
@ -44,9 +45,9 @@ public class TopicsController extends AbstractLbsController {
@ApiOperation("Register a new topic type") @ApiOperation("Register a new topic type")
@PostMapping("/add") @PostMapping("/add")
public TopicType registerTopicType(@RequestParam final String name, public TopicType registerTopicType(@RequestParam final String name,
@RequestParam final String expression, @RequestParam final String expression,
@RequestParam final String producerId, @RequestParam final String producerId,
@RequestParam final String mapKeys) { @RequestParam final String mapKeys) {
if (StringUtils.isBlank(name)) { throw new IllegalArgumentException("name is empty"); } if (StringUtils.isBlank(name)) { throw new IllegalArgumentException("name is empty"); }
if (StringUtils.isBlank(expression)) { throw new IllegalArgumentException("expression is empty"); } if (StringUtils.isBlank(expression)) { throw new IllegalArgumentException("expression is empty"); }

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.controllers.objects; package eu.dnetlib.broker.controllers.objects;
public class BufferStatus implements Comparable<BufferStatus> { public class BufferStatus implements Comparable<BufferStatus> {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.controllers.objects; package eu.dnetlib.broker.controllers.objects;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -8,9 +8,9 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import eu.dnetlib.lbs.properties.DatabaseProperties; import eu.dnetlib.broker.common.properties.DatabaseProperties;
import eu.dnetlib.lbs.properties.ElasticSearchProperties; import eu.dnetlib.broker.common.properties.ElasticSearchProperties;
import eu.dnetlib.lbs.properties.EmailProperties; import eu.dnetlib.broker.properties.EmailProperties;
@Component @Component
public class CurrentStatus { public class CurrentStatus {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.controllers.objects; package eu.dnetlib.broker.controllers.objects;
public class DispatcherStatus implements Comparable<DispatcherStatus> { public class DispatcherStatus implements Comparable<DispatcherStatus> {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.controllers.objects; package eu.dnetlib.broker.controllers.objects;
public class ThreadStatus implements Comparable<ThreadStatus> { public class ThreadStatus implements Comparable<ThreadStatus> {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.controllers.objects; package eu.dnetlib.broker.controllers.objects;
public class Tool { public class Tool {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.cron; package eu.dnetlib.broker.cron;
import java.util.Date; import java.util.Date;
@ -9,9 +9,9 @@ import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import eu.dnetlib.lbs.elasticsearch.EventRepository; import eu.dnetlib.broker.common.elasticsearch.EventRepository;
import eu.dnetlib.lbs.matchers.SubscriptionEventMatcher; import eu.dnetlib.broker.common.subscriptions.SubscriptionRepository;
import eu.dnetlib.lbs.subscriptions.SubscriptionRepository; import eu.dnetlib.broker.matchers.SubscriptionEventMatcher;
@Component @Component
@Profile("!openaire") @Profile("!openaire")

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.events.manager; package eu.dnetlib.broker.events.manager;
import java.util.List; import java.util.List;
import java.util.stream.StreamSupport; import java.util.stream.StreamSupport;
@ -6,15 +6,15 @@ import java.util.stream.StreamSupport;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import eu.dnetlib.lbs.elasticsearch.Event; import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.lbs.elasticsearch.EventRepository; import eu.dnetlib.broker.common.elasticsearch.EventRepository;
import eu.dnetlib.lbs.elasticsearch.Notification; import eu.dnetlib.broker.common.elasticsearch.Notification;
import eu.dnetlib.lbs.elasticsearch.NotificationRepository; import eu.dnetlib.broker.common.elasticsearch.NotificationRepository;
import eu.dnetlib.lbs.events.output.DispatcherManager; import eu.dnetlib.broker.common.subscriptions.NotificationFrequency;
import eu.dnetlib.lbs.subscriptions.NotificationFrequency; import eu.dnetlib.broker.common.subscriptions.Subscription;
import eu.dnetlib.lbs.subscriptions.Subscription; import eu.dnetlib.broker.common.subscriptions.SubscriptionRepository;
import eu.dnetlib.lbs.subscriptions.SubscriptionRepository; import eu.dnetlib.broker.events.output.DispatcherManager;
import eu.dnetlib.lbs.utils.LbsQueue; import eu.dnetlib.broker.utils.LbsQueue;
public class EventManager implements Runnable { public class EventManager implements Runnable {
@ -27,9 +27,9 @@ public class EventManager implements Runnable {
private static final Log log = LogFactory.getLog(EventManager.class); private static final Log log = LogFactory.getLog(EventManager.class);
public EventManager(final EventRepository eventRepository, final NotificationRepository notificationRepository, public EventManager(final EventRepository eventRepository, final NotificationRepository notificationRepository,
final SubscriptionRepository subscriptionRepo, final SubscriptionRepository subscriptionRepo,
final DispatcherManager dispatcherManager, final DispatcherManager dispatcherManager,
final LbsQueue<String, Event> queue) { final LbsQueue<String, Event> queue) {
this.eventRepository = eventRepository; this.eventRepository = eventRepository;
this.notificationRepository = notificationRepository; this.notificationRepository = notificationRepository;
this.subscriptionRepo = subscriptionRepo; this.subscriptionRepo = subscriptionRepo;
@ -52,13 +52,13 @@ public class EventManager implements Runnable {
list.stream().filter(Event::isInstantMessage).forEach(e -> { list.stream().filter(Event::isInstantMessage).forEach(e -> {
final Iterable<Subscription> iter = this.subscriptionRepo.findByTopic(e.getTopic()); final Iterable<Subscription> iter = this.subscriptionRepo.findByTopic(e.getTopic());
StreamSupport.stream(iter.spliterator(), false) StreamSupport.stream(iter.spliterator(), false)
.filter(s -> s.verifyEventConditions(e)) .filter(s -> s.verifyEventConditions(e))
.filter(s -> s.getFrequency() == NotificationFrequency.realtime) .filter(s -> s.getFrequency() == NotificationFrequency.realtime)
.forEach(s -> { .forEach(s -> {
final Notification n = new Notification(s, e); final Notification n = new Notification(s, e);
this.notificationRepository.save(n); this.notificationRepository.save(n);
this.dispatcherManager.dispatch(s, e); this.dispatcherManager.dispatch(s, e);
}); });
}); });
} }
} }

View File

@ -1,14 +1,14 @@
package eu.dnetlib.lbs.events.manager; package eu.dnetlib.broker.events.manager;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import eu.dnetlib.lbs.elasticsearch.Event; import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.lbs.elasticsearch.EventRepository; import eu.dnetlib.broker.common.elasticsearch.EventRepository;
import eu.dnetlib.lbs.elasticsearch.NotificationRepository; import eu.dnetlib.broker.common.elasticsearch.NotificationRepository;
import eu.dnetlib.lbs.events.output.DispatcherManager; import eu.dnetlib.broker.common.subscriptions.SubscriptionRepository;
import eu.dnetlib.lbs.subscriptions.SubscriptionRepository; import eu.dnetlib.broker.events.output.DispatcherManager;
import eu.dnetlib.lbs.utils.LbsQueue; import eu.dnetlib.broker.utils.LbsQueue;
@Component @Component
public class EventManagerFactory { public class EventManagerFactory {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.events.output; package eu.dnetlib.broker.events.output;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
@ -10,11 +10,11 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import eu.dnetlib.lbs.elasticsearch.Event; import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.lbs.subscriptions.Subscription; import eu.dnetlib.broker.common.subscriptions.Subscription;
import eu.dnetlib.lbs.utils.LbsQueue; import eu.dnetlib.broker.utils.LbsQueue;
import eu.dnetlib.lbs.utils.QueueManager; import eu.dnetlib.broker.utils.QueueManager;
import eu.dnetlib.lbs.utils.ThreadManager; import eu.dnetlib.broker.utils.ThreadManager;
public abstract class AbstractNotificationDispatcher<T> implements NotificationDispatcher, BeanNameAware, Runnable { public abstract class AbstractNotificationDispatcher<T> implements NotificationDispatcher, BeanNameAware, Runnable {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.events.output; package eu.dnetlib.broker.events.output;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -9,8 +9,8 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import eu.dnetlib.lbs.elasticsearch.Event; import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.lbs.subscriptions.Subscription; import eu.dnetlib.broker.common.subscriptions.Subscription;
@Component @Component
public class DispatcherManager { public class DispatcherManager {
@ -22,9 +22,9 @@ public class DispatcherManager {
public void dispatch(final Subscription s, final Event... events) { public void dispatch(final Subscription s, final Event... events) {
final Optional<NotificationDispatcher> dispatcher = this.dispatchers final Optional<NotificationDispatcher> dispatcher = this.dispatchers
.stream() .stream()
.filter(d -> d.getMode() == s.getMode()) .filter(d -> d.getMode() == s.getMode())
.findFirst(); .findFirst();
if (dispatcher.isPresent()) { if (dispatcher.isPresent()) {
dispatcher.get().sendNotification(s, events); dispatcher.get().sendNotification(s, events);

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.events.output; package eu.dnetlib.broker.events.output;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@ -27,10 +27,10 @@ import org.springframework.stereotype.Component;
import com.google.common.base.Splitter; import com.google.common.base.Splitter;
import eu.dnetlib.lbs.elasticsearch.Event; import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.lbs.properties.EmailProperties; import eu.dnetlib.broker.common.subscriptions.NotificationMode;
import eu.dnetlib.lbs.subscriptions.NotificationMode; import eu.dnetlib.broker.common.subscriptions.Subscription;
import eu.dnetlib.lbs.subscriptions.Subscription; import eu.dnetlib.broker.properties.EmailProperties;
@Component @Component
public class EmailDispatcher extends AbstractNotificationDispatcher<Message> { public class EmailDispatcher extends AbstractNotificationDispatcher<Message> {
@ -117,7 +117,7 @@ public class EmailDispatcher extends AbstractNotificationDispatcher<Message> {
return new Authenticator() { return new Authenticator() {
private final PasswordAuthentication authentication = private final PasswordAuthentication authentication =
new PasswordAuthentication(props.getSmtpUser(), props.getSmtpPassword()); new PasswordAuthentication(props.getSmtpUser(), props.getSmtpPassword());
@Override @Override
protected PasswordAuthentication getPasswordAuthentication() { protected PasswordAuthentication getPasswordAuthentication() {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.events.output; package eu.dnetlib.broker.events.output;
import java.io.StringWriter; import java.io.StringWriter;
@ -7,9 +7,9 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import eu.dnetlib.lbs.elasticsearch.Event; import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.lbs.subscriptions.NotificationMode; import eu.dnetlib.broker.common.subscriptions.NotificationMode;
import eu.dnetlib.lbs.subscriptions.Subscription; import eu.dnetlib.broker.common.subscriptions.Subscription;
@Component @Component
@Profile("dev") @Profile("dev")

View File

@ -0,0 +1,18 @@
package eu.dnetlib.broker.events.output;
import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.broker.common.subscriptions.NotificationMode;
import eu.dnetlib.broker.common.subscriptions.Subscription;
public interface NotificationDispatcher {
void sendNotification(Subscription subscription, Event... events);
void resetCount();
String getDispatcherName();
long count();
NotificationMode getMode();
}

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.matchers; package eu.dnetlib.broker.matchers;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
@ -25,17 +25,17 @@ import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilde
import org.springframework.data.util.CloseableIterator; import org.springframework.data.util.CloseableIterator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import eu.dnetlib.lbs.elasticsearch.Event; import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.lbs.elasticsearch.Notification; import eu.dnetlib.broker.common.elasticsearch.Notification;
import eu.dnetlib.lbs.elasticsearch.NotificationRepository; import eu.dnetlib.broker.common.elasticsearch.NotificationRepository;
import eu.dnetlib.lbs.events.output.DispatcherManager; import eu.dnetlib.broker.common.properties.ElasticSearchProperties;
import eu.dnetlib.lbs.properties.ElasticSearchProperties; import eu.dnetlib.broker.common.subscriptions.MapCondition;
import eu.dnetlib.lbs.subscriptions.MapCondition; import eu.dnetlib.broker.common.subscriptions.Subscription;
import eu.dnetlib.lbs.subscriptions.Subscription; import eu.dnetlib.broker.common.subscriptions.SubscriptionRepository;
import eu.dnetlib.lbs.subscriptions.SubscriptionRepository; import eu.dnetlib.broker.events.output.DispatcherManager;
import eu.dnetlib.lbs.utils.LbsQueue; import eu.dnetlib.broker.utils.LbsQueue;
import eu.dnetlib.lbs.utils.QueueManager; import eu.dnetlib.broker.utils.QueueManager;
import eu.dnetlib.lbs.utils.ThreadManager; import eu.dnetlib.broker.utils.ThreadManager;
@Profile("!openaire") @Profile("!openaire")
@Component @Component

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.metrics; package eu.dnetlib.broker.metrics;
public interface MetricInterceptor { public interface MetricInterceptor {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.metrics; package eu.dnetlib.broker.metrics;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.metrics; package eu.dnetlib.broker.metrics;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.metrics; package eu.dnetlib.broker.metrics;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.openaire; package eu.dnetlib.broker.openaire;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -7,10 +7,10 @@ import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import eu.dnetlib.lbs.subscriptions.ConditionOperator; import eu.dnetlib.broker.common.subscriptions.ConditionOperator;
import eu.dnetlib.lbs.subscriptions.ConditionParams; import eu.dnetlib.broker.common.subscriptions.ConditionParams;
import eu.dnetlib.lbs.subscriptions.MapCondition; import eu.dnetlib.broker.common.subscriptions.MapCondition;
import eu.dnetlib.lbs.utils.MapValueType; import eu.dnetlib.broker.common.utils.MapValueType;
public class AdvQueryObject { public class AdvQueryObject {
@ -25,7 +25,7 @@ public class AdvQueryObject {
public AdvQueryObject() {} public AdvQueryObject() {}
public AdvQueryObject(final String datasource, final String topic, final List<String> titles, final List<String> subjects, final List<String> authors, public AdvQueryObject(final String datasource, final String topic, final List<String> titles, final List<String> subjects, final List<String> authors,
final List<Range> dates, final Range trust) { final List<Range> dates, final Range trust) {
super(); super();
this.datasource = datasource; this.datasource = datasource;
this.topic = topic; this.topic = topic;
@ -96,32 +96,32 @@ public class AdvQueryObject {
final List<MapCondition> list = new ArrayList<>(); final List<MapCondition> list = new ArrayList<>();
final List<ConditionParams> list_dates = this.dates.stream() final List<ConditionParams> list_dates = this.dates.stream()
.filter(Range::isValid) .filter(Range::isValid)
.map(d -> new ConditionParams(d.getMin(), d.getMax())) .map(d -> new ConditionParams(d.getMin(), d.getMax()))
.collect(Collectors.toList()); .collect(Collectors.toList());
final List<ConditionParams> list_titles = this.titles.stream() final List<ConditionParams> list_titles = this.titles.stream()
.filter(StringUtils::isNotBlank) .filter(StringUtils::isNotBlank)
.map(t -> new ConditionParams(t, null)) .map(t -> new ConditionParams(t, null))
.collect(Collectors.toList()); .collect(Collectors.toList());
final List<ConditionParams> list_authors = this.authors.stream() final List<ConditionParams> list_authors = this.authors.stream()
.filter(StringUtils::isNotBlank) .filter(StringUtils::isNotBlank)
.map(aut -> new ConditionParams(aut, null)) .map(aut -> new ConditionParams(aut, null))
.collect(Collectors.toList()); .collect(Collectors.toList());
final List<ConditionParams> list_subjects = this.subjects.stream() final List<ConditionParams> list_subjects = this.subjects.stream()
.filter(StringUtils::isNotBlank) .filter(StringUtils::isNotBlank)
.map(s -> new ConditionParams(s, null)) .map(s -> new ConditionParams(s, null))
.collect(Collectors.toList()); .collect(Collectors.toList());
if (StringUtils.isNotBlank(this.datasource)) { if (StringUtils.isNotBlank(this.datasource)) {
list.add(new MapCondition("targetDatasourceName", MapValueType.STRING, ConditionOperator.EXACT, list.add(new MapCondition("targetDatasourceName", MapValueType.STRING, ConditionOperator.EXACT,
Arrays.asList(new ConditionParams(this.datasource, null)))); Arrays.asList(new ConditionParams(this.datasource, null))));
} }
if (this.trust.isValid()) { if (this.trust.isValid()) {
list.add(new MapCondition("trust", MapValueType.FLOAT, ConditionOperator.RANGE, list.add(new MapCondition("trust", MapValueType.FLOAT, ConditionOperator.RANGE,
Arrays.asList(new ConditionParams(this.trust.getMin(), this.trust.getMax())))); Arrays.asList(new ConditionParams(this.trust.getMin(), this.trust.getMax()))));
} }
if (!list_dates.isEmpty()) { if (!list_dates.isEmpty()) {
list.add(new MapCondition("targetDateofacceptance", MapValueType.DATE, ConditionOperator.RANGE, list_dates)); list.add(new MapCondition("targetDateofacceptance", MapValueType.DATE, ConditionOperator.RANGE, list_dates));

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.openaire; package eu.dnetlib.broker.openaire;
public class BrowseEntry implements Comparable<BrowseEntry> { public class BrowseEntry implements Comparable<BrowseEntry> {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.openaire; package eu.dnetlib.broker.openaire;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -10,7 +10,7 @@ import org.elasticsearch.index.query.Operator;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.search.MatchQuery.ZeroTermsQuery; import org.elasticsearch.index.search.MatchQuery.ZeroTermsQuery;
import eu.dnetlib.lbs.utils.DateParser; import eu.dnetlib.broker.common.utils.DateParser;
public class ElasticSearchQueryUtils { public class ElasticSearchQueryUtils {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.openaire; package eu.dnetlib.broker.openaire;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.openaire; package eu.dnetlib.broker.openaire;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.openaire; package eu.dnetlib.broker.openaire;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -41,16 +41,16 @@ import org.springframework.web.bind.annotation.RestController;
import com.google.gson.Gson; import com.google.gson.Gson;
import eu.dnetlib.broker.LiteratureBrokerServiceConfiguration;
import eu.dnetlib.broker.common.controllers.AbstractLbsController;
import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.broker.common.elasticsearch.Notification;
import eu.dnetlib.broker.common.elasticsearch.NotificationRepository;
import eu.dnetlib.broker.common.properties.ElasticSearchProperties;
import eu.dnetlib.broker.common.subscriptions.MapCondition;
import eu.dnetlib.broker.common.subscriptions.Subscription;
import eu.dnetlib.broker.common.subscriptions.SubscriptionRepository;
import eu.dnetlib.broker.objects.OaBrokerEventPayload; import eu.dnetlib.broker.objects.OaBrokerEventPayload;
import eu.dnetlib.lbs.LiteratureBrokerServiceConfiguration;
import eu.dnetlib.lbs.controllers.AbstractLbsController;
import eu.dnetlib.lbs.elasticsearch.Event;
import eu.dnetlib.lbs.elasticsearch.Notification;
import eu.dnetlib.lbs.elasticsearch.NotificationRepository;
import eu.dnetlib.lbs.properties.ElasticSearchProperties;
import eu.dnetlib.lbs.subscriptions.MapCondition;
import eu.dnetlib.lbs.subscriptions.Subscription;
import eu.dnetlib.lbs.subscriptions.SubscriptionRepository;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;

View File

@ -1,13 +1,13 @@
package eu.dnetlib.lbs.openaire; package eu.dnetlib.broker.openaire;
import java.util.Date; import java.util.Date;
import java.util.UUID; import java.util.UUID;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import eu.dnetlib.lbs.subscriptions.NotificationFrequency; import eu.dnetlib.broker.common.subscriptions.NotificationFrequency;
import eu.dnetlib.lbs.subscriptions.NotificationMode; import eu.dnetlib.broker.common.subscriptions.NotificationMode;
import eu.dnetlib.lbs.subscriptions.Subscription; import eu.dnetlib.broker.common.subscriptions.Subscription;
public class OpenaireSubscription { public class OpenaireSubscription {
@ -19,7 +19,7 @@ public class OpenaireSubscription {
public OpenaireSubscription() {} public OpenaireSubscription() {}
public OpenaireSubscription(final String subscriber, final NotificationFrequency frequency, final NotificationMode mode, public OpenaireSubscription(final String subscriber, final NotificationFrequency frequency, final NotificationMode mode,
final AdvQueryObject query) { final AdvQueryObject query) {
this.subscriber = subscriber; this.subscriber = subscriber;
this.frequency = frequency; this.frequency = frequency;
this.mode = mode; this.mode = mode;
@ -65,7 +65,7 @@ public class OpenaireSubscription {
final String subscriptionId = "sub-" + UUID.randomUUID(); final String subscriptionId = "sub-" + UUID.randomUUID();
return new Subscription(subscriptionId, this.subscriber, this.query.getTopic(), this.frequency, this.mode, null, new Date(), return new Subscription(subscriptionId, this.subscriber, this.query.getTopic(), this.frequency, this.mode, null, new Date(),
this.query.asListOfConditions()); this.query.asListOfConditions());
} }
} }

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.openaire; package eu.dnetlib.broker.openaire;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.openaire; package eu.dnetlib.broker.openaire;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.openaire; package eu.dnetlib.broker.openaire;
import java.util.Date; import java.util.Date;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.properties; package eu.dnetlib.broker.properties;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.utils; package eu.dnetlib.broker.utils;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
@ -12,9 +12,9 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import eu.dnetlib.lbs.elasticsearch.Event; import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.lbs.topics.TopicType; import eu.dnetlib.broker.common.topics.TopicType;
import eu.dnetlib.lbs.topics.TopicTypeRepository; import eu.dnetlib.broker.common.topics.TopicTypeRepository;
public class EventVerifier implements Predicate<Event> { public class EventVerifier implements Predicate<Event> {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.utils; package eu.dnetlib.broker.utils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.utils; package eu.dnetlib.broker.utils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.utils; package eu.dnetlib.broker.utils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -1,18 +0,0 @@
package eu.dnetlib.lbs.events.output;
import eu.dnetlib.lbs.elasticsearch.Event;
import eu.dnetlib.lbs.subscriptions.NotificationMode;
import eu.dnetlib.lbs.subscriptions.Subscription;
public interface NotificationDispatcher {
void sendNotification(Subscription subscription, Event... events);
void resetCount();
String getDispatcherName();
long count();
NotificationMode getMode();
}

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs; package eu.dnetlib.broker;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;

View File

@ -1,11 +1,11 @@
package eu.dnetlib.lbs.integration; package eu.dnetlib.broker.integration;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import eu.dnetlib.broker.objects.OaBrokerEventPayload; import eu.dnetlib.broker.objects.OaBrokerEventPayload;
import eu.dnetlib.lbs.controllers.ScrollPage; import eu.dnetlib.broker.openaire.ScrollPage;
public class ScrollTest { public class ScrollTest {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.tests; package eu.dnetlib.broker.tests;
import java.util.Arrays; import java.util.Arrays;
@ -22,12 +22,12 @@ import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilde
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.broker.objects.OaBrokerEventPayload; import eu.dnetlib.broker.objects.OaBrokerEventPayload;
import eu.dnetlib.broker.objects.OaBrokerMainEntity; import eu.dnetlib.broker.objects.OaBrokerMainEntity;
import eu.dnetlib.lbs.elasticsearch.Event; import eu.dnetlib.broker.openaire.AdvQueryObject;
import eu.dnetlib.lbs.openaire.AdvQueryObject; import eu.dnetlib.broker.openaire.ElasticSearchQueryUtils;
import eu.dnetlib.lbs.openaire.ElasticSearchQueryUtils; import eu.dnetlib.broker.openaire.Range;
import eu.dnetlib.lbs.openaire.Range;
@Ignore @Ignore
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)

View File

@ -10,7 +10,7 @@
cluster-name="elasticsearch_michele" /> cluster-name="elasticsearch_michele" />
<elasticsearch:repositories <elasticsearch:repositories
base-package="eu.dnetlib.lbs.elasticsearch" base-package="eu.dnetlib.broker.elasticsearch"
elasticsearch-template-ref="elasticsearchTemplate" /> elasticsearch-template-ref="elasticsearchTemplate" />
<bean id="elasticsearchTemplate" class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate"> <bean id="elasticsearchTemplate" class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">

View File

@ -7,7 +7,7 @@
<logger name="root" level="OFF"> <logger name="root" level="OFF">
<appender-ref ref="CONSOLE" /> <appender-ref ref="CONSOLE" />
</logger> </logger>
<logger name="eu.dnetlib.lbs" level="INFO"> <logger name="eu.dnetlib.broker" level="INFO">
<appender-ref ref="CONSOLE" /> <appender-ref ref="CONSOLE" />
</logger> </logger>
</configuration> </configuration>

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs; package eu.dnetlib.broker;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -16,9 +16,9 @@ import org.springframework.data.elasticsearch.repository.config.EnableElasticsea
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import eu.dnetlib.lbs.elasticsearch.Event; import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.lbs.elasticsearch.Notification; import eu.dnetlib.broker.common.elasticsearch.Notification;
import eu.dnetlib.lbs.properties.ElasticSearchProperties; import eu.dnetlib.broker.common.properties.ElasticSearchProperties;
import io.prometheus.client.exporter.MetricsServlet; import io.prometheus.client.exporter.MetricsServlet;
import io.prometheus.client.hotspot.DefaultExports; import io.prometheus.client.hotspot.DefaultExports;
import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.builders.RequestHandlerSelectors;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs; package eu.dnetlib.broker;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.controllers; package eu.dnetlib.broker.oa.controllers;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;

View File

@ -0,0 +1,40 @@
package eu.dnetlib.broker.oa.controllers;
import java.io.Serializable;
import com.google.gson.Gson;
import eu.dnetlib.broker.common.elasticsearch.Notification;
import eu.dnetlib.broker.objects.OaBrokerEventPayload;
public class NotificationMessage implements Serializable {
/**
*
*/
private static final long serialVersionUID = 7302363775341307950L;
private String topic;
public static NotificationMessage fromNotification(final Notification n) {
final Gson gson = new Gson();
final OaBrokerEventPayload payload = gson.fromJson(n.getPayload(), OaBrokerEventPayload.class);
final NotificationMessage res = new NotificationMessage();
res.setTopic(n.getTopic());
// TODO Auto-generated method stub
return res;
}
public String getTopic() {
return topic;
}
public void setTopic(final String topic) {
this.topic = topic;
}
}

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.controllers; package eu.dnetlib.broker.oa.controllers;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -6,8 +6,10 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.lucene.search.join.ScoreMode;
import org.elasticsearch.action.search.SearchType; import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -24,15 +26,12 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.google.gson.Gson; import eu.dnetlib.broker.BrokerConfiguration;
import eu.dnetlib.broker.common.controllers.AbstractLbsController;
import eu.dnetlib.broker.objects.OaBrokerEventPayload; import eu.dnetlib.broker.common.elasticsearch.Notification;
import eu.dnetlib.lbs.BrokerConfiguration; import eu.dnetlib.broker.common.properties.ElasticSearchProperties;
import eu.dnetlib.lbs.elasticsearch.Notification; import eu.dnetlib.broker.common.subscriptions.Subscription;
import eu.dnetlib.lbs.elasticsearch.NotificationRepository; import eu.dnetlib.broker.common.subscriptions.SubscriptionRepository;
import eu.dnetlib.lbs.properties.ElasticSearchProperties;
import eu.dnetlib.lbs.subscriptions.Subscription;
import eu.dnetlib.lbs.subscriptions.SubscriptionRepository;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -40,14 +39,11 @@ import io.swagger.annotations.ApiOperation;
@RestController @RestController
@RequestMapping("/api/openaireBroker") @RequestMapping("/api/openaireBroker")
@Api(tags = BrokerConfiguration.TAG_OPENAIRE) @Api(tags = BrokerConfiguration.TAG_OPENAIRE)
public class OpenaireBrokerController extends AbstractLbsController { public class OpenairePublicController extends AbstractLbsController {
@Autowired @Autowired
private ElasticsearchOperations esOperations; private ElasticsearchOperations esOperations;
@Autowired
private NotificationRepository notificationRepository;
@Autowired @Autowired
private SubscriptionRepository subscriptionRepo; private SubscriptionRepository subscriptionRepo;
@ -56,11 +52,11 @@ public class OpenaireBrokerController extends AbstractLbsController {
private static final long SCROLL_TIMEOUT_IN_MILLIS = 5 * 60 * 1000; private static final long SCROLL_TIMEOUT_IN_MILLIS = 5 * 60 * 1000;
private static final Log log = LogFactory.getLog(OpenaireBrokerController.class); private static final Log log = LogFactory.getLog(OpenairePublicController.class);
@ApiOperation("Returns notifications using scrolls (first page)") @ApiOperation("Returns notifications by subscription using scrolls (first page)")
@GetMapping("/scroll/notifications/start/{subscrId}") @GetMapping("/scroll/notifications/bySubscriptionId/{subscrId}")
public ScrollPage prepareScrollNotifications(@PathVariable final String subscrId) { public ScrollPage<NotificationMessage> prepareScrollNotificationsBySubscrId(@PathVariable final String subscrId) {
final Optional<Subscription> optSub = subscriptionRepo.findById(subscrId); final Optional<Subscription> optSub = subscriptionRepo.findById(subscrId);
@ -77,50 +73,75 @@ public class OpenaireBrokerController extends AbstractLbsController {
final SearchScrollHits<Notification> scroll = final SearchScrollHits<Notification> scroll =
esTemplate.searchScrollStart(SCROLL_TIMEOUT_IN_MILLIS, searchQuery, Notification.class, IndexCoordinates.of(props.getNotificationsIndexName())); esTemplate.searchScrollStart(SCROLL_TIMEOUT_IN_MILLIS, searchQuery, Notification.class, IndexCoordinates.of(props.getNotificationsIndexName()));
if (scroll.hasSearchHits()) { if (scroll.hasSearchHits()) {
final List<OaBrokerEventPayload> values = calculateEventPayloads(scroll); final List<NotificationMessage> values = calculateNotificationMessages(scroll);
return new ScrollPage(scroll.getScrollId(), values.isEmpty() || scroll.getScrollId() == null, values); return new ScrollPage<>(scroll.getScrollId(), values.isEmpty() || scroll.getScrollId() == null, values);
} else { } else {
esTemplate.searchScrollClear(Arrays.asList(scroll.getScrollId())); esTemplate.searchScrollClear(Arrays.asList(scroll.getScrollId()));
return new ScrollPage(null, true, new ArrayList<>()); return new ScrollPage<>(null, true, new ArrayList<>());
} }
} else { } else {
log.warn("Invalid subscription: " + subscrId); log.warn("Invalid subscription: " + subscrId);
return new ScrollPage(); return new ScrollPage<>();
}
}
@ApiOperation("Returns notifications by opendorar Id (for example: 301) using scrolls (first page)")
@GetMapping("/scroll/notifications/byOpenDoarId/{opendoarId}")
public ScrollPage<NotificationMessage> prepareScrollNotificationsByOpendoarId(@PathVariable final String opendoarId) {
final ElasticsearchRestTemplate esTemplate = (ElasticsearchRestTemplate) esOperations;
final String dsId = calculateDsIdFromOpenDoarId(opendoarId);
final NativeSearchQuery searchQuery = new NativeSearchQueryBuilder()
.withQuery(QueryBuilders.nestedQuery("map", QueryBuilders.matchQuery("map.targetDatasourceId", dsId), ScoreMode.None))
.withSearchType(SearchType.DEFAULT)
.withFields("payload")
.build();
final SearchScrollHits<Notification> scroll =
esTemplate.searchScrollStart(SCROLL_TIMEOUT_IN_MILLIS, searchQuery, Notification.class, IndexCoordinates.of(props.getNotificationsIndexName()));
if (scroll.hasSearchHits()) {
final List<NotificationMessage> values = calculateNotificationMessages(scroll);
return new ScrollPage<>(scroll.getScrollId(), values.isEmpty() || scroll.getScrollId() == null, values);
} else {
esTemplate.searchScrollClear(Arrays.asList(scroll.getScrollId()));
return new ScrollPage<>(null, true, new ArrayList<>());
} }
} }
private String calculateDsIdFromOpenDoarId(final String opendoarId) {
return "10|opendoar____::" + DigestUtils.md5Hex(opendoarId);
}
@ApiOperation("Returns notifications using scrolls (other pages)") @ApiOperation("Returns notifications using scrolls (other pages)")
@GetMapping("/scroll/notifications/{scrollId}") @GetMapping("/scroll/notifications/{scrollId}")
public ScrollPage scrollNotifications(@PathVariable final String scrollId) { public ScrollPage<NotificationMessage> scrollNotifications(@PathVariable final String scrollId) {
final ElasticsearchRestTemplate esTemplate = (ElasticsearchRestTemplate) esOperations; final ElasticsearchRestTemplate esTemplate = (ElasticsearchRestTemplate) esOperations;
final SearchScrollHits<Notification> scroll = final SearchScrollHits<Notification> scroll =
esTemplate.searchScrollContinue(scrollId, SCROLL_TIMEOUT_IN_MILLIS, Notification.class, IndexCoordinates.of(props.getNotificationsIndexName())); esTemplate.searchScrollContinue(scrollId, SCROLL_TIMEOUT_IN_MILLIS, Notification.class, IndexCoordinates.of(props.getNotificationsIndexName()));
if (scroll.hasSearchHits()) { if (scroll.hasSearchHits()) {
final List<OaBrokerEventPayload> values = calculateEventPayloads(scroll); final List<NotificationMessage> values = calculateNotificationMessages(scroll);
return new ScrollPage(scroll.getScrollId(), values.isEmpty() || scroll.getScrollId() == null, values); return new ScrollPage<>(scroll.getScrollId(), values.isEmpty() || scroll.getScrollId() == null, values);
} else { } else {
esTemplate.searchScrollClear(Arrays.asList(scroll.getScrollId())); esTemplate.searchScrollClear(Arrays.asList(scroll.getScrollId()));
return new ScrollPage(null, true, new ArrayList<>()); return new ScrollPage<>(null, true, new ArrayList<>());
} }
} }
private List<OaBrokerEventPayload> calculateEventPayloads(final SearchScrollHits<Notification> scroll) { private List<NotificationMessage> calculateNotificationMessages(final SearchScrollHits<Notification> scroll) {
if (scroll.getSearchHits().size() > 0) { if (scroll.getSearchHits().size() > 0) {
final Gson gson = new Gson();
return scroll.stream() return scroll.stream()
.map(SearchHit::getContent) .map(SearchHit::getContent)
.map(Notification::getPayload) .map(NotificationMessage::fromNotification)
.map(s -> gson.fromJson(s, OaBrokerEventPayload.class))
.collect(Collectors.toList()); .collect(Collectors.toList());
} else { } else {
return new ArrayList<>(); return new ArrayList<>();
} }
} }
} }

View File

@ -1,20 +1,18 @@
package eu.dnetlib.lbs.controllers; package eu.dnetlib.broker.oa.controllers;
import java.util.List; import java.util.List;
import eu.dnetlib.broker.objects.OaBrokerEventPayload; public class ScrollPage<T> {
public class ScrollPage {
private String id; private String id;
private boolean completed; private boolean completed;
private List<OaBrokerEventPayload> values; private List<T> values;
public ScrollPage() {} public ScrollPage() {}
public ScrollPage(final String id, final boolean completed, final List<OaBrokerEventPayload> values) { public ScrollPage(final String id, final boolean completed, final List<T> values) {
this.id = id; this.id = id;
this.completed = completed; this.completed = completed;
this.values = values; this.values = values;
@ -36,11 +34,11 @@ public class ScrollPage {
this.completed = completed; this.completed = completed;
} }
public List<OaBrokerEventPayload> getValues() { public List<T> getValues() {
return values; return values;
} }
public void setValues(final List<OaBrokerEventPayload> values) { public void setValues(final List<T> values) {
this.values = values; this.values = values;
} }

View File

@ -23,7 +23,6 @@ lbs.database.url = ${spring.datasource.url}
#lbs.elastic.clusterNodes = broker1-dev-dnet.d4science.org:9300 #lbs.elastic.clusterNodes = broker1-dev-dnet.d4science.org:9300
#lbs.elastic.homepage = http://broker1-dev-dnet.d4science.org:9200/_plugin/hq #lbs.elastic.homepage = http://broker1-dev-dnet.d4science.org:9200/_plugin/hq
# for localhost # for localhost
lbs.elastic.clusterNodes = 127.0.0.1:9200 lbs.elastic.clusterNodes = 127.0.0.1:9200
lbs.elastic.homepage = http:// lbs.elastic.homepage = http://
@ -32,8 +31,6 @@ lbs.elastic.connectionTimeout = 30000
lbs.elastic.eventsIndexName = oa_events_beta lbs.elastic.eventsIndexName = oa_events_beta
lbs.elastic.notificationsIndexName = oa_notifications_beta lbs.elastic.notificationsIndexName = oa_notifications_beta
lbs.queues.maxReturnedValues = 1000 lbs.queues.maxReturnedValues = 1000
lbs.task.deleteOldEvents.cron = 0 0 4 1/1 * ? lbs.task.deleteOldEvents.cron = 0 0 4 1/1 * ?

View File

@ -1,11 +1,11 @@
package eu.dnetlib.lbs.integration; package eu.dnetlib.broker.oa.integration;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import eu.dnetlib.broker.objects.OaBrokerEventPayload; import eu.dnetlib.broker.oa.controllers.NotificationMessage;
import eu.dnetlib.lbs.openaire.ScrollPage; import eu.dnetlib.broker.oa.controllers.ScrollPage;
public class ScrollTest { public class ScrollTest {
@ -15,19 +15,21 @@ public class ScrollTest {
private static final String subscriptionId = "sub-c9767c84-3597-462b-803b-2d3e09de44c4"; private static final String subscriptionId = "sub-c9767c84-3597-462b-803b-2d3e09de44c4";
public class TestScrollPage extends ScrollPage<NotificationMessage> {}
@Test @Test
@Ignore @Ignore
public void testScroll() { public void testScroll() {
int total = 0; int total = 0;
ScrollPage page = getPage(baseUrl + "/api/openaireBroker/scroll/notifications/start/ " + subscriptionId); TestScrollPage page = getPage(baseUrl + "/api/openaireBroker/scroll/notifications/start/ " + subscriptionId);
total += page.getValues().size(); total += page.getValues().size();
while (!page.isCompleted()) { while (!page.isCompleted()) {
page = getPage(baseUrl + "/api/openaireBroker/scroll/notifications/ " + page.getId()); page = getPage(baseUrl + "/api/openaireBroker/scroll/notifications/ " + page.getId());
total += page.getValues().size(); total += page.getValues().size();
for (final OaBrokerEventPayload p : page.getValues()) { for (final NotificationMessage p : page.getValues()) {
// DO SOMETHING // DO SOMETHING
} }
} }
@ -35,9 +37,9 @@ public class ScrollTest {
System.out.println("\nTOTAL: " + total); System.out.println("\nTOTAL: " + total);
} }
private ScrollPage getPage(final String url) { private TestScrollPage getPage(final String url) {
System.out.println(url); System.out.println(url);
final ScrollPage p = new RestTemplate().getForObject(url, ScrollPage.class); final TestScrollPage p = new RestTemplate().getForObject(url, TestScrollPage.class);
System.out.println("Page size: " + p.getValues().size()); System.out.println("Page size: " + p.getValues().size());
return p; return p;
} }

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.controllers; package eu.dnetlib.broker.common.controllers;
import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.elasticsearch; package eu.dnetlib.broker.common.elasticsearch;
import java.util.Map; import java.util.Map;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.elasticsearch; package eu.dnetlib.broker.common.elasticsearch;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.elasticsearch; package eu.dnetlib.broker.common.elasticsearch;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -18,7 +18,7 @@ import org.springframework.data.elasticsearch.core.query.NativeSearchQuery;
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import eu.dnetlib.lbs.properties.ElasticSearchProperties; import eu.dnetlib.broker.common.properties.ElasticSearchProperties;
@Component @Component
public class EventStatsManager { public class EventStatsManager {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.elasticsearch; package eu.dnetlib.broker.common.elasticsearch;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
@ -9,7 +9,7 @@ import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType; import org.springframework.data.elasticsearch.annotations.FieldType;
import eu.dnetlib.lbs.subscriptions.Subscription; import eu.dnetlib.broker.common.subscriptions.Subscription;
@Document(indexName = "#{elasticSearchProperties.notificationsIndexName}", shards = 48, replicas = 1, refreshInterval = "600s") @Document(indexName = "#{elasticSearchProperties.notificationsIndexName}", shards = 48, replicas = 1, refreshInterval = "600s")
public class Notification { public class Notification {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.elasticsearch; package eu.dnetlib.broker.common.elasticsearch;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.properties; package eu.dnetlib.broker.common.properties;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.properties; package eu.dnetlib.broker.common.properties;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.subscriptions; package eu.dnetlib.broker.common.subscriptions;
public enum ConditionOperator { public enum ConditionOperator {
EXACT, MATCH_ANY, MATCH_ALL, RANGE EXACT, MATCH_ANY, MATCH_ALL, RANGE

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.subscriptions; package eu.dnetlib.broker.common.subscriptions;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
@ -8,7 +8,7 @@ import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.math.NumberUtils;
import eu.dnetlib.lbs.utils.DateParser; import eu.dnetlib.broker.common.utils.DateParser;
public class ConditionParams { public class ConditionParams {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.subscriptions; package eu.dnetlib.broker.common.subscriptions;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
@ -14,9 +14,9 @@ import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.search.MatchQuery.ZeroTermsQuery; import org.elasticsearch.index.search.MatchQuery.ZeroTermsQuery;
import eu.dnetlib.lbs.elasticsearch.Event; import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.lbs.utils.DateParser; import eu.dnetlib.broker.common.utils.DateParser;
import eu.dnetlib.lbs.utils.MapValueType; import eu.dnetlib.broker.common.utils.MapValueType;
public class MapCondition { public class MapCondition {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.subscriptions; package eu.dnetlib.broker.common.subscriptions;
public enum NotificationFrequency { public enum NotificationFrequency {
never, realtime, daily, weekly, monthly never, realtime, daily, weekly, monthly

View File

@ -0,0 +1,5 @@
package eu.dnetlib.broker.common.subscriptions;
public enum NotificationMode {
MOCK, EMAIL
}

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.subscriptions; package eu.dnetlib.broker.common.subscriptions;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -14,7 +14,7 @@ import javax.persistence.Table;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import eu.dnetlib.lbs.elasticsearch.Event; import eu.dnetlib.broker.common.elasticsearch.Event;
@Entity(name = "subscriptions") @Entity(name = "subscriptions")
@Table(name = "subscriptions") @Table(name = "subscriptions")

View File

@ -1,7 +1,9 @@
package eu.dnetlib.lbs.subscriptions; package eu.dnetlib.broker.common.subscriptions;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface SubscriptionRepository extends CrudRepository<Subscription, String> { public interface SubscriptionRepository extends CrudRepository<Subscription, String> {
Iterable<Subscription> findByTopic(String topic); Iterable<Subscription> findByTopic(String topic);

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.topics; package eu.dnetlib.broker.common.topics;
import java.util.Set; import java.util.Set;
import java.util.function.Predicate; import java.util.function.Predicate;
@ -15,7 +15,7 @@ import com.google.common.base.Joiner;
import com.google.common.base.Splitter; import com.google.common.base.Splitter;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import eu.dnetlib.lbs.elasticsearch.Event; import eu.dnetlib.broker.common.elasticsearch.Event;
@Entity(name = "topic_types") @Entity(name = "topic_types")
@Table(name = "topic_types") @Table(name = "topic_types")

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.topics; package eu.dnetlib.broker.common.topics;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.utils; package eu.dnetlib.broker.common.utils;
import java.text.ParseException; import java.text.ParseException;
import java.util.Date; import java.util.Date;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.utils; package eu.dnetlib.broker.common.utils;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.utils; package eu.dnetlib.broker.common.utils;
public enum MapValueType { public enum MapValueType {
STRING, INTEGER, FLOAT, DATE, BOOLEAN, LIST_STRING, LIST_INTEGER, LIST_FLOAT, LIST_DATE, LIST_BOOLEAN; STRING, INTEGER, FLOAT, DATE, BOOLEAN, LIST_STRING, LIST_INTEGER, LIST_FLOAT, LIST_DATE, LIST_BOOLEAN;

View File

@ -1,5 +0,0 @@
package eu.dnetlib.lbs.subscriptions;
public enum NotificationMode {
MOCK, EMAIL
}

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.clients; package eu.dnetlib.broker.common.clients;
import java.util.Date; import java.util.Date;
import java.util.Objects; import java.util.Objects;
@ -19,12 +19,12 @@ import org.springframework.data.elasticsearch.core.query.NativeSearchQuery;
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
import org.springframework.data.util.CloseableIterator; import org.springframework.data.util.CloseableIterator;
import eu.dnetlib.lbs.elasticsearch.Event; import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.lbs.subscriptions.MapCondition; import eu.dnetlib.broker.common.subscriptions.MapCondition;
import eu.dnetlib.lbs.subscriptions.NotificationFrequency; import eu.dnetlib.broker.common.subscriptions.NotificationFrequency;
import eu.dnetlib.lbs.subscriptions.NotificationMode; import eu.dnetlib.broker.common.subscriptions.NotificationMode;
import eu.dnetlib.lbs.subscriptions.Subscription; import eu.dnetlib.broker.common.subscriptions.Subscription;
import eu.dnetlib.lbs.utils.DateParser; import eu.dnetlib.broker.common.utils.DateParser;
@Ignore @Ignore
// @RunWith(SpringJUnit4ClassRunner.class) // @RunWith(SpringJUnit4ClassRunner.class)

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.subscriptions; package eu.dnetlib.broker.common.subscriptions;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
@ -14,9 +14,9 @@ import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
import eu.dnetlib.lbs.elasticsearch.Event; import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.lbs.utils.DateParser; import eu.dnetlib.broker.common.utils.DateParser;
import eu.dnetlib.lbs.utils.MapValueType; import eu.dnetlib.broker.common.utils.MapValueType;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class ConditionTest { public class ConditionTest {

View File

@ -1,4 +1,4 @@
package eu.dnetlib.lbs.utils; package eu.dnetlib.broker.common.utils;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
@ -13,8 +13,8 @@ import java.util.List;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import eu.dnetlib.lbs.utils.MapValue; import eu.dnetlib.broker.common.utils.MapValue;
import eu.dnetlib.lbs.utils.MapValueType; import eu.dnetlib.broker.common.utils.MapValueType;
public class MapValueTest { public class MapValueTest {

View File

@ -10,7 +10,7 @@
cluster-name="elasticsearch_michele" /> cluster-name="elasticsearch_michele" />
<elasticsearch:repositories <elasticsearch:repositories
base-package="eu.dnetlib.lbs.elasticsearch" base-package="eu.dnetlib.broker.common.elasticsearch"
elasticsearch-template-ref="elasticsearchTemplate" /> elasticsearch-template-ref="elasticsearchTemplate" />
<bean id="elasticsearchTemplate" class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate"> <bean id="elasticsearchTemplate" class="org.springframework.data.elasticsearch.core.ElasticsearchTemplate">

View File

@ -7,7 +7,7 @@
<logger name="root" level="OFF"> <logger name="root" level="OFF">
<appender-ref ref="CONSOLE" /> <appender-ref ref="CONSOLE" />
</logger> </logger>
<logger name="eu.dnetlib.lbs" level="INFO"> <logger name="eu.dnetlib.broker.common" level="INFO">
<appender-ref ref="CONSOLE" /> <appender-ref ref="CONSOLE" />
</logger> </logger>
</configuration> </configuration>