At the moment this class is hard coded for each different protocol but in future when the device contains a lot more protocol specific policy values this class should be used to contain information about the protocol configuration for each device.
There will have to be specialisations of this for each family of protocols as not all of the device values will apply to all of the protocol families and those that don't should be ignored.
Although there will be one instance of this for each device references to this cannot be stored in the InternalDevice object itself as that belongs in a different package. There are a couple of ways of handling this, one is to have a RuntimeDevice which extends (or wraps InternalDevice) and which can contain a reference to an instance of this, another is to add a mechanism to store arbitrary information in a InternalDevice object and yet another is to maintain a separate table which maps from device name to instances of this class.
Creating an instance of this should be done by ProtocolConfigurator classes. There should be one instance per protocol family which knows about the information which applies just to that family and a general instance which knows about common information.
When a ProtocolConfiguration class is needed for a particular device and does not yet exist then the right instance of the ProtocolConfigurator class would be selected. It would then be passed the InternalDevice and would return an instance of the specialisation of the ProtocolConfiguration class for the particular family.
Selecting the correct instance of the ProtocolConfigurator could simply be done by asking the protocol as a single instance of every protocol has already been created.
The retrieval of the ProtocolConfiguration class should be done by the protocol as part of its initialisation. It should not be done in the constructor as that is only ever called once as all the other instances are cloned.
Over time those fields in the protocols which control the protocol behaviour should be moved out of the protocol and into the correct specialisation of this class. The reason for this are two fold. Firstly, most of those fields are fixed for every instance of the protocol and so having it in the protocol wastes a little space and time (for cloning). Secondly, as we do more and more testing we may find that those fields are device dependent and having them here makes it so much easier to add them to the device and will not impact the protocols at all.
This class should not contain any properties which are specific to a particular protocol family, it should only contain general properties which apply across all families.
@mock.generate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|