|
|
|
@ -16,6 +16,7 @@ |
|
|
|
package org.thingsboard.server.transport.lwm2m.server.store; |
|
|
|
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.eclipse.californium.core.network.RandomTokenGenerator; |
|
|
|
import org.eclipse.leshan.server.registration.RegistrationStore; |
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
@ -30,6 +31,7 @@ import org.thingsboard.server.transport.lwm2m.server.LwM2mVersionedModelProvider |
|
|
|
|
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@Component |
|
|
|
@TbLwM2mTransportComponent |
|
|
|
@RequiredArgsConstructor |
|
|
|
@ -44,6 +46,11 @@ public class TbLwM2mStoreFactory { |
|
|
|
|
|
|
|
@Bean |
|
|
|
private RegistrationStore registrationStore() { |
|
|
|
if (config == null || config.getCoapConfig() == null) { |
|
|
|
log.error("For the test: CoapConfig is null!"); |
|
|
|
} else { |
|
|
|
log.info("For the test: CoapConfig: is ok!"); |
|
|
|
} |
|
|
|
return redisConfiguration.isPresent() ? |
|
|
|
new TbLwM2mRedisRegistrationStore(new RandomTokenGenerator(config.getCoapConfig()), getConnectionFactory(), modelProvider) : |
|
|
|
new TbInMemoryRegistrationStore(new RandomTokenGenerator(config.getCoapConfig()), config.getCleanPeriodInSec(), modelProvider); |
|
|
|
|