Prepared cloud deployment of hawkbit sandbox

This commit is contained in:
Kai Zimmermann
2016-04-02 13:29:40 +02:00
parent 174be0b7c7
commit bd974ef6ab
11 changed files with 130 additions and 29 deletions

View File

@@ -14,6 +14,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.eclipse.hawkbit.simulator.AbstractSimulatedDevice.Protocol;
import org.eclipse.hawkbit.simulator.amqp.SpSenderService;
import org.eclipse.hawkbit.simulator.event.InitUpdate;
import org.eclipse.hawkbit.simulator.event.ProgressUpdate;
@@ -34,6 +35,9 @@ public class DeviceSimulatorUpdater {
@Autowired
private SpSenderService spSenderService;
@Autowired
private SimulatedDeviceFactory deviceFactory;
@Autowired
private EventBus eventbus;
@@ -58,7 +62,13 @@ public class DeviceSimulatorUpdater {
*/
public void startUpdate(final String tenant, final String id, final long actionId, final String swVersion,
final UpdaterCallback callback) {
final AbstractSimulatedDevice device = repository.get(tenant, id);
AbstractSimulatedDevice device = repository.get(tenant, id);
// plug and play - non existing device will be auto created
if (device == null) {
device = repository.add(deviceFactory.createSimulatedDevice(id, tenant, Protocol.DMF_AMQP, -1, null, null));
}
device.setProgress(0.0);
device.setSwversion(swVersion);
eventbus.post(new InitUpdate(device));

View File

@@ -59,7 +59,8 @@ public class AmqpConfiguration {
}
/**
* Create the receiver queue from sp. Receive messages from sp.
* Creates the receiver queue from update server for receiving message from
* update server.
*
* @return the queue
*/
@@ -70,7 +71,7 @@ public class AmqpConfiguration {
}
/**
* Create the recevier exchange. Sp send messages to this exchange.
* Creates the receiver exchange for sending messages to update server.
*
* @return the exchange
*/

View File

@@ -26,9 +26,7 @@ import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Component;
/**
* Handle all incoming Messages from SP.
*
*
* Handle all incoming Messages from hawkBit update server.
*
*/
@Component
@@ -44,17 +42,6 @@ public class SpReceiverService extends ReceiverService {
/**
* Constructor.
*
* @param rabbitTemplate
* the rabbit template
* @param amqpProperties
* the amqp properties
* @param lwm2mSenderService
* the lwm2mSenderService
* @param spSenderService
* the spSenderService
* @param deviceUpdater
* the updater service to simulate update process
*/
@Autowired
public SpReceiverService(final RabbitTemplate rabbitTemplate, final AmqpProperties amqpProperties,
@@ -62,12 +49,11 @@ public class SpReceiverService extends ReceiverService {
super(rabbitTemplate, amqpProperties);
this.spSenderService = spSenderService;
this.deviceUpdater = deviceUpdater;
}
/**
* Handle the incoming Message from Queue with the property
* (com.bosch.sp.lwm2m.connector.amqp.receiverConnectorQueueFromSp).
* (hawkbit.device.simulator.amqp.receiverConnectorQueueFromSp).
*
* @param message
* the incoming message

View File

@@ -7,11 +7,7 @@
# http://www.eclipse.org/legal/epl-v10.html
#
#########################################################################################
# PUBLIC configuration, i.e. can be changed by users at runtime (defaults provided here)
#########################################################################################
## Configuration for RabbitMQ communication
## Configuration for DMF communication
hawkbit.device.simulator.amqp.receiverConnectorQueueFromSp=simulator_receiver
hawkbit.device.simulator.amqp.deadLetterQueue=simulator_deadletter
hawkbit.device.simulator.amqp.deadLetterExchange=simulator.deadletter