You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by GitBox <gi...@apache.org> on 2018/11/23 10:20:44 UTC
[GitHub] JulianFeinauer commented on a change in pull request #40: Alias
registry for opm
JulianFeinauer commented on a change in pull request #40: Alias registry for opm
URL: https://github.com/apache/incubator-plc4x/pull/40#discussion_r235896787
##########
File path: plc4j/utils/opm/src/main/java/org/apache/plc4x/java/opm/PlcEntityInterceptor.java
##########
@@ -154,19 +163,25 @@ static void refetchAllFields(Object proxy, PlcDriverManager driverManager, Strin
Arrays.stream(entityClass.getDeclaredFields())
.filter(field -> field.isAnnotationPresent(PlcField.class))
+ .filter(field -> needsToBeFetched(lastFetched, field))
.forEach(field ->
requestBuilder.addItem(
- field.getDeclaringClass().getName() + "." + field.getName(),
- field.getAnnotation(PlcField.class).value()
+ getFqn(field),
+ OpmUtils.getOrResolveAddress(registry, field.getAnnotation(PlcField.class).value())
)
);
PlcReadRequest request = requestBuilder.build();
+ LOGGER.trace("Request for refetch of " + entityClass + " was build and is " + request.toString());
+
PlcReadResponse response = getPlcReadResponse(request);
// Fill all requested fields
for (String fieldName : response.getFieldNames()) {
+ // Fill into Cache
+ lastFetched.put(fieldName, Instant.now());
Review comment:
@sruehl I think we are not allowed to do that.
If someone adds a mapping to the registry we cannot simply delete it as this would lead to subsequent "unknown alias" exceptions.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services