-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#247 : send register response before to fire events
- Loading branch information
1 parent
b4b4c4e
commit 4a1af01
Showing
4 changed files
with
157 additions
and
32 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
...-cf/src/main/java/org/eclipse/leshan/server/californium/impl/ExchangeObserverAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2017 Sierra Wireless and others. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Eclipse Distribution License v1.0 which accompany this distribution. | ||
* | ||
* The Eclipse Public License is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* and the Eclipse Distribution License is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.html. | ||
* | ||
* Contributors: | ||
* Sierra Wireless - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.leshan.server.californium.impl; | ||
|
||
import org.eclipse.californium.core.network.Exchange; | ||
import org.eclipse.californium.core.network.ExchangeObserver; | ||
|
||
/** | ||
* An abstract adapter class for reacting to exchange events. The methods in this class are empty. This class exists as | ||
* convenience for creating exchange observer objects. | ||
*/ | ||
// TODO should be part of californium ? | ||
public class ExchangeObserverAdapter implements ExchangeObserver { | ||
|
||
@Override | ||
public void completed(Exchange exchange) { | ||
} | ||
|
||
@Override | ||
public void contextEstablished(Exchange exchange) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
leshan-server-core/src/main/java/org/eclipse/leshan/server/impl/SendableResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2017 Sierra Wireless and others. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Eclipse Distribution License v1.0 which accompany this distribution. | ||
* | ||
* The Eclipse Public License is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* and the Eclipse Distribution License is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.html. | ||
* | ||
* Contributors: | ||
* Sierra Wireless - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.leshan.server.impl; | ||
|
||
import org.eclipse.leshan.core.response.LwM2mResponse; | ||
|
||
/** | ||
* A Response wrapper which can be notify when the response is sent | ||
*/ | ||
public class SendableResponse<T extends LwM2mResponse> { | ||
|
||
private T response; | ||
private Runnable sendedCallback; | ||
|
||
public SendableResponse(T response) { | ||
this(response, null); | ||
} | ||
|
||
public SendableResponse(T response, Runnable sendedCallback) { | ||
this.response = response; | ||
this.sendedCallback = sendedCallback; | ||
} | ||
|
||
public T getResponse() { | ||
return response; | ||
} | ||
|
||
public void sended() { | ||
if (sendedCallback != null) | ||
sendedCallback.run(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters