Skip to content

Commit

Permalink
chore: javadocs
Browse files Browse the repository at this point in the history
  • Loading branch information
jcosentino11 committed Jun 28, 2024
1 parent 6eb5c02 commit 3642a32
Showing 1 changed file with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
* | |---- k:v
* | |---- "l": lastUpdated
* | |---- "hostAddresses":
* |---- <source>:
* |---- [...]
* |---- <source>:
* |---- [...]
* </p>
*/
public final class RuntimeConfiguration {
Expand Down Expand Up @@ -229,12 +229,22 @@ public void removeCertificateV1(String certificateId) {
}
}

/**
* Persist thing association dto.
*
* @param dto dto
*/
public void putThingAssociationV1(ThingAssociationV1DTO dto) {
Topics t = getOrRepairTopics(config, ASSOCIATIONS_KEY, ASSOCIATIONS_V1);
t.lookup(ASSOCIATIONS_PROP_KEY).withValue(new ArrayList<>(dto.getAssociatedThingNames()));
t.lookup(LAST_UPDATED_KEY).withValue(dto.getLastUpdated().toEpochSecond(ZoneOffset.UTC));
}

/**
* Get things associated with the core device.
*
* @return dto
*/
public Optional<ThingAssociationV1DTO> getThingAssociationV1() {
Topics t = config.findTopics(ASSOCIATIONS_KEY, ASSOCIATIONS_V1);
if (t == null) {
Expand All @@ -256,13 +266,24 @@ public Optional<ThingAssociationV1DTO> getThingAssociationV1() {
return Optional.of(new ThingAssociationV1DTO(thingNames, lastFetched));
}

/**
* Persist thing description dto.
*
* @param dto dto
*/
public void putThingDescriptionV1(ThingDescriptionV1DTO dto) {
Topics t = getOrRepairTopics(config, DESCRIPTION_KEY, DESCRIPTION_V1, dto.getThingName());
t.lookup(LAST_UPDATED_KEY).withValue(dto.getLastUpdated().toEpochSecond(ZoneOffset.UTC));
Map<String, Object> attrs = new HashMap<>(dto.getAttributes());
getOrRepairTopics(t, ATTRIBUTES_PROP_KEY).replaceAndWait(attrs);
}

/**
* Get cached IoT describe-thing response. Currently, we only care about the attributes field.
*
* @param thingName thing name
* @return dto
*/
public Optional<ThingDescriptionV1DTO> getThingDescriptionV1(String thingName) {
Topics t = config.findTopics(DESCRIPTION_KEY, DESCRIPTION_V1, thingName);
if (t == null) {
Expand Down Expand Up @@ -340,8 +361,8 @@ public Stream<CertificateV1DTO> getAllCertificatesV1() {
/**
* Put hostAddresses config.
*
* @param source connectivity information source
* @param hostAddresses host addresses
* @param source connectivity information source
* @param hostAddresses host addresses
*/
public void putHostAddressForSource(String source, Set<HostAddress> hostAddresses) {
config.lookup(HOST_ADDRESSES_KEY, source)
Expand Down

0 comments on commit 3642a32

Please sign in to comment.