Rename DMF model classes to avoid name clashes with the repository.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
kaizimmerm
2017-05-16 16:57:07 +02:00
parent cacb32da1a
commit 806491d9b5
33 changed files with 271 additions and 274 deletions

View File

@@ -31,8 +31,8 @@ import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLContextBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.eclipse.hawkbit.dmf.json.model.Artifact;
import org.eclipse.hawkbit.dmf.json.model.SoftwareModule;
import org.eclipse.hawkbit.dmf.json.model.DmfArtifact;
import org.eclipse.hawkbit.dmf.json.model.DmfSoftwareModule;
import org.eclipse.hawkbit.simulator.AbstractSimulatedDevice.Protocol;
import org.eclipse.hawkbit.simulator.UpdateStatus.ResponseStatus;
import org.eclipse.hawkbit.simulator.amqp.SpSenderService;
@@ -94,7 +94,7 @@ public class DeviceSimulatorUpdater {
* process has been finished
*/
public void startUpdate(final String tenant, final String id, final long actionId, final String swVersion,
final List<SoftwareModule> modules, final String targetSecurityToken, final UpdaterCallback callback) {
final List<DmfSoftwareModule> modules, final String targetSecurityToken, final UpdaterCallback callback) {
AbstractSimulatedDevice device = repository.get(tenant, id);
// plug and play - non existing device will be auto created
@@ -109,7 +109,7 @@ public class DeviceSimulatorUpdater {
device.setSwversion(swVersion);
} else {
device.setSwversion(
modules.stream().map(SoftwareModule::getModuleVersion).collect(Collectors.joining(", ")));
modules.stream().map(DmfSoftwareModule::getModuleVersion).collect(Collectors.joining(", ")));
}
device.setTargetSecurityToken(targetSecurityToken);
eventbus.post(new InitUpdate(device));
@@ -134,11 +134,11 @@ public class DeviceSimulatorUpdater {
private final EventBus eventbus;
private final ScheduledExecutorService threadPool;
private final UpdaterCallback callback;
private final List<SoftwareModule> modules;
private final List<DmfSoftwareModule> modules;
private DeviceSimulatorUpdateThread(final AbstractSimulatedDevice device, final SpSenderService spSenderService,
final long actionId, final EventBus eventbus, final ScheduledExecutorService threadPool,
final UpdaterCallback callback, final List<SoftwareModule> modules) {
final UpdaterCallback callback, final List<DmfSoftwareModule> modules) {
this.device = device;
this.spSenderService = spSenderService;
this.actionId = actionId;
@@ -204,7 +204,7 @@ public class DeviceSimulatorUpdater {
}
private static void handleArtifact(final String targetToken, final List<UpdateStatus> status,
final Artifact artifact) {
final DmfArtifact artifact) {
if (artifact.getUrls().containsKey("HTTPS")) {
status.add(downloadUrl(artifact.getUrls().get("HTTPS"), targetToken, artifact.getHashes().getSha1(),

View File

@@ -13,7 +13,7 @@ import java.util.Map;
import org.eclipse.hawkbit.dmf.amqp.api.EventTopic;
import org.eclipse.hawkbit.dmf.amqp.api.MessageHeaderKey;
import org.eclipse.hawkbit.dmf.amqp.api.MessageType;
import org.eclipse.hawkbit.dmf.json.model.DownloadAndUpdateRequest;
import org.eclipse.hawkbit.dmf.json.model.DmfDownloadAndUpdateRequest;
import org.eclipse.hawkbit.simulator.DeviceSimulatorRepository;
import org.eclipse.hawkbit.simulator.DeviceSimulatorUpdater;
import org.slf4j.Logger;
@@ -141,8 +141,8 @@ public class SpReceiverService extends ReceiverService {
final Map<String, Object> headers = messageProperties.getHeaders();
final String tenant = (String) headers.get(MessageHeaderKey.TENANT);
final DownloadAndUpdateRequest downloadAndUpdateRequest = convertMessage(message,
DownloadAndUpdateRequest.class);
final DmfDownloadAndUpdateRequest downloadAndUpdateRequest = convertMessage(message,
DmfDownloadAndUpdateRequest.class);
final Long actionId = downloadAndUpdateRequest.getActionId();
final String targetSecurityToken = downloadAndUpdateRequest.getTargetSecurityToken();

View File

@@ -16,9 +16,9 @@ import org.eclipse.hawkbit.dmf.amqp.api.AmqpSettings;
import org.eclipse.hawkbit.dmf.amqp.api.EventTopic;
import org.eclipse.hawkbit.dmf.amqp.api.MessageHeaderKey;
import org.eclipse.hawkbit.dmf.amqp.api.MessageType;
import org.eclipse.hawkbit.dmf.json.model.ActionStatus;
import org.eclipse.hawkbit.dmf.json.model.ActionUpdateStatus;
import org.eclipse.hawkbit.dmf.json.model.AttributeUpdate;
import org.eclipse.hawkbit.dmf.json.model.DmfActionStatus;
import org.eclipse.hawkbit.dmf.json.model.DmfActionUpdateStatus;
import org.eclipse.hawkbit.dmf.json.model.DmfAttributeUpdate;
import org.eclipse.hawkbit.simulator.SimulationProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -66,7 +66,7 @@ public class SpSenderService extends SenderService {
* a description according the update process
*/
public void finishUpdateProcess(final SimulatedUpdate update, final List<String> updateResultMessages) {
final Message updateResultMessage = createUpdateResultMessage(update, ActionStatus.FINISHED,
final Message updateResultMessage = createUpdateResultMessage(update, DmfActionStatus.FINISHED,
updateResultMessages);
sendMessage(spExchange, updateResultMessage);
}
@@ -96,7 +96,7 @@ public class SpSenderService extends SenderService {
* the ID of the action for the error message
*/
public void sendErrorMessage(final String tenant, final List<String> updateResultMessages, final Long actionId) {
final Message message = createActionStatusMessage(tenant, ActionStatus.ERROR, updateResultMessages, actionId);
final Message message = createActionStatusMessage(tenant, DmfActionStatus.ERROR, updateResultMessages, actionId);
sendMessage(spExchange, message);
}
@@ -109,7 +109,7 @@ public class SpSenderService extends SenderService {
* a warning description
*/
public void sendWarningMessage(final SimulatedUpdate update, final List<String> updateResultMessages) {
final Message message = createActionStatusMessage(update, updateResultMessages, ActionStatus.WARNING);
final Message message = createActionStatusMessage(update, updateResultMessages, DmfActionStatus.WARNING);
sendMessage(spExchange, message);
}
@@ -125,7 +125,7 @@ public class SpSenderService extends SenderService {
* @param actionId
* the cached value
*/
public void sendActionStatusMessage(final String tenant, final ActionStatus actionStatus,
public void sendActionStatusMessage(final String tenant, final DmfActionStatus actionStatus,
final List<String> updateResultMessages, final Long actionId) {
final Message message = createActionStatusMessage(tenant, actionStatus, updateResultMessages, actionId);
sendMessage(message);
@@ -179,7 +179,7 @@ public class SpSenderService extends SenderService {
messagePropertiesForSP.setHeader(MessageHeaderKey.THING_ID, targetId);
messagePropertiesForSP.setContentType(MessageProperties.CONTENT_TYPE_JSON);
messagePropertiesForSP.setReplyTo(amqpProperties.getSenderForSpExchange());
final AttributeUpdate attributeUpdate = new AttributeUpdate();
final DmfAttributeUpdate attributeUpdate = new DmfAttributeUpdate();
attributeUpdate.getAttributes().putAll(simulationProperties.getAttributes().stream().collect(
Collectors.toMap(SimulationProperties.Attribute::getKey, SimulationProperties.Attribute::getValue)));
@@ -206,7 +206,7 @@ public class SpSenderService extends SenderService {
* a list of descriptions according the update process
*/
private void sendErrorgMessage(final SimulatedUpdate update, final List<String> updateResultMessages) {
final Message message = createActionStatusMessage(update, updateResultMessages, ActionStatus.ERROR);
final Message message = createActionStatusMessage(update, updateResultMessages, DmfActionStatus.ERROR);
sendMessage(spExchange, message);
}
@@ -222,11 +222,11 @@ public class SpSenderService extends SenderService {
* @param cacheValue
* the cacheValue value
*/
private Message createActionStatusMessage(final String tenant, final ActionStatus actionStatus,
private Message createActionStatusMessage(final String tenant, final DmfActionStatus actionStatus,
final List<String> updateResultMessages, final Long actionId) {
final MessageProperties messageProperties = new MessageProperties();
final Map<String, Object> headers = messageProperties.getHeaders();
final ActionUpdateStatus actionUpdateStatus = new ActionUpdateStatus(actionId, actionStatus);
final DmfActionUpdateStatus actionUpdateStatus = new DmfActionUpdateStatus(actionId, actionStatus);
headers.put(MessageHeaderKey.TYPE, MessageType.EVENT.name());
headers.put(MessageHeaderKey.TENANT, tenant);
headers.put(MessageHeaderKey.TOPIC, EventTopic.UPDATE_ACTION_STATUS.name());
@@ -236,11 +236,11 @@ public class SpSenderService extends SenderService {
return convertMessage(actionUpdateStatus, messageProperties);
}
private Message createUpdateResultMessage(final SimulatedUpdate cacheValue, final ActionStatus actionStatus,
private Message createUpdateResultMessage(final SimulatedUpdate cacheValue, final DmfActionStatus actionStatus,
final List<String> updateResultMessages) {
final MessageProperties messageProperties = new MessageProperties();
final Map<String, Object> headers = messageProperties.getHeaders();
final ActionUpdateStatus actionUpdateStatus = new ActionUpdateStatus(cacheValue.getActionId(), actionStatus);
final DmfActionUpdateStatus actionUpdateStatus = new DmfActionUpdateStatus(cacheValue.getActionId(), actionStatus);
headers.put(MessageHeaderKey.TYPE, MessageType.EVENT.name());
headers.put(MessageHeaderKey.TENANT, cacheValue.getTenant());
headers.put(MessageHeaderKey.TOPIC, EventTopic.UPDATE_ACTION_STATUS.name());
@@ -250,7 +250,7 @@ public class SpSenderService extends SenderService {
}
private Message createActionStatusMessage(final SimulatedUpdate update, final List<String> updateResultMessages,
final ActionStatus status) {
final DmfActionStatus status) {
return createActionStatusMessage(update.getTenant(), status, updateResultMessages, update.getActionId());
}