Closed juan-castrillon closed 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).
The last commit is implementing the latest idea:
@juan-castrillon That looks like a good idea, go on with the rest.
In the last commits:
PlatformObject
and for their inputs and outputs (and all other elements) to implement itPlatformObject
implementationNetworkModule
with a String as a shared resource (to be changed later to what it needs to be shared). This includes the local object, and the access interface
Based on the discussion, this is the first attempt to refactor the resource sharing in modules.
So far:
ImmutablePlatformModule
is now an interfaceGlobalVarAccessPlatformModule
interface to represent limited access (only access to the global variables)PlatformObject
, added a method to get the owner module with global variable accessModuleShareResource
interface, which the different shared objects in the modules will implementglobalVariables
map that relates a name to aModuleSharedResource
RemoteExecutionModule
to work with the new functionalities and tests it still worksThe biggest issue is that is order to have a
ModuleShareResource
interface (or even to have aGlobalVarAccessPlatformModule
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 theGlobalVarAccessPlatformModule
interface generic but then, each module should implement it separately (the abstractPlatformModule
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