Skip to content

Averager plugin: possibility to enable/disable by property and events#294

Merged
deinhofer merged 2 commits intomasterfrom
klaus/averager-possibility-to-enable-and-disable
Apr 15, 2019
Merged

Averager plugin: possibility to enable/disable by property and events#294
deinhofer merged 2 commits intomasterfrom
klaus/averager-possibility-to-enable-and-disable

Conversation

@klues
Copy link
Contributor

@klues klues commented Mar 8, 2019

For details see updated documentation included in this PR.

For an example use case see comment #291 (comment)

return oldValue;
} else if ("autoReenableTime".equalsIgnoreCase(propertyName)) {
final Object oldValue = propAutoReenableTime;
propAutoReenableTime = Integer.parseInt(newValue.toString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if newValue==null?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the property is defined as integer in the bundle descriptor, shouldn't any generic logic ensure that it is actually an integer value when arriving at this point? Otherwise, whats the point of declaring datatypes in the bundleDescriptor?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, although, semantically, "no value" (null) is not the same as 0 or could be interpreted differently. So maybe that's why you can't handle it generically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, so I should catch a NumberFormatException there? I've seen plenty plugins, where no FormatExceptions are caught at property parsing. I think any FormatExceptions in this method should be caught by default in a base plugin class, so that the creator of a plugin does not have to care about them, if he doesn't want any specific error handling.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, you are right, the generic code in the DeploymentManager should do a check, if the value is conforming to the datatype specified in the bundle descriptor. If not log exceptions and proceed with datatype-specific default values.

These are the datatypes which could be easiliy checked:
https://github.com/asterics/AsTeRICS/blob/56f59f844f2a1c038ff4807ee208127d2033298b/ARE/middleware/src/main/java/eu/asterics/mw/model/DataType.java

Let's merge this PR and see if there is enough time for a generic solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opened corresponding issue #312

* samples are summed but not divided
*/
private synchronized void process(final double in) {
if (!propEnabled && buffer.size() == propBufferSize) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need the check ... && buffer.size() == propBufferSize

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the idea was somehow to wait until the buffer is full, but it does not make much sense as it is now. I'll remove it.

@deinhofer deinhofer merged commit dcd052e into master Apr 15, 2019
@deinhofer deinhofer deleted the klaus/averager-possibility-to-enable-and-disable branch April 15, 2019 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants