Dev #65
|
@ -11,10 +11,9 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
THIS CLASS WILL BE PROVIDED ONLY AS A TEMPLATE; POINT OUT THE API NEEDS TO BE DEFINED
|
* Template for receiving an executor added event via HTTP
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class ExecutorAddedEventListenerHttpAdapter {
|
public class ExecutorAddedEventListenerHttpAdapter {
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ import ch.unisg.tapas.auctionhouse.domain.ExecutorRegistry;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,6 +17,7 @@ import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||||
* This class is only provided as an example to help you bootstrap the project.
|
* This class is only provided as an example to help you bootstrap the project.
|
||||||
*/
|
*/
|
||||||
public class ExecutorAddedEventListenerMqttAdapter extends AuctionEventMqttListener {
|
public class ExecutorAddedEventListenerMqttAdapter extends AuctionEventMqttListener {
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger(ExecutorAddedEventListenerMqttAdapter.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleEvent(MqttMessage message) {
|
public boolean handleEvent(MqttMessage message) {
|
||||||
|
@ -36,8 +39,7 @@ public class ExecutorAddedEventListenerMqttAdapter extends AuctionEventMqttListe
|
||||||
ExecutorAddedHandler newExecutorHandler = new ExecutorAddedHandler();
|
ExecutorAddedHandler newExecutorHandler = new ExecutorAddedHandler();
|
||||||
newExecutorHandler.handleNewExecutorEvent(executorAddedEvent);
|
newExecutorHandler.handleNewExecutorEvent(executorAddedEvent);
|
||||||
} catch (JsonProcessingException | NullPointerException e) {
|
} catch (JsonProcessingException | NullPointerException e) {
|
||||||
// TODO: refactor logging
|
LOGGER.error(e.getMessage(), e);
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,10 +53,6 @@ public class RetrieveOpenAuctionsWebController {
|
||||||
HttpHeaders responseHeaders = new HttpHeaders();
|
HttpHeaders responseHeaders = new HttpHeaders();
|
||||||
responseHeaders.add(HttpHeaders.CONTENT_TYPE, "application/json");
|
responseHeaders.add(HttpHeaders.CONTENT_TYPE, "application/json");
|
||||||
|
|
||||||
// TODO before providing to students: remove hub links
|
|
||||||
responseHeaders.add(HttpHeaders.LINK, "<https://pubsubhubbub.appspot.com/>; rel=\"hub\"");
|
|
||||||
responseHeaders.add(HttpHeaders.LINK, "<http://example.org/auctions/>; rel=\"self\"");
|
|
||||||
|
|
||||||
return new ResponseEntity<>(array.toString(), responseHeaders, HttpStatus.OK);
|
return new ResponseEntity<>(array.toString(), responseHeaders, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user