Skip to content
Merged

Dev #1195

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion software/core/oqm-core-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group 'com.ebp.openQuarterMaster'
version '4.4.4'
version '4.4.5-SNAPSHOT'

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion software/core/oqm-core-api/docs/DataModel.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Open QuarterMaster Base Station Data Models
# Open QuarterMaster Core API Data Models

[Back](README.md)

Expand Down
2 changes: 1 addition & 1 deletion software/core/oqm-core-api/docs/Features.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= OQM Base Station Features
= OQM Core API Features
:toc:
:toclevels: 5
:sectnumlevels:5
Expand Down
2 changes: 1 addition & 1 deletion software/core/oqm-core-api/docs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Open QuarterMaster Base Station Documentation
# Open QuarterMaster Core API Documentation

[Back](../README.md)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ link:README.md[Back]

=== Configuration

This is a list of relevant config values for configuring a running instance of Open QuarterMaster Base Station. These variables can be passed via environment variables.
This is a list of relevant config values for configuring a running instance of Open QuarterMaster Core API. These variables can be passed via environment variables.

For more information: https://quarkus.io/guides/config-reference

When deployed using link:../../Station-Captain[Station Captain], Base Station's config file is: `/etc/oqm/serviceConfig/core-base+station/config.list`
When deployed using link:../../Station-Captain[Station Captain], the Core API's config file is: `/etc/oqm/serviceConfig/core-api/config.list`
Comment thread
GregJohnStewart marked this conversation as resolved.

==== Service Info

Expand Down
4 changes: 2 additions & 2 deletions software/core/oqm-core-api/installerSrc/core-api-config.list
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# The Main config for Base Station. Do not edit. To adjust configuration, edit:
# /etc/oqm/serviceConfig/core/base+station/user-config.list
# The Main config for the OQM Core API. Do not edit. To adjust configuration, edit:
# /etc/oqm/serviceConfig/core/api/user-config.list
#

# Basic configs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ExecStartPre=/bin/bash -c "chmod 600 $USER_CONFIG_FILE"

# Pull image as separate task
ExecStartPre=/bin/bash -c "/usr/bin/docker pull $IMAGE_NAME:$IMAGE_VERSION || echo 'Could not pull image.'"
# Run Base Station
# Run Core API
ExecStart=/bin/bash -c "/usr/bin/docker run --rm --name $CONTAINER_NAME \
--network=oqm-internal \
-v /etc/oqm/certs/trustStores:/etc/oqm/certs/trustStores:ro \
Expand Down
2 changes: 1 addition & 1 deletion software/core/oqm-core-api/makeInstallers.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Script to make installers for OQM- Base Station.
# Script to make installers for OQM- Core API.
#
# Intended to be run from the dir this resides
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
public class CoreApiInteractingEntity extends InteractingEntity {

/**
* Don't change this. We use this very specific ObjectId to identify the Base Station's specific entry in the db.
* Don't change this. We use this very specific ObjectId to identify the Core API's specific entry in the db.
*/
public static final ObjectId BS_ID = new ObjectId("00000000AAAAAAAAAAFFFFFF");

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class Test extends EndpointProvider {
@GET
@Path("illegalArgException")
@Operation(
summary = "The currency the base station is set to operate with."
summary = "The currency the core api is set to operate with."
Comment thread
GregJohnStewart marked this conversation as resolved.
)
@APIResponse(
responseCode = "200",
Expand All @@ -42,7 +42,7 @@ public Response illegalArgException() {
@GET
@Path("illegalStateException")
@Operation(
summary = "The currency the base station is set to operate with."
summary = "The currency the core api is set to operate with."
)
@APIResponse(
responseCode = "200",
Expand All @@ -64,7 +64,7 @@ public static class TestClass {
@POST
@Path("validationException")
@Operation(
summary = "The currency the base station is set to operate with."
summary = "The currency the core api is set to operate with."
)
@APIResponse(
responseCode = "200",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
import java.text.MessageFormat;
import java.util.Optional;

/**
* A Simple splash page to show, and direct to swagger.
*/
@SuppressWarnings("LombokGetterMayBeUsed")
@Blocking
@Slf4j
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@
import java.io.IOException;

/**
* Jackson module to handle the Mongodb ObjectId in a reasonable manner (as its hex string)
* Jackson module for serializing and deserializing {@link Color} objects.
* <p>
* Colors are serialized as hex strings (e.g., "#FF5733") and deserialized from
* that same hex string format
*/
public class ColorModule extends TestableModule<Color> {

/**
* Converts a Color to its hex string representation.
*
* @param c the color to convert
* @return hex string in format "#RRGGBB"
*/
public static String toHexString(Color c){
int R = c.getRed();
int G = c.getGreen();
Expand All @@ -23,6 +32,14 @@ public static String toHexString(Color c){
String rgb = String.format("#%02X%02X%02X", R, G, B);
return rgb;
}

/**
* Parses a hex string or color name into a Color object.
*
* @param c the string to parse (hex or color name)
* @return the Color object
* @throws NumberFormatException if the string is not a valid color format
*/
public static Color toColor(String c){
return Color.decode(c);
}
Expand All @@ -35,19 +52,24 @@ public ColorModule() {
);
}

/**
* Serializer that writes Color as hex string.
*/
public static class ColorSerializer extends JsonSerializer<Color> {
@Override
public void serialize(Color c, JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeString(toHexString(c));
}
}

/**
* Deserializer that parses hex strings or color names into Color objects.
*/
public static class ColorDeserializer extends JsonDeserializer<Color> {
@Override
public Color deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
return toColor(p.getValueAsString());
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public static class ObjectIdDeserializer extends JsonDeserializer<ObjectId> {

@Override
public ObjectId deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {

return new ObjectId(p.getValueAsString());
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tech.ebp.oqm.core.api.service.notification;
package tech.ebp.oqm.core.api.model.messaging;

import lombok.*;
import org.bson.types.ObjectId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,4 @@ public static void setupObjectMapper(ObjectMapper mapper) {
//set the timezone to this server's.
mapper.setTimeZone(TimeZone.getDefault());
}

public static List<String> fieldListFromJson(ObjectNode updateJson) {
List<String> output = new ArrayList<>();

for (Iterator<Map.Entry<String, JsonNode>> it = updateJson.fields(); it.hasNext(); ) {
Map.Entry<String, JsonNode> cur = it.next();
String curKey = cur.getKey();

if (cur.getValue().isObject()) {
List<String> curSubs = fieldListFromJson((ObjectNode) cur.getValue());

for (String curSubKey : curSubs) {
output.add(curKey + "." + curSubKey);
}
} else {
output.add(curKey);
}
}

return output;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.util.Map;

/**
* Request to create an image in the Base Station service.
* Request to create an image in the Core API service.
*/
@Data
@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tech.ebp.oqm.core.api.model.rest.storage;

/**
* Used to specify which type of imaged object to get in the base station server.
* Used to specify which type of imaged object to get in the Core API server.
*/
public enum IMAGED_OBJ_TYPE_NAME {
storageBlock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@
import tech.ebp.oqm.core.api.service.serviceState.db.DbCacheEntry;
import tech.ebp.oqm.core.api.service.serviceState.db.OqmDatabaseService;

/**
* Scheduled processor for handling item expiry events.
* <p>
* Runs periodically to scan all databases for items that have expired or are approaching
* their expiry dates. For each database, it triggers expiry/warning event processing
* via {@link ItemStatsService#scanForExpired(String)}.
* </p>
* <p>
* Configuration: The execution schedule is controlled by the {@code service.item.expiryCheck.cron}
* property. Concurrent executions are skipped if one is already running.
* </p>
*/
@Slf4j
@ApplicationScoped
public class ExpiryProcessor {
Expand All @@ -19,6 +31,13 @@ public class ExpiryProcessor {
@Inject
ItemStatsService itemStatsService;

/**
* Main scheduled task that processes expiry events for all databases.
* <p>
* Iterates through all registered databases and calls the item stats service
* to scan for expired items and generate appropriate events.
* </p>
*/
@Scheduled(
identity = "searchAndProcessExpiredItems",
cron = "{service.item.expiryCheck.cron}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ void onStart(
//ensures we can write to temp dir
this.tempFileService.getTempDir("test", "dir");
// Upgrade the db schema
//TODO:: mutex lock on this, wait until done upgrading
//TODO:: create flag service to check if things initted right. Setup filter to check this flag to reject requests until setup done.
Optional<TotalUpgradeResult> schemaUpgradeResult = this.objectSchemaUpgradeService.updateSchema();
if(schemaUpgradeResult.isEmpty()){
Expand Down
Loading
Loading