EdgeLab-FHDO / Edge-Diagnostic-Platform

MIT License
0 stars 2 forks source link

Hot fix shared resources #91

Closed juan-castrillon closed 3 years ago

juan-castrillon commented 3 years ago

Based on the discussion, this is the first attempt to refactor the resource sharing in modules.

So far:

The biggest issue is that is order to have a ModuleShareResource interface (or even to have a GlobalVarAccessPlatformModule interface) the shared resources have to be abstracted somehow. So in this first iteration, a shared resource is characterized by having a method to modify it (which recieves data as Strings). I realize that is very general (and may be wrong) but the alternative would be to use generics, and either making everything generic (PlatformModule generic) or just making the GlobalVarAccessPlatformModule interface generic but then, each module should implement it separately (the abstract PlatformModule could not implement it, not knowing the type of the shared resource).

Have a look at the code, and let me know what you think @alyhasansakr

alyhasansakr commented 3 years ago

@juan-castrillon Why not have a module specific object class (NetworkObject for example) which extends PlatformObject. This way you can implement global access functions directly on each module specific object class (no need for GlobalVarAccessPlatformModule interface or similar).

juan-castrillon commented 3 years ago

The last commit is implementing the latest idea:

alyhasansakr commented 3 years ago

@juan-castrillon That looks like a good idea, go on with the rest.

juan-castrillon commented 3 years ago

In the last commits: