Skip to content

Commit

Permalink
Rename BootstrapStore in BootstrapConfigStore
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernard31 committed Jul 2, 2019
1 parent 3899a90 commit 37a8ef5
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import org.eclipse.leshan.core.request.Identity;
import org.eclipse.leshan.server.bootstrap.BootstrapConfig;
import org.eclipse.leshan.server.bootstrap.BootstrapStore;
import org.eclipse.leshan.server.bootstrap.BootstrapConfigStore;
import org.eclipse.leshan.server.bootstrap.ConfigurationChecker;
import org.eclipse.leshan.server.bootstrap.InvalidConfigurationException;
import org.eclipse.leshan.util.Validate;
Expand All @@ -42,7 +42,7 @@
/**
* Simple bootstrap store implementation storing bootstrap information in memory
*/
public class BootstrapStoreImpl implements BootstrapStore {
public class BootstrapStoreImpl implements BootstrapConfigStore {

private static final Logger LOG = LoggerFactory.getLogger(BootstrapStoreImpl.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import org.eclipse.leshan.server.bootstrap.BootstrapConfig.ACLConfig;
import org.eclipse.leshan.server.bootstrap.BootstrapConfig.ServerConfig;
import org.eclipse.leshan.server.bootstrap.BootstrapConfig.ServerSecurity;
import org.eclipse.leshan.server.bootstrap.BootstrapStore;
import org.eclipse.leshan.server.bootstrap.BootstrapConfigStore;
import org.eclipse.leshan.server.californium.LeshanBootstrapServerBuilder;
import org.eclipse.leshan.server.californium.impl.LeshanBootstrapServer;
import org.eclipse.leshan.server.security.BootstrapSecurityStore;
Expand Down Expand Up @@ -96,7 +96,7 @@ public BootstrapIntegrationTestHelper() {
}
}

public void createBootstrapServer(BootstrapSecurityStore securityStore, BootstrapStore bootstrapStore) {
public void createBootstrapServer(BootstrapSecurityStore securityStore, BootstrapConfigStore bootstrapStore) {
if (bootstrapStore == null) {
bootstrapStore = unsecuredBootstrapStore();
}
Expand Down Expand Up @@ -229,8 +229,8 @@ public List<SecurityInfo> getAllByEndpoint(String endpoint) {
};
}

public BootstrapStore unsecuredBootstrapStore() {
return new BootstrapStore() {
public BootstrapConfigStore unsecuredBootstrapStore() {
return new BootstrapConfigStore() {

@Override
public BootstrapConfig getBootstrap(String endpoint, Identity deviceIdentity) {
Expand Down Expand Up @@ -264,7 +264,7 @@ public BootstrapConfig getBootstrap(String endpoint, Identity deviceIdentity) {
};
}

public BootstrapStore deleteSecurityStore(Integer... objectToDelete) {
public BootstrapConfigStore deleteSecurityStore(Integer... objectToDelete) {
String[] pathToDelete = new String[objectToDelete.length];
for (int i = 0; i < pathToDelete.length; i++) {
pathToDelete[i] = "/" + objectToDelete[i];
Expand All @@ -273,8 +273,8 @@ public BootstrapStore deleteSecurityStore(Integer... objectToDelete) {
return deleteSecurityStore(pathToDelete);
}

public BootstrapStore deleteSecurityStore(final String... pathToDelete) {
return new BootstrapStore() {
public BootstrapConfigStore deleteSecurityStore(final String... pathToDelete) {
return new BootstrapConfigStore() {

@Override
public BootstrapConfig getBootstrap(String endpoint, Identity deviceIdentity) {
Expand All @@ -286,8 +286,8 @@ public BootstrapConfig getBootstrap(String endpoint, Identity deviceIdentity) {
};
}

public BootstrapStore unsecuredWithAclBootstrapStore() {
return new BootstrapStore() {
public BootstrapConfigStore unsecuredWithAclBootstrapStore() {
return new BootstrapConfigStore() {

@Override
public BootstrapConfig getBootstrap(String endpoint, Identity deviceIdentity) {
Expand Down Expand Up @@ -337,8 +337,8 @@ public BootstrapConfig getBootstrap(String endpoint, Identity deviceIdentity) {
};
}

public BootstrapStore pskBootstrapStore() {
return new BootstrapStore() {
public BootstrapConfigStore pskBootstrapStore() {
return new BootstrapConfigStore() {

@Override
public BootstrapConfig getBootstrap(String endpoint, Identity deviceIdentity) {
Expand Down Expand Up @@ -374,8 +374,8 @@ public BootstrapConfig getBootstrap(String endpoint, Identity deviceIdentity) {
};
}

public BootstrapStore rpkBootstrapStore() {
return new BootstrapStore() {
public BootstrapConfigStore rpkBootstrapStore() {
return new BootstrapConfigStore() {

@Override
public BootstrapConfig getBootstrap(String endpoint, Identity deviceIdentity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
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.BootstrapStore;
import org.eclipse.leshan.server.bootstrap.BootstrapConfigStore;
import org.eclipse.leshan.server.bootstrap.DefaultBootstrapHandler;
import org.eclipse.leshan.server.bootstrap.LwM2mBootstrapRequestSender;
import org.eclipse.leshan.server.californium.impl.LeshanBootstrapServer;
Expand All @@ -61,7 +61,7 @@ public class LeshanBootstrapServerBuilder {

private InetSocketAddress localAddress;
private InetSocketAddress localAddressSecure;
private BootstrapStore configStore;
private BootstrapConfigStore configStore;
private BootstrapSecurityStore securityStore;
private BootstrapSessionManager sessionManager;
private BootstrapHandlerFactory bootstrapHandlerFactory;
Expand Down Expand Up @@ -208,7 +208,7 @@ public <T extends Certificate> LeshanBootstrapServerBuilder setTrustedCertificat
}

/**
* Set the {@link BootstrapStore} containing bootstrap configuration to apply to each devices.
* Set the {@link BootstrapConfigStore} containing bootstrap configuration to apply to each devices.
* <p>
* WARNING: There is not default implementation and this store is mandatory to create a bootstrap server.
* <p>
Expand All @@ -217,7 +217,7 @@ public <T extends Certificate> LeshanBootstrapServerBuilder setTrustedCertificat
* @param configStore the bootstrap configuration store.
* @return the builder for fluent Bootstrap Server creation.
*/
public LeshanBootstrapServerBuilder setConfigStore(BootstrapStore configStore) {
public LeshanBootstrapServerBuilder setConfigStore(BootstrapConfigStore configStore) {
this.configStore = configStore;
return this;
}
Expand Down Expand Up @@ -255,9 +255,9 @@ public LeshanBootstrapServerBuilder setSessionManager(BootstrapSessionManager se
* Advanced setter used to customize default bootstrap server behavior.
* <p>
* By default Bootstrap Server is only able to write Security, Server and ACL objects, see
* {@link #setConfigStore(BootstrapStore)}. If you need more advanced behavior you can create your own
* {@link #setConfigStore(BootstrapConfigStore)}. If you need more advanced behavior you can create your own
* {@link BootstrapHandler} by inspiring yourself from {@link DefaultBootstrapHandler}. You will probably need to
* create a custom {@link BootstrapConfig} and {@link BootstrapStore} and/or change LWM2M model to use, see
* create a custom {@link BootstrapConfig} and {@link BootstrapConfigStore} and/or change LWM2M model to use, see
* {@link #setModel(LwM2mModel)}.
*
* @param bootstrapHandlerFactory the factory used to create {@link BootstrapHandler}.
Expand All @@ -273,12 +273,12 @@ public LeshanBootstrapServerBuilder setBootstrapHandlerFactory(BootstrapHandlerF
* Bootstrap write request.
* <p>
* By default, LWM2M object models defined in LWM2M v1.0.x are used. Out of the box, Bootstrap Server is only able
* to write Security, Server and ACL objects, see {@link #setConfigStore(BootstrapStore)}.
* to write Security, Server and ACL objects, see {@link #setConfigStore(BootstrapConfigStore)}.
* <p>
* Set a different LWM2M model if you want to use a different model version of Security, Server and ACL objects, or
* if you need to write objects which are not available by default. For the second case, you need to change
* {@link BootstrapHandler} behavior as well, using {@link #setBootstrapHandlerFactory(BootstrapHandlerFactory)} and
* probably create a custom {@link BootstrapConfig} and {@link BootstrapStore}.
* probably create a custom {@link BootstrapConfig} and {@link BootstrapConfigStore}.
* <p>
* WARNING: Only 1 version by object is supported for now.
*
Expand Down Expand Up @@ -383,7 +383,7 @@ public LeshanBootstrapServer build() {
if (bootstrapHandlerFactory == null)
bootstrapHandlerFactory = new BootstrapHandlerFactory() {
@Override
public BootstrapHandler create(BootstrapStore store, LwM2mBootstrapRequestSender sender,
public BootstrapHandler create(BootstrapConfigStore store, LwM2mBootstrapRequestSender sender,
BootstrapSessionManager sessionManager) {
return new DefaultBootstrapHandler(store, sender, sessionManager);
}
Expand Down Expand Up @@ -554,7 +554,7 @@ public BootstrapHandler create(BootstrapStore store, LwM2mBootstrapRequestSender
* @return the LWM2M Bootstrap server.
*/
protected LeshanBootstrapServer createBootstrapServer(CoapEndpoint unsecuredEndpoint, CoapEndpoint securedEndpoint,
BootstrapStore bsStore, BootstrapSecurityStore bsSecurityStore, BootstrapSessionManager bsSessionManager,
BootstrapConfigStore bsStore, BootstrapSecurityStore bsSecurityStore, BootstrapSessionManager bsSessionManager,
BootstrapHandlerFactory bsHandlerFactory, LwM2mModel model, NetworkConfig coapConfig) {
return new LeshanBootstrapServer(unsecuredEndpoint, securedEndpoint, bsStore, bsSecurityStore, bsSessionManager,
bsHandlerFactory, model, coapConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
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.BootstrapStore;
import org.eclipse.leshan.server.bootstrap.BootstrapConfigStore;
import org.eclipse.leshan.server.bootstrap.LwM2mBootstrapRequestSender;
import org.eclipse.leshan.server.bootstrap.LwM2mBootstrapServer;
import org.eclipse.leshan.server.security.BootstrapSecurityStore;
Expand All @@ -48,10 +48,10 @@ public class LeshanBootstrapServer implements LwM2mBootstrapServer {
private final CoapEndpoint securedEndpoint;

// LWM2M attributes
private final BootstrapStore bsStore;
private final BootstrapConfigStore bsStore;
private final BootstrapSecurityStore bsSecurityStore;

public LeshanBootstrapServer(CoapEndpoint unsecuredEndpoint, CoapEndpoint securedEndpoint, BootstrapStore bsStore,
public LeshanBootstrapServer(CoapEndpoint unsecuredEndpoint, CoapEndpoint securedEndpoint, BootstrapConfigStore bsStore,
BootstrapSecurityStore bsSecurityStore, BootstrapSessionManager bsSessionManager,
BootstrapHandlerFactory bsHandlerFactory, LwM2mModel model, NetworkConfig coapConfig) {

Expand Down Expand Up @@ -104,7 +104,7 @@ public BootstrapSecurityStore getBootstrapSecurityStore() {
}

@Override
public BootstrapStore getBoostrapStore() {
public BootstrapConfigStore getBoostrapStore() {
return bsStore;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import org.eclipse.leshan.core.request.Identity;
import org.eclipse.leshan.server.bootstrap.BootstrapConfig;
import org.eclipse.leshan.server.bootstrap.BootstrapStore;
import org.eclipse.leshan.server.bootstrap.BootstrapConfigStore;
import org.eclipse.leshan.server.californium.impl.LeshanBootstrapServer;
import org.eclipse.leshan.server.security.BootstrapSecurityStore;
import org.eclipse.leshan.server.security.SecurityInfo;
Expand All @@ -36,7 +36,7 @@ public class LeshanBootstrapServerBuilderTest {
@Before
public void start() {
builder = new LeshanBootstrapServerBuilder();
builder.setConfigStore(new BootstrapStore() {
builder.setConfigStore(new BootstrapConfigStore() {
@Override
public BootstrapConfig getBootstrap(String endpoint, Identity deviceIdentity) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* sent.
* <li>a Map from instanceId to Instance value for ACL object. For each entry a Bootstrap Write Request will be sent.
*
* @see BootstrapStore
* @see BootstrapConfigStore
* @see DefaultBootstrapHandler
*/
public class BootstrapConfig implements Serializable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/**
* A store containing the bootstrap information to be sent to the devices.
*/
public interface BootstrapStore {
public interface BootstrapConfigStore {

/**
* Get the bootstrap configuration to apply to the device identified by the given parameters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public interface BootstrapHandlerFactory {
* @param sessionManager the manager responsible to handle bootstrap session.
* @return the new {@link BootstrapHandler}.
*/
BootstrapHandler create(BootstrapStore store, LwM2mBootstrapRequestSender sender,
BootstrapHandler create(BootstrapConfigStore store, LwM2mBootstrapRequestSender sender,
BootstrapSessionManager sessionManager);
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,22 @@ public class DefaultBootstrapHandler implements BootstrapHandler {

protected final Executor e;

protected final BootstrapStore store;
protected final BootstrapConfigStore store;
protected final LwM2mBootstrapRequestSender sender;
protected final BootstrapSessionManager sessionManager;
protected final long requestTimeout;

public DefaultBootstrapHandler(BootstrapStore store, LwM2mBootstrapRequestSender sender,
public DefaultBootstrapHandler(BootstrapConfigStore store, LwM2mBootstrapRequestSender sender,
BootstrapSessionManager sessionManager) {
this(store, sender, sessionManager, Executors.newFixedThreadPool(5), DEFAULT_TIMEOUT);
}

public DefaultBootstrapHandler(BootstrapStore store, LwM2mBootstrapRequestSender sender,
public DefaultBootstrapHandler(BootstrapConfigStore store, LwM2mBootstrapRequestSender sender,
BootstrapSessionManager sessionManager, Executor executor) {
this(store, sender, sessionManager, executor, DEFAULT_TIMEOUT);
}

public DefaultBootstrapHandler(BootstrapStore store, LwM2mBootstrapRequestSender sender,
public DefaultBootstrapHandler(BootstrapConfigStore store, LwM2mBootstrapRequestSender sender,
BootstrapSessionManager sessionManager, Executor executor, long requestTimeout) {
this.store = store;
this.sender = sender;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public interface LwM2mBootstrapServer {
*
* @return the store containing configuration to apply to each devices.
*/
BootstrapStore getBoostrapStore();
BootstrapConfigStore getBoostrapStore();

/**
* security store used for DTLS authentication on the bootstrap resource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void notifies_at_end_of_successful_bootstrap() {
final MockBootstrapSessionManager bsSessionManager = new MockBootstrapSessionManager(true);
final LwM2mBootstrapRequestSender requestSender = new MockRequestSender(true);

final BootstrapStore bsStore = new BootstrapStore() {
final BootstrapConfigStore bsStore = new BootstrapConfigStore() {
@Override
public BootstrapConfig getBootstrap(String endpoint, Identity deviceIdentity) {
return new BootstrapConfig();
Expand All @@ -79,7 +79,7 @@ public void does_not_notifies_at_end_of_failed_bootstrap() {
final MockBootstrapSessionManager bsSessionManager = new MockBootstrapSessionManager(true);
final LwM2mBootstrapRequestSender requestSender = new MockRequestSender(false);

final BootstrapStore bsStore = new BootstrapStore() {
final BootstrapConfigStore bsStore = new BootstrapConfigStore() {
@Override
public BootstrapConfig getBootstrap(String endpoint, Identity deviceIdentity) {
return new BootstrapConfig();
Expand Down

0 comments on commit 37a8ef5

Please sign in to comment.