Commit f6eb3b1342b5446f0d3de3a5f9dbb724f12d2e92
Committed by
Andrew Shvayka
1 parent
9b4309c6
Lwm2m: back: refactoring-light start
Showing
5 changed files
with
64 additions
and
68 deletions
@@ -581,6 +581,7 @@ transport: | @@ -581,6 +581,7 @@ transport: | ||
581 | request_pool_size: "${LWM2M_REQUEST_POOL_SIZE:100}" | 581 | request_pool_size: "${LWM2M_REQUEST_POOL_SIZE:100}" |
582 | request_error_pool_size: "${LWM2M_REQUEST_ERROR_POOL_SIZE:10}" | 582 | request_error_pool_size: "${LWM2M_REQUEST_ERROR_POOL_SIZE:10}" |
583 | registered_pool_size: "${LWM2M_REGISTERED_POOL_SIZE:10}" | 583 | registered_pool_size: "${LWM2M_REGISTERED_POOL_SIZE:10}" |
584 | + client_update_value_after_connect: "${CLIENT_UPDATE_VALUE_AFTER_CONNECT:false}" | ||
584 | update_registered_pool_size: "${LWM2M_UPDATE_REGISTERED_POOL_SIZE:10}" | 585 | update_registered_pool_size: "${LWM2M_UPDATE_REGISTERED_POOL_SIZE:10}" |
585 | un_registered_pool_size: "${LWM2M_UN_REGISTERED_POOL_SIZE:10}" | 586 | un_registered_pool_size: "${LWM2M_UN_REGISTERED_POOL_SIZE:10}" |
586 | secure: | 587 | secure: |
@@ -20,7 +20,6 @@ import com.google.gson.JsonArray; | @@ -20,7 +20,6 @@ import com.google.gson.JsonArray; | ||
20 | import com.google.gson.JsonElement; | 20 | import com.google.gson.JsonElement; |
21 | import com.google.gson.JsonObject; | 21 | import com.google.gson.JsonObject; |
22 | import lombok.extern.slf4j.Slf4j; | 22 | import lombok.extern.slf4j.Slf4j; |
23 | -import org.eclipse.leshan.core.Link; | ||
24 | import org.eclipse.leshan.core.model.ResourceModel; | 23 | import org.eclipse.leshan.core.model.ResourceModel; |
25 | import org.eclipse.leshan.core.node.LwM2mMultipleResource; | 24 | import org.eclipse.leshan.core.node.LwM2mMultipleResource; |
26 | import org.eclipse.leshan.core.node.LwM2mObject; | 25 | import org.eclipse.leshan.core.node.LwM2mObject; |
@@ -155,6 +154,7 @@ public class LwM2MTransportServiceImpl implements LwM2MTransportService { | @@ -155,6 +154,7 @@ public class LwM2MTransportServiceImpl implements LwM2MTransportService { | ||
155 | lwM2MClient.setSessionUuid(UUID.randomUUID()); | 154 | lwM2MClient.setSessionUuid(UUID.randomUUID()); |
156 | this.sentLogsToThingsboard(LOG_LW2M_INFO + ": Client Registered", registration); | 155 | this.sentLogsToThingsboard(LOG_LW2M_INFO + ": Client Registered", registration); |
157 | this.setLwM2mFromClientValue(lwServer, registration, lwM2MClient); | 156 | this.setLwM2mFromClientValue(lwServer, registration, lwM2MClient); |
157 | + lwM2MClient.setClientUpdateValueAfterConnect(this.context.getCtxServer().isClientUpdateValueAfterConnect()); | ||
158 | SessionInfoProto sessionInfo = this.getValidateSessionInfo(registration); | 158 | SessionInfoProto sessionInfo = this.getValidateSessionInfo(registration); |
159 | if (sessionInfo != null) { | 159 | if (sessionInfo != null) { |
160 | lwM2MClient.setDeviceUuid(new UUID(sessionInfo.getDeviceIdMSB(), sessionInfo.getDeviceIdLSB())); | 160 | lwM2MClient.setDeviceUuid(new UUID(sessionInfo.getDeviceIdMSB(), sessionInfo.getDeviceIdLSB())); |
@@ -165,7 +165,9 @@ public class LwM2MTransportServiceImpl implements LwM2MTransportService { | @@ -165,7 +165,9 @@ public class LwM2MTransportServiceImpl implements LwM2MTransportService { | ||
165 | transportService.process(sessionInfo, DefaultTransportService.getSessionEventMsg(SessionEvent.OPEN), null); | 165 | transportService.process(sessionInfo, DefaultTransportService.getSessionEventMsg(SessionEvent.OPEN), null); |
166 | transportService.process(sessionInfo, TransportProtos.SubscribeToAttributeUpdatesMsg.newBuilder().build(), null); | 166 | transportService.process(sessionInfo, TransportProtos.SubscribeToAttributeUpdatesMsg.newBuilder().build(), null); |
167 | this.sentLogsToThingsboard(LOG_LW2M_INFO + ": Client create after Registration", registration); | 167 | this.sentLogsToThingsboard(LOG_LW2M_INFO + ": Client create after Registration", registration); |
168 | - this.putDelayedUpdateResourcesThingsboard(lwM2MClient); | 168 | + if (this.context.getCtxServer().isClientUpdateValueAfterConnect()) { |
169 | + this.putDelayedUpdateResourcesThingsboard(lwM2MClient); | ||
170 | + } | ||
169 | } else { | 171 | } else { |
170 | log.error("Client: [{}] onRegistered [{}] name [{}] sessionInfo ", registration.getId(), registration.getEndpoint(), null); | 172 | log.error("Client: [{}] onRegistered [{}] name [{}] sessionInfo ", registration.getId(), registration.getEndpoint(), null); |
171 | } | 173 | } |
@@ -272,8 +274,11 @@ public class LwM2MTransportServiceImpl implements LwM2MTransportService { | @@ -272,8 +274,11 @@ public class LwM2MTransportServiceImpl implements LwM2MTransportService { | ||
272 | /** | 274 | /** |
273 | * #0 Add new ObjectModel to context | 275 | * #0 Add new ObjectModel to context |
274 | * Create new LwM2MClient for current session -> setModelClient... | 276 | * Create new LwM2MClient for current session -> setModelClient... |
275 | - * #1 Add all ObjectLinks (instance) to control the process of executing requests to the client | 277 | + * if need all value after registration: |
278 | + * #1.1 Add all ObjectLinks (instance) to control the process of executing requests to the client | ||
276 | * to get the client model with current values | 279 | * to get the client model with current values |
280 | + * if not need all value after registration (only observe) | ||
281 | + * #1.2 Get observe | ||
277 | * #2 Get the client model with current values. Analyze the response in -> lwM2MTransportRequest.sendResponse | 282 | * #2 Get the client model with current values. Analyze the response in -> lwM2MTransportRequest.sendResponse |
278 | * | 283 | * |
279 | * @param lwServer - LeshanServer | 284 | * @param lwServer - LeshanServer |
@@ -281,48 +286,35 @@ public class LwM2MTransportServiceImpl implements LwM2MTransportService { | @@ -281,48 +286,35 @@ public class LwM2MTransportServiceImpl implements LwM2MTransportService { | ||
281 | * @param lwM2MClient - object with All parameters off client | 286 | * @param lwM2MClient - object with All parameters off client |
282 | */ | 287 | */ |
283 | private void setLwM2mFromClientValue(LeshanServer lwServer, Registration registration, LwM2MClient lwM2MClient) { | 288 | private void setLwM2mFromClientValue(LeshanServer lwServer, Registration registration, LwM2MClient lwM2MClient) { |
289 | + // #1.1 | ||
290 | + // get all instances in client | ||
291 | + Set<String> clientInstances = ConcurrentHashMap.newKeySet(); | ||
284 | Arrays.stream(registration.getObjectLinks()).forEach(url -> { | 292 | Arrays.stream(registration.getObjectLinks()).forEach(url -> { |
285 | LwM2mPath pathIds = new LwM2mPath(url.getUrl()); | 293 | LwM2mPath pathIds = new LwM2mPath(url.getUrl()); |
286 | if (pathIds.isObjectInstance() && !pathIds.isResource()) { | 294 | if (pathIds.isObjectInstance() && !pathIds.isResource()) { |
287 | - // #1 | ||
288 | - lwM2MClient.getPendingRequests().add(url.getUrl()); | ||
289 | - // #2 | ||
290 | - lwM2MTransportRequest.sendAllRequest(lwServer, registration, url.getUrl(), GET_TYPE_OPER_READ, ContentFormat.TLV.getName(), | ||
291 | - lwM2MClient, null, null, this.context.getCtxServer().getTimeout(), false); | 295 | + clientInstances.add(url.getUrl()); |
292 | } | 296 | } |
293 | }); | 297 | }); |
294 | - | ||
295 | - // #1 | ||
296 | - for (Link url : registration.getObjectLinks()) { | ||
297 | - LwM2mPath pathIds = new LwM2mPath(url.getUrl()); | ||
298 | - if (pathIds.isObjectInstance() && !pathIds.isResource()) { | ||
299 | - lwM2MClient.getPendingRequests().add(url.getUrl()); | ||
300 | - } | ||
301 | - } | ||
302 | - // #2 | ||
303 | - for (Link url : registration.getObjectLinks()) { | ||
304 | - LwM2mPath pathIds = new LwM2mPath(url.getUrl()); | ||
305 | - if (pathIds.isObjectInstance() && !pathIds.isResource()) { | ||
306 | - lwM2MTransportRequest.sendAllRequest(lwServer, registration, url.getUrl(), GET_TYPE_OPER_READ, ContentFormat.TLV.getName(), | ||
307 | - lwM2MClient, null, null, this.context.getCtxServer().getTimeout(), false); | ||
308 | - } | 298 | + if (this.context.getCtxServer().isClientUpdateValueAfterConnect()) { |
299 | + lwM2MClient.getPendingRequests().addAll(clientInstances); | ||
300 | + } else { | ||
301 | + // #1.2 | ||
302 | + UUID profileUUid = lwM2mInMemorySecurityStore.getSessions().get(registration.getId()).getProfileUuid(); | ||
303 | + JsonArray observeValue = lwM2mInMemorySecurityStore.getProfiles().get(profileUUid).getPostObserveProfile(); | ||
304 | + observeValue.forEach(path -> { | ||
305 | + String[] resPath = path.getAsString().split("/"); | ||
306 | + String instance = "/" + resPath[1] + "/" + resPath[2]; | ||
307 | + if (clientInstances.contains(instance)) { | ||
308 | + lwM2MClient.getPendingRequests().add(path.getAsString()); | ||
309 | + } | ||
310 | + } | ||
311 | + ); | ||
309 | } | 312 | } |
310 | 313 | ||
311 | - // #1 | ||
312 | - Arrays.stream(registration.getObjectLinks()).forEach(url -> { | ||
313 | - LwM2mPath pathIds = new LwM2mPath(url.getUrl()); | ||
314 | - if (pathIds.isObjectInstance() && !pathIds.isResource()) { | ||
315 | - lwM2MClient.getPendingRequests().add(url.getUrl()); | ||
316 | - } | ||
317 | - }); | ||
318 | - | ||
319 | // #2 | 314 | // #2 |
320 | - Arrays.stream(registration.getObjectLinks()).forEach(url -> { | ||
321 | - LwM2mPath pathIds = new LwM2mPath(url.getUrl()); | ||
322 | - if (pathIds.isObjectInstance() && !pathIds.isResource()) { | ||
323 | - lwM2MTransportRequest.sendAllRequest(lwServer, registration, url.getUrl(), GET_TYPE_OPER_READ, ContentFormat.TLV.getName(), | ||
324 | - lwM2MClient, null, null, this.context.getCtxServer().getTimeout(), false); | ||
325 | - } | 315 | + lwM2MClient.getPendingRequests().forEach(path -> { |
316 | + lwM2MTransportRequest.sendAllRequest(lwServer, registration, path, GET_TYPE_OPER_READ, ContentFormat.TLV.getName(), | ||
317 | + lwM2MClient, null, null, this.context.getCtxServer().getTimeout(), false); | ||
326 | }); | 318 | }); |
327 | } | 319 | } |
328 | 320 | ||
@@ -704,28 +696,21 @@ public class LwM2MTransportServiceImpl implements LwM2MTransportService { | @@ -704,28 +696,21 @@ public class LwM2MTransportServiceImpl implements LwM2MTransportService { | ||
704 | * @param values - LwM2mSingleResource response.getContent() | 696 | * @param values - LwM2mSingleResource response.getContent() |
705 | * @param path - resource | 697 | * @param path - resource |
706 | */ | 698 | */ |
707 | - private void onObservationSetResourcesValue(Registration registration, Object value, Map<Integer, ?> values, String path) { | 699 | + private void onObservationSetResourcesValue(Registration registration, Object value, Map<Integer, ?> values, String path) { |
708 | boolean isChange = false; | 700 | boolean isChange = false; |
709 | try { | 701 | try { |
710 | writeLock.lock(); | 702 | writeLock.lock(); |
711 | // #1 | 703 | // #1 |
712 | LwM2MClient lwM2MClient = lwM2mInMemorySecurityStore.getLwM2MClientWithReg(registration, null); | 704 | LwM2MClient lwM2MClient = lwM2mInMemorySecurityStore.getLwM2MClientWithReg(registration, null); |
713 | LwM2mPath pathIds = new LwM2mPath(path); | 705 | LwM2mPath pathIds = new LwM2mPath(path); |
714 | -// log.warn("#0 nameDevice: [{}] resultIds: [{}] value: [{}], values: [{}] ", lwM2MClient.getDeviceName(), pathIds, value, values); | ||
715 | ResourceModel.Type resModelType = context.getCtxServer().getResourceModelType(registration, pathIds); | 706 | ResourceModel.Type resModelType = context.getCtxServer().getResourceModelType(registration, pathIds); |
716 | ResourceValue resValueOld = lwM2MClient.getResources().get(path); | 707 | ResourceValue resValueOld = lwM2MClient.getResources().get(path); |
717 | // #2 | 708 | // #2 |
718 | if (resValueOld.isMultiInstances() && !values.toString().equals(resValueOld.getResourceValue().toString())) { | 709 | if (resValueOld.isMultiInstances() && !values.toString().equals(resValueOld.getResourceValue().toString())) { |
719 | lwM2MClient.getResources().get(path).setValues(values); | 710 | lwM2MClient.getResources().get(path).setValues(values); |
720 | -// ResourceValue resourceValue = new ResourceValue(values, null, true); | ||
721 | -// lwM2MClient.getResources().put(path, resourceValue); | ||
722 | isChange = true; | 711 | isChange = true; |
723 | } else if (!LwM2MTransportHandler.equalsResourceValue(resValueOld.getValue(), value, resModelType, pathIds)) { | 712 | } else if (!LwM2MTransportHandler.equalsResourceValue(resValueOld.getValue(), value, resModelType, pathIds)) { |
724 | lwM2MClient.getResources().get(path).setValue(value); | 713 | lwM2MClient.getResources().get(path).setValue(value); |
725 | -// ResourceValue resourceValueOld = lwM2MClient.getResources().get(path); | ||
726 | -// lwM2MClient.getResources().remove(resourceValueOld); | ||
727 | -// ResourceValue resourceValue = new ResourceValue(null, value, false); | ||
728 | -// lwM2MClient.getResources().put(path, resourceValue); | ||
729 | log.warn("upDateResize: [{}] [{}] [{}] [{}]", lwM2MClient.getEndPoint(), lwM2MClient.getResources().size(), value, path); | 714 | log.warn("upDateResize: [{}] [{}] [{}] [{}]", lwM2MClient.getEndPoint(), lwM2MClient.getResources().size(), value, path); |
730 | isChange = true; | 715 | isChange = true; |
731 | } | 716 | } |
@@ -17,10 +17,11 @@ package org.thingsboard.server.transport.lwm2m.server.client; | @@ -17,10 +17,11 @@ package org.thingsboard.server.transport.lwm2m.server.client; | ||
17 | 17 | ||
18 | import lombok.Data; | 18 | import lombok.Data; |
19 | import lombok.extern.slf4j.Slf4j; | 19 | import lombok.extern.slf4j.Slf4j; |
20 | -import org.eclipse.leshan.core.model.ObjectModel; | ||
21 | import org.eclipse.leshan.core.node.LwM2mMultipleResource; | 20 | import org.eclipse.leshan.core.node.LwM2mMultipleResource; |
22 | import org.eclipse.leshan.core.node.LwM2mObjectInstance; | 21 | import org.eclipse.leshan.core.node.LwM2mObjectInstance; |
23 | import org.eclipse.leshan.core.node.LwM2mPath; | 22 | import org.eclipse.leshan.core.node.LwM2mPath; |
23 | +import org.eclipse.leshan.core.node.LwM2mResource; | ||
24 | +import org.eclipse.leshan.core.node.LwM2mSingleResource; | ||
24 | import org.eclipse.leshan.core.response.LwM2mResponse; | 25 | import org.eclipse.leshan.core.response.LwM2mResponse; |
25 | import org.eclipse.leshan.core.response.ReadResponse; | 26 | import org.eclipse.leshan.core.response.ReadResponse; |
26 | import org.eclipse.leshan.server.californium.LeshanServer; | 27 | import org.eclipse.leshan.server.californium.LeshanServer; |
@@ -35,7 +36,6 @@ import java.util.Map; | @@ -35,7 +36,6 @@ import java.util.Map; | ||
35 | import java.util.Set; | 36 | import java.util.Set; |
36 | import java.util.UUID; | 37 | import java.util.UUID; |
37 | import java.util.concurrent.ConcurrentHashMap; | 38 | import java.util.concurrent.ConcurrentHashMap; |
38 | -import java.util.stream.Collectors; | ||
39 | 39 | ||
40 | @Slf4j | 40 | @Slf4j |
41 | @Data | 41 | @Data |
@@ -44,7 +44,7 @@ public class LwM2MClient implements Cloneable { | @@ -44,7 +44,7 @@ public class LwM2MClient implements Cloneable { | ||
44 | private String deviceProfileName; | 44 | private String deviceProfileName; |
45 | private String endPoint; | 45 | private String endPoint; |
46 | private String identity; | 46 | private String identity; |
47 | - private SecurityInfo info; | 47 | + private SecurityInfo securityInfo; |
48 | private UUID deviceUuid; | 48 | private UUID deviceUuid; |
49 | private UUID sessionUuid; | 49 | private UUID sessionUuid; |
50 | private UUID profileUuid; | 50 | private UUID profileUuid; |
@@ -59,15 +59,16 @@ public class LwM2MClient implements Cloneable { | @@ -59,15 +59,16 @@ public class LwM2MClient implements Cloneable { | ||
59 | private Set<Integer> delayedRequestsId; | 59 | private Set<Integer> delayedRequestsId; |
60 | private Map<String, LwM2mResponse> responses; | 60 | private Map<String, LwM2mResponse> responses; |
61 | private final LwM2mValueConverterImpl converter; | 61 | private final LwM2mValueConverterImpl converter; |
62 | + private boolean clientUpdateValueAfterConnect; | ||
62 | 63 | ||
63 | public Object clone() throws CloneNotSupportedException { | 64 | public Object clone() throws CloneNotSupportedException { |
64 | return super.clone(); | 65 | return super.clone(); |
65 | } | 66 | } |
66 | 67 | ||
67 | - public LwM2MClient(String endPoint, String identity, SecurityInfo info, ValidateDeviceCredentialsResponseMsg credentialsResponse, UUID profileUuid) { | 68 | + public LwM2MClient(String endPoint, String identity, SecurityInfo securityInfo, ValidateDeviceCredentialsResponseMsg credentialsResponse, UUID profileUuid) { |
68 | this.endPoint = endPoint; | 69 | this.endPoint = endPoint; |
69 | this.identity = identity; | 70 | this.identity = identity; |
70 | - this.info = info; | 71 | + this.securityInfo = securityInfo; |
71 | this.credentialsResponse = credentialsResponse; | 72 | this.credentialsResponse = credentialsResponse; |
72 | this.attributes = new ConcurrentHashMap<>(); | 73 | this.attributes = new ConcurrentHashMap<>(); |
73 | this.pendingRequests = ConcurrentHashMap.newKeySet(); | 74 | this.pendingRequests = ConcurrentHashMap.newKeySet(); |
@@ -98,28 +99,33 @@ public class LwM2MClient implements Cloneable { | @@ -98,28 +99,33 @@ public class LwM2MClient implements Cloneable { | ||
98 | } | 99 | } |
99 | 100 | ||
100 | private void initValue() { | 101 | private void initValue() { |
101 | - this.responses.forEach((key, resp) -> { | 102 | + this.responses.forEach((key, lwM2mResponse) -> { |
102 | LwM2mPath pathIds = new LwM2mPath(key); | 103 | LwM2mPath pathIds = new LwM2mPath(key); |
103 | - if (pathIds.isObject() || pathIds.isObjectInstance() || pathIds.isResource()) { | ||
104 | - ObjectModel objectModel = this.lwServer.getModelProvider().getObjectModel(registration).getObjectModels().stream().filter(v -> v.id == pathIds.getObjectId()).collect(Collectors.toList()).get(0); | ||
105 | - if (objectModel != null) { | ||
106 | - ((LwM2mObjectInstance)((ReadResponse)resp).getContent()).getResources().forEach((k, v) -> { | ||
107 | - String rez = pathIds.toString() + "/" + k; | ||
108 | - if (((LwM2mObjectInstance) ((ReadResponse) resp).getContent()).getResource(k) instanceof LwM2mMultipleResource){ | ||
109 | - this.resources.put(rez, new ResourceValue(v.getValues(), null, true)); | ||
110 | - } | ||
111 | - else { | ||
112 | - this.resources.put(rez, new ResourceValue(null, v.getValue(), false)); | ||
113 | - } | ||
114 | - }); | ||
115 | - } | 104 | + if (pathIds.isObjectInstance()) { |
105 | + ((LwM2mObjectInstance) ((ReadResponse) lwM2mResponse).getContent()).getResources().forEach((k, v) -> { | ||
106 | + String pathRez = pathIds.toString() + "/" + k; | ||
107 | + this.updateResourceValue(pathRez, v); | ||
108 | + }); | ||
109 | + } | ||
110 | + else if (pathIds.isResource()) { | ||
111 | + this.updateResourceValue(pathIds.toString(), ((LwM2mResource) ((ReadResponse) lwM2mResponse).getContent())); | ||
116 | } | 112 | } |
117 | }); | 113 | }); |
118 | if (this.responses.size() == 0) this.responses = new ConcurrentHashMap<>(); | 114 | if (this.responses.size() == 0) this.responses = new ConcurrentHashMap<>(); |
119 | } | 115 | } |
120 | 116 | ||
117 | + private void updateResourceValue(String pathRez, LwM2mResource rez) { | ||
118 | + if (rez instanceof LwM2mMultipleResource){ | ||
119 | + this.resources.put(pathRez, new ResourceValue(rez.getValues(), null, true)); | ||
120 | + } | ||
121 | + else if (rez instanceof LwM2mSingleResource) { | ||
122 | + this.resources.put(pathRez, new ResourceValue(null, rez.getValue(), false)); | ||
123 | + } | ||
124 | + } | ||
125 | + | ||
121 | /** | 126 | /** |
122 | * if path != null | 127 | * if path != null |
128 | + * | ||
123 | * @param path | 129 | * @param path |
124 | */ | 130 | */ |
125 | public void onSuccessOrErrorDelayedRequests(String path) { | 131 | public void onSuccessOrErrorDelayedRequests(String path) { |
@@ -77,7 +77,7 @@ public class LwM2mInMemorySecurityStore extends InMemorySecurityStore { | @@ -77,7 +77,7 @@ public class LwM2mInMemorySecurityStore extends InMemorySecurityStore { | ||
77 | try { | 77 | try { |
78 | String registrationId = this.getByRegistrationId(endPoint, null); | 78 | String registrationId = this.getByRegistrationId(endPoint, null); |
79 | return (registrationId != null && sessions.size() > 0 && sessions.get(registrationId) != null) ? | 79 | return (registrationId != null && sessions.size() > 0 && sessions.get(registrationId) != null) ? |
80 | - sessions.get(registrationId).getInfo() : this.addLwM2MClientToSession(endPoint); | 80 | + sessions.get(registrationId).getSecurityInfo() : this.addLwM2MClientToSession(endPoint); |
81 | } finally { | 81 | } finally { |
82 | readLock.unlock(); | 82 | readLock.unlock(); |
83 | } | 83 | } |
@@ -93,7 +93,7 @@ public class LwM2mInMemorySecurityStore extends InMemorySecurityStore { | @@ -93,7 +93,7 @@ public class LwM2mInMemorySecurityStore extends InMemorySecurityStore { | ||
93 | readLock.lock(); | 93 | readLock.lock(); |
94 | try { | 94 | try { |
95 | String integrationId = this.getByRegistrationId(null, identity); | 95 | String integrationId = this.getByRegistrationId(null, identity); |
96 | - return (integrationId != null) ? sessions.get(integrationId).getInfo() : this.addLwM2MClientToSession(identity); | 96 | + return (integrationId != null) ? sessions.get(integrationId).getSecurityInfo() : this.addLwM2MClientToSession(identity); |
97 | } finally { | 97 | } finally { |
98 | readLock.unlock(); | 98 | readLock.unlock(); |
99 | } | 99 | } |
@@ -103,7 +103,7 @@ public class LwM2mInMemorySecurityStore extends InMemorySecurityStore { | @@ -103,7 +103,7 @@ public class LwM2mInMemorySecurityStore extends InMemorySecurityStore { | ||
103 | public Collection<SecurityInfo> getAll() { | 103 | public Collection<SecurityInfo> getAll() { |
104 | readLock.lock(); | 104 | readLock.lock(); |
105 | try { | 105 | try { |
106 | - return Collections.unmodifiableCollection(this.sessions.values().stream().map(LwM2MClient::getInfo).collect(Collectors.toList())); | 106 | + return Collections.unmodifiableCollection(this.sessions.values().stream().map(LwM2MClient::getSecurityInfo).collect(Collectors.toList())); |
107 | } finally { | 107 | } finally { |
108 | readLock.unlock(); | 108 | readLock.unlock(); |
109 | } | 109 | } |
@@ -119,7 +119,7 @@ public class LwM2mInMemorySecurityStore extends InMemorySecurityStore { | @@ -119,7 +119,7 @@ public class LwM2mInMemorySecurityStore extends InMemorySecurityStore { | ||
119 | LwM2MClient lwM2MClient = (sessions.get(registrationId) != null) ? sessions.get(registrationId) : null; | 119 | LwM2MClient lwM2MClient = (sessions.get(registrationId) != null) ? sessions.get(registrationId) : null; |
120 | if (lwM2MClient != null) { | 120 | if (lwM2MClient != null) { |
121 | if (listener != null) { | 121 | if (listener != null) { |
122 | - listener.securityInfoRemoved(INFOS_ARE_COMPROMISED, lwM2MClient.getInfo()); | 122 | + listener.securityInfoRemoved(INFOS_ARE_COMPROMISED, lwM2MClient.getSecurityInfo()); |
123 | } | 123 | } |
124 | sessions.remove(registrationId); | 124 | sessions.remove(registrationId); |
125 | } | 125 | } |
@@ -119,6 +119,10 @@ public class LwM2MTransportConfigServer { | @@ -119,6 +119,10 @@ public class LwM2MTransportConfigServer { | ||
119 | private int registeredPoolSize; | 119 | private int registeredPoolSize; |
120 | 120 | ||
121 | @Getter | 121 | @Getter |
122 | + @Value("${transport.lwm2m.client_update_value_after_connect:}") | ||
123 | + private boolean clientUpdateValueAfterConnect; | ||
124 | + | ||
125 | + @Getter | ||
122 | @Value("${transport.lwm2m.update_registered_pool_size:}") | 126 | @Value("${transport.lwm2m.update_registered_pool_size:}") |
123 | private int updateRegisteredPoolSize; | 127 | private int updateRegisteredPoolSize; |
124 | 128 |