Class ConfigSerialNumberProvider
java.lang.Object
com.tccc.kos.commons.util.ready.ReadyBean
com.tccc.kos.commons.core.service.config.AbstractConfigurable<ConfigSerialNumberProviderConfig>
com.tccc.kos.core.service.device.serialnum.config.ConfigSerialNumberProvider
- All Implemented Interfaces:
ConfigAware<ConfigSerialNumberProviderConfig>,ContextHandleAware,HandleAware,Ready,ReadyAndReadyListener,ReadyListener,SerialNumberProvider
public class ConfigSerialNumberProvider
extends AbstractConfigurable<ConfigSerialNumberProviderConfig>
implements SerialNumberProvider, ContextHandleAware
A
SerialNumberProvider implementation that uses a
config property to hold the serial number. This should not
be used for production systems as swapping the board will
result in loss of the serial number. Considering using
CriticalDataSerialNumberProvider in conjunction with
CriticalData for a more robust solution to storing
a serial number that can be recovered in the event of a
board swap.
This implementation is useful for testing and allows the
serial number api to be used without anything other than
creating this instance, registering it with the Device
and adding it to the BeanContext.
- Version:
- 2024-10-29
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the prefix for the object to be used when the handle is allocated by the context.Return the serial number of the device.voidsetSerialNumber(String serialNumber) Set the serial number of the device.Methods inherited from class com.tccc.kos.commons.core.service.config.AbstractConfigurable
getConfig, getHandle, setConfigMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.tccc.kos.commons.core.service.config.ConfigAware
onConfigChanged, onConfigSetMethods inherited from interface com.tccc.kos.commons.core.service.handle.HandleAware
addHandleChild, getHandle, getName, getPathMethods inherited from interface com.tccc.kos.commons.util.ready.ReadyAndReadyListener
onBeanReady, onDependenciesReadyMethods inherited from interface com.tccc.kos.commons.util.ready.ReadyListener
onDependenciesGroupReady
-
Constructor Details
-
ConfigSerialNumberProvider
public ConfigSerialNumberProvider()
-
-
Method Details
-
getSerialNumber
Description copied from interface:SerialNumberProviderReturn the serial number of the device.- Specified by:
getSerialNumberin interfaceSerialNumberProvider- Throws:
Exception
-
setSerialNumber
Description copied from interface:SerialNumberProviderSet the serial number of the device.- Specified by:
setSerialNumberin interfaceSerialNumberProvider- Parameters:
serialNumber- the new device serial number- Throws:
Exception
-
getHandlePrefix
Description copied from interface:ContextHandleAwareReturns the prefix for the object to be used when the handle is allocated by the context. The prefix typically reflects the type of the object, such that two objects with the same name but different types are uniquely identified. This value should be the name of the getter if this object was to be fetched from a parent object. For example, if class was Pump there may be two instances: water and carb. The prefix for the water pump may be "water" while the prefix for carb may be "carb", as this distinguishes them. In cases where there is a single getter, it's not uncommon for the prefix to be the type of the object or null. The default implementation returns null.- Specified by:
getHandlePrefixin interfaceContextHandleAware
-