Conversation
# Conflicts: # pom.xml # src/main/java/com/yetanalytics/hlaxapi/HlaInterfaceImpl.java # src/main/java/com/yetanalytics/hlaxapi/InjectionHandler.java
…e_sync # Conflicts: # src/main/java/com/yetanalytics/hlaxapi/HlaInterfaceImpl.java # src/main/java/com/yetanalytics/hlaxapi/InjectionHandler.java # src/test/java/com/yetanalytics/ConfigParserTest.java
Sql cache sync
cliffcaseyyet
left a comment
There was a problem hiding this comment.
Overall totally makes sense so far. Biggest note (you can probably predict) is we should have a session on DI, as there is a lot here that could just be wired easily to go along with everything else, as most of these new services are effectively singletons.
| String formatString = (replacement instanceof String && embedded) ? "\"%s\"" : "%s"; | ||
| return String.format(formatString, replacement.toString()); | ||
| private JsonNode render(Object replacement, Boolean embedded, ObjectMapper mapper) { | ||
| if (Boolean.TRUE.equals(embedded)) { |
There was a problem hiding this comment.
Huh, I was prepared to write how this removed something important, then i tested it, and apparently valueToTree is doing a lot that I wasn't considering. Quotes handling is perfect with no mess.
| @Autowired | ||
| private HLADecoderRegistry hlaDecoderRegistry; | ||
|
|
||
| public void setQueryService(CacheQueryService cacheQueryService) { |
There was a problem hiding this comment.
I am going to guess there was a reason this wasn't done with DI? There's a lot of code that doesn't need to be here otherwise.
If the issue is just that it needs to be specially initialized first we can figure that out.
There was a problem hiding this comment.
I think it may predate DI being in the project! I'll get it wired up
|
|
||
| // Use injected HLADecoderRegistry when available; fall back to creating one | ||
| // decoderRegistry.registerAlias("ScaleFactorFloat32", "HLAfloat32BE"); | ||
| fomCatalog = FomCatalog.fromFomXml(fomXml); |
There was a problem hiding this comment.
Strong indicator for a component.
| if (objectCacheSubscriptions.isEmpty()) { | ||
| injectionHandler.setQueryService(null); | ||
| logger.info("No query injections configured; object cache is disabled"); | ||
| } else { | ||
| objectCache = new HlaObjectCache(HlaObjectCache.defaultJdbcUrl(), fomCatalog, fomXml, decoderRegistry); | ||
| injectionHandler.setQueryService(objectCache.queryService()); | ||
| } |
There was a problem hiding this comment.
this can all be bootstrapped and sorted out in config and used to make ObjectCache component, and that just wired into here.
Cache simulation object state in a SQLite db. This approach attempts to "flatten" object attributes into an EAV index with some success.