Update the project readme's getting started (#2810)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -120,6 +120,7 @@ public class HawkbitClient {
|
||||
new DefaultHttpRequestRetryStrategy(
|
||||
Integer.getInteger("hawkbit.sdk.http.maxRetry", 3),
|
||||
TimeValue.ofSeconds(Integer.getInteger("hawkbit.sdk.http.defaultRetryIntervalSec", 10)));
|
||||
private static final int BUFFER_SIZE = 8096;
|
||||
|
||||
private final HawkbitServer hawkBitServer;
|
||||
|
||||
@@ -131,10 +132,8 @@ public class HawkbitClient {
|
||||
private final BiFunction<Tenant, Controller, RequestInterceptor> requestInterceptorFn;
|
||||
|
||||
private final HttpRequestRetryStrategy httpRequestRetryStrategy;
|
||||
private final int BUFFER_SIZE = 8096;
|
||||
|
||||
public HawkbitClient(
|
||||
final HawkbitServer hawkBitServer, final Encoder encoder, final Decoder decoder, final Contract contract) {
|
||||
public HawkbitClient(final HawkbitServer hawkBitServer, final Encoder encoder, final Decoder decoder, final Contract contract) {
|
||||
this(hawkBitServer, encoder, decoder, contract, null, null);
|
||||
}
|
||||
|
||||
@@ -226,6 +225,7 @@ public class HawkbitClient {
|
||||
}
|
||||
|
||||
private static final Cleaner CLEANER = Cleaner.create();
|
||||
|
||||
private <T> T service0(final Class<T> serviceType, final Tenant tenant, final Controller controller) {
|
||||
final String url = controller == null ? hawkBitServer.getMgmtUrl() : hawkBitServer.getDdiUrl();
|
||||
final HttpClientKey key = new HttpClientKey(
|
||||
@@ -364,6 +364,7 @@ public class HawkbitClient {
|
||||
}
|
||||
|
||||
private static final String CRLF = "\r\n";
|
||||
|
||||
private void writeMultipartFile(
|
||||
final MultipartFile multipartFile, final OutputStream out, final String boundary, final Annotation[] parametersAnnotations)
|
||||
throws IOException {
|
||||
@@ -382,6 +383,7 @@ public class HawkbitClient {
|
||||
out.write(CRLF.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
|
||||
private void writeSimpleFormData(
|
||||
final Object arg, final OutputStream out, final String boundary, final Annotation[] parameterAnnotations) throws IOException {
|
||||
if (arg != null) {
|
||||
@@ -406,13 +408,16 @@ public class HawkbitClient {
|
||||
}
|
||||
|
||||
private static final String KEYSTORE_PASSWORD;
|
||||
|
||||
static {
|
||||
final Random random = new SecureRandom();
|
||||
final byte[] bytes = new byte[16];
|
||||
random.nextBytes(bytes);
|
||||
KEYSTORE_PASSWORD = Base64.getEncoder().encodeToString(bytes);
|
||||
}
|
||||
|
||||
private static final Map<HttpClientKey, HttpClientWrapper> HTTP_CLIENTS = new HashMap<>();
|
||||
|
||||
private static HttpClient httpClient(final HttpClientKey key) {
|
||||
synchronized (HTTP_CLIENTS) {
|
||||
final HttpClientWrapper httpClientWrapper = HTTP_CLIENTS.get(key);
|
||||
|
||||
@@ -70,6 +70,9 @@
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<mainClass>org.eclipse.hawkbit.sdk.demo.device.DeviceApp</mainClass>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.eclipse.hawkbit.sdk.device.DdiController;
|
||||
import org.eclipse.hawkbit.sdk.device.DdiTenant;
|
||||
import org.eclipse.hawkbit.sdk.device.UpdateHandler;
|
||||
import org.eclipse.hawkbit.sdk.mgmt.AuthenticationSetupHelper;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -66,11 +67,11 @@ public class DeviceApp {
|
||||
private final AuthenticationSetupHelper mgmtApi;
|
||||
|
||||
@SuppressWarnings("java:S3358")
|
||||
Shell(final DdiTenant ddiTenant, final AuthenticationSetupHelper mgmtApi, final Optional<UpdateHandler> updateHandler) {
|
||||
Shell(final DdiTenant ddiTenant, final AuthenticationSetupHelper mgmtApi, final Optional<UpdateHandler> updateHandler,
|
||||
@Value("${demo.controller.id:demo}") final String controllerId,
|
||||
@Value("${demo.controller.securityToken:#{null}") final String securityToken) {
|
||||
this.ddiTenant = ddiTenant;
|
||||
this.mgmtApi = mgmtApi;
|
||||
final String controllerId = System.getProperty("demo.controller.id");
|
||||
final String securityToken = System.getProperty("demo.controller.securityToken");
|
||||
|
||||
this.device = this.ddiTenant.createController(
|
||||
Controller.builder()
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#
|
||||
|
||||
spring.main.web-application-type=none
|
||||
spring.shell.interactive.enabled=true
|
||||
|
||||
logging.level.org.eclipse.hawkbit=DEBUG
|
||||
|
||||
|
||||
Reference in New Issue
Block a user