Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SDK DMF Support - from declarative to imperative - to support host pe…
…r tenant (#1709) Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
- Loading branch information
1 parent
c8220c4
commit b491d6d
Showing
14 changed files
with
351 additions
and
442 deletions.
There are no files selected for viewing
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
56 changes: 56 additions & 0 deletions
56
hawkbit-sdk/hawkbit-sdk-device/src/main/java/org/eclipse/hawkbit/sdk/device/DdiTenant.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,56 @@ | ||
/** | ||
* Copyright (c) 2024 Contributors to the Eclipse Foundation | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.eclipse.hawkbit.sdk.device; | ||
|
||
import lombok.Getter; | ||
import org.eclipse.hawkbit.sdk.Controller; | ||
import org.eclipse.hawkbit.sdk.HawkbitClient; | ||
import org.eclipse.hawkbit.sdk.Tenant; | ||
|
||
import java.util.Map; | ||
import java.util.Optional; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
|
||
/** | ||
* An in-memory simulated DMF Tenant to hold the controller twins in | ||
* memory and be able to retrieve them again. | ||
*/ | ||
public class DdiTenant { | ||
|
||
@Getter | ||
private final Tenant tenant; | ||
|
||
private final Map<String, DdiController> controllers = new ConcurrentHashMap<>(); | ||
private final HawkbitClient hawkbitClient; | ||
|
||
public DdiTenant(final Tenant tenant, final HawkbitClient hawkbitClient) { | ||
this.tenant = tenant; | ||
this.hawkbitClient = hawkbitClient; | ||
} | ||
|
||
public void destroy() { | ||
controllers.values().forEach(DdiController::stop); | ||
controllers.clear(); | ||
} | ||
|
||
public DdiController create(final Controller controller, final UpdateHandler updateHandler) { | ||
final DdiController ddiController = new DdiController(tenant, controller, updateHandler, hawkbitClient); | ||
controllers.put(controller.getControllerId(), ddiController); | ||
return ddiController; | ||
} | ||
|
||
public void remove(final String controllerId) { | ||
Optional.ofNullable(controllers.remove(controllerId)).ifPresent(DdiController::stop); | ||
} | ||
|
||
public Optional<DdiController> getController(final String controllerId) { | ||
return Optional.ofNullable(controllers.get(controllerId)); | ||
} | ||
} |
67 changes: 0 additions & 67 deletions
67
hawkbit-sdk/hawkbit-sdk-dmf/src/main/java/org/eclipse/hawkbit/sdk/dmf/DeviceManagement.java
This file was deleted.
Oops, something went wrong.
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: 0 additions & 45 deletions
45
hawkbit-sdk/hawkbit-sdk-dmf/src/main/java/org/eclipse/hawkbit/sdk/dmf/DmfProperties.java
This file was deleted.
Oops, something went wrong.
121 changes: 0 additions & 121 deletions
121
...it-sdk/hawkbit-sdk-dmf/src/main/java/org/eclipse/hawkbit/sdk/dmf/DmfSDKConfiguration.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.