From 91d30d149cd207dafaa74277a059284123210642 Mon Sep 17 00:00:00 2001 From: Simon Bernard Date: Fri, 21 Jun 2019 16:41:25 +0200 Subject: [PATCH] BS Builder now create an InMemoryBoostrapConfigStore by default. --- .../californium/LeshanBootstrapServerBuilder.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/LeshanBootstrapServerBuilder.java b/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/LeshanBootstrapServerBuilder.java index 52b7e1a8ae..a7f69a50a9 100644 --- a/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/LeshanBootstrapServerBuilder.java +++ b/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/LeshanBootstrapServerBuilder.java @@ -36,11 +36,12 @@ import org.eclipse.leshan.core.model.LwM2mModel; import org.eclipse.leshan.core.model.ObjectLoader; import org.eclipse.leshan.server.bootstrap.BootstrapConfig; +import org.eclipse.leshan.server.bootstrap.BootstrapConfigStore; import org.eclipse.leshan.server.bootstrap.BootstrapHandler; import org.eclipse.leshan.server.bootstrap.BootstrapHandlerFactory; import org.eclipse.leshan.server.bootstrap.BootstrapSessionManager; -import org.eclipse.leshan.server.bootstrap.BootstrapConfigStore; import org.eclipse.leshan.server.bootstrap.DefaultBootstrapHandler; +import org.eclipse.leshan.server.bootstrap.InMemoryBootstrapConfigStore; import org.eclipse.leshan.server.bootstrap.LwM2mBootstrapRequestSender; import org.eclipse.leshan.server.californium.impl.LeshanBootstrapServer; import org.eclipse.leshan.server.californium.impl.LwM2mBootstrapPskStore; @@ -210,7 +211,7 @@ public LeshanBootstrapServerBuilder setTrustedCertificat /** * Set the {@link BootstrapConfigStore} containing bootstrap configuration to apply to each devices. *

- * WARNING: There is not default implementation and this store is mandatory to create a bootstrap server. + * By default an {@link InMemoryBootstrapConfigStore} is used. *

* See {@link BootstrapConfig} to see what is could be done during a bootstrap session. * @@ -376,7 +377,7 @@ public LeshanBootstrapServer build() { // TODO we should have default implementation for BootstrapStore in leshan.server project. if (configStore == null) - throw new IllegalStateException("BootstrapStore is mandatory"); + configStore = new InMemoryBootstrapConfigStore(); if (sessionManager == null) sessionManager = new DefaultBootstrapSessionManager(securityStore); @@ -554,8 +555,9 @@ public BootstrapHandler create(BootstrapConfigStore store, LwM2mBootstrapRequest * @return the LWM2M Bootstrap server. */ protected LeshanBootstrapServer createBootstrapServer(CoapEndpoint unsecuredEndpoint, CoapEndpoint securedEndpoint, - BootstrapConfigStore bsStore, BootstrapSecurityStore bsSecurityStore, BootstrapSessionManager bsSessionManager, - BootstrapHandlerFactory bsHandlerFactory, LwM2mModel model, NetworkConfig coapConfig) { + BootstrapConfigStore bsStore, BootstrapSecurityStore bsSecurityStore, + BootstrapSessionManager bsSessionManager, BootstrapHandlerFactory bsHandlerFactory, LwM2mModel model, + NetworkConfig coapConfig) { return new LeshanBootstrapServer(unsecuredEndpoint, securedEndpoint, bsStore, bsSecurityStore, bsSessionManager, bsHandlerFactory, model, coapConfig); }