Initial check in accordance with Parallel IP

This commit is contained in:
Kai Zimmermann
2016-01-21 13:18:55 +01:00
parent c5e4f1139f
commit 7497ab61ed
763 changed files with 114508 additions and 0 deletions

4
hawkbit-dmf-api/README.md Executable file
View File

@@ -0,0 +1,4 @@
# HawkBit Software Provisioning device management federation API
This API is used for communicating with the HawkBit Software Provisioning server through AMQP.
It is used to integrate other device management system through a high performance protocol.

33
hawkbit-dmf-api/pom.xml Executable file
View File

@@ -0,0 +1,33 @@
<!--
Copyright (c) 2015 Bosch Software Innovations GmbH and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-parent</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>hawkbit-dmf-api</artifactId>
<name>hawkBit :: Device Management Federation API</name>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,25 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.dmf.amqp.api;
/**
* Global constants for RabbitMQ settings.
*
*
*
*/
public final class AmqpSettings {
public static final String DMF_EXCHANGE = "dmf.exchange";
private AmqpSettings() {
}
}

View File

@@ -0,0 +1,32 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.dmf.amqp.api;
/**
* The event topics for the message headers.
*
*
*
*/
public enum EventTopic {
/**
* Topic when sending and receiving a update status.
*/
UPDATE_ACTION_STATUS,
/**
* Topic when sending and receiving a download and install task.
*/
DOWNLOAD_AND_INSTALL,
/**
* Topic when sending and receiving a cancel download task.
*/
CANCEL_DOWNLOAD;
}

View File

@@ -0,0 +1,53 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.dmf.amqp.api;
/**
* The constant of all amqp message header.
*
*
*
*/
public final class MessageHeaderKey {
/**
* The message type.
*/
public static final String TYPE = "type";
/**
* The used tenant.
*/
public static final String TENANT = "tenant";
/**
* The name of the thing/target.
*/
public static final String THING_ID = "thingId";
/**
* The name of the sender who has send the message.
*/
public static final String SENDER = "sender";
/**
* The topic to handle events different.
*/
public static final String TOPIC = "topic";
/**
* The content type.
*/
public static final String CONTENT_TYPE = "content-type";
private MessageHeaderKey() {
}
}

View File

@@ -0,0 +1,34 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.dmf.amqp.api;
/**
* The amqp message types which can be handled.
*
*
*
*/
public enum MessageType {
/**
* The event type.
*/
EVENT,
/**
* the thing created type.
*/
THING_CREATED,
/**
* The authentication type.
*/
AUTHENTIFICATION,
}

View File

@@ -0,0 +1,27 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.dmf.json.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
/**
* The json message action status.
*
*
*
*/
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public enum ActionStatus {
DOWNLOAD, RETRIEVED, RUNNING, FINISHED, ERROR, WARNING;
}

View File

@@ -0,0 +1,65 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.dmf.json.model;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* JSON representation of action update status.
*
*
*
*/
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class ActionUpdateStatus {
@JsonProperty(required = true)
private Long actionId;
@JsonProperty
private Long softwareModuleId;
@JsonProperty(required = true)
private ActionStatus actionStatus;
@JsonProperty
private final List<String> message = new ArrayList<>();
public Long getActionId() {
return actionId;
}
public void setActionId(final Long actionId) {
this.actionId = actionId;
}
public Long getSoftwareModuleId() {
return softwareModuleId;
}
public void setSoftwareModuleId(final Long softwareModuleId) {
this.softwareModuleId = softwareModuleId;
}
public ActionStatus getActionStatus() {
return actionStatus;
}
public void setActionStatus(final ActionStatus actionStatus) {
this.actionStatus = actionStatus;
}
public List<String> getMessage() {
return message;
}
}

View File

@@ -0,0 +1,83 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.dmf.json.model;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* JSON representation of artifact.
*
*
*
*/
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Artifact {
/**
* Represented the supported protocols for artifact url's.
*
*
*
*/
public static enum UrlProtocol {
COAP, HTTP, HTTPS
}
@JsonProperty
private String filename;
@JsonProperty
private ArtifactHash hashes;
@JsonProperty
private Long size;
@JsonProperty
private Map<UrlProtocol, String> urls = new HashMap<>();
public Map<UrlProtocol, String> getUrls() {
return urls;
}
public void setUrls(final Map<UrlProtocol, String> urls) {
this.urls = urls;
}
public String getFilename() {
return filename;
}
public void setFilename(final String filename) {
this.filename = filename;
}
public ArtifactHash getHashes() {
return hashes;
}
public void setHashes(final ArtifactHash hashes) {
this.hashes = hashes;
}
public Long getSize() {
return size;
}
public void setSize(final Long size) {
this.size = size;
}
}

View File

@@ -0,0 +1,60 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.dmf.json.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* JSON representation of artifact hash.
*
*
*
*
*/
public class ArtifactHash {
@JsonProperty
private String sha1;
@JsonProperty
private String md5;
/**
* Constructor.
*
* @param sha1
* the sha1 hash
* @param md5
* the md5 hash
*/
@JsonCreator
public ArtifactHash(@JsonProperty("sha1") final String sha1, @JsonProperty("md5") final String md5) {
super();
this.sha1 = sha1;
this.md5 = md5;
}
public void setSha1(final String sha1) {
this.sha1 = sha1;
}
public void setMd5(final String md5) {
this.md5 = md5;
}
public String getSha1() {
return sha1;
}
public String getMd5() {
return md5;
}
}

View File

@@ -0,0 +1,56 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.dmf.json.model;
import java.util.LinkedList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* JSON representation of download and update request.
*
*
*
*
*/
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class DownloadAndUpdateRequest {
@JsonProperty
private Long actionId;
@JsonProperty
private final List<SoftwareModule> softwareModules = new LinkedList<SoftwareModule>();
public Long getActionId() {
return actionId;
}
public void setActionId(final Long correlator) {
this.actionId = correlator;
}
public List<SoftwareModule> getSoftwareModules() {
return softwareModules;
}
/**
* Add a Software module.
*
* @param createSoftwareModule
* the module
*/
public void addSoftwareModule(final SoftwareModule createSoftwareModule) {
softwareModules.add(createSoftwareModule);
}
}

View File

@@ -0,0 +1,69 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.dmf.json.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* The authentification response JSON representation.
*
*
*
*/
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class DownloadResponse {
@JsonProperty
private String downloadUrl;
@JsonProperty
private Artifact artifact;
@JsonProperty
private int responseCode;
@JsonProperty
private String message;
public String getMessage() {
return message;
}
public void setMessage(final String message) {
this.message = message;
}
public int getResponseCode() {
return responseCode;
}
public void setResponseCode(final int responseCode) {
this.responseCode = responseCode;
}
public String getDownloadUrl() {
return downloadUrl;
}
public void setDownloadUrl(final String downloadUrl) {
this.downloadUrl = downloadUrl;
}
public Artifact getArtifact() {
return artifact;
}
public void setArtifact(final Artifact artifact) {
this.artifact = artifact;
}
}

View File

@@ -0,0 +1,73 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.dmf.json.model;
import java.util.LinkedList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* JSON representation of a software module.
*
*
*
*
*/
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class SoftwareModule {
@JsonProperty
private Long moduleId;
@JsonProperty
private String moduleType;
@JsonProperty
private String moduleVersion;
@JsonProperty
private List<Artifact> artifacts = new LinkedList<Artifact>();
public String getModuleType() {
return moduleType;
}
public void setModuleType(final String moduleType) {
this.moduleType = moduleType;
}
public String getModuleVersion() {
return moduleVersion;
}
public void setModuleVersion(final String moduleVersion) {
this.moduleVersion = moduleVersion;
}
public List<Artifact> getArtifacts() {
return artifacts;
}
public Long getModuleId() {
return moduleId;
}
@JsonIgnore
public void setModuleId(final Long moduleId) {
this.moduleId = moduleId;
}
public void setArtifacts(final List<Artifact> artifacts) {
this.artifacts = artifacts;
}
}

View File

@@ -0,0 +1,94 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.dmf.json.model;
import java.util.Map;
import java.util.TreeMap;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* JSON representation to authenticate a tenant.
*
*
*
*/
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class TenantSecruityToken {
public static final String AUTHORIZATION_HEADER = "Authorization";
public static final String COAP_AUTHORIZATION_HEADER = "Coap-Authorization";
public static final String COAP_TOKEN_VALUE = "CoapToken";
@JsonProperty
private final String tenant;
@JsonProperty
private final String controllerId;
@JsonProperty(required = false)
private Map<String, String> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
@JsonProperty(required = false)
private final String sha1;
/**
* Constructor.
*
* @param tenant
* the tenant for the security token
* @param controllerId
* the ID of the controller for the security token
* @param sha1
* the sha1 of authentication
*/
@JsonCreator
public TenantSecruityToken(@JsonProperty("tenant") final String tenant,
@JsonProperty("controllerId") final String controllerId, @JsonProperty("sha1") final String sha1) {
this.tenant = tenant;
this.controllerId = controllerId;
this.sha1 = sha1;
}
public String getTenant() {
return tenant;
}
public String getControllerId() {
return controllerId;
}
public Map<String, String> getHeaders() {
return headers;
}
public String getSha1() {
return sha1;
}
/**
* Gets a header value.
*
* @param name
* of header
* @return the value
*/
public String getHeader(final String name) {
return headers.get(name);
}
public void setHeaders(final Map<String, String> headers) {
this.headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
this.headers.putAll(headers);
}
}