T
- The new PersistentRecord
implementation that will now back your Driver
's settings.public abstract class LegacyDeviceConfigConverter<T extends PersistentRecord>
extends java.lang.Object
PersistentRecord
-based configuration
API.
An example implementation might be:
public class LegacyModbusTcpConverter extends LegacyDeviceConfigConverter{ public LegacyModbusTcpConverter(GatewayContext context) { super(context); }
Constructor and Description |
---|
LegacyDeviceConfigConverter(GatewayContext context) |
Modifier and Type | Method and Description |
---|---|
void |
convert() |
protected abstract void |
convertLegacyProperty(DriverPropertyRecord legacyProperty,
T driverSettings)
Interpret which property on your new driver settings record is represented by this record using
DriverPropertyRecord.getPropertyKey() . |
abstract java.lang.String |
getDriverClassName() |
protected abstract java.lang.String |
getDriverTypeId()
The type id of the
DriverType implementation for this driver type. |
protected LoggerEx |
getLog() |
protected abstract RecordMeta<T> |
getRecordMeta() |
protected abstract ReferenceField<DeviceSettingsRecord> |
getReferenceField() |
public LegacyDeviceConfigConverter(GatewayContext context)
public void convert()
protected LoggerEx getLog()
public abstract java.lang.String getDriverClassName()
protected abstract java.lang.String getDriverTypeId()
DriverType
implementation for this driver type. Ultimately, the same thing returned by
BaseExtensionPointType.getTypeId()
and the same type id passed to the DriverType
constructor.DriverType
implementation for this driver type.protected abstract void convertLegacyProperty(DriverPropertyRecord legacyProperty, T driverSettings)
DriverPropertyRecord.getPropertyKey()
. Set the legacy value, DriverPropertyRecord.getPropertyValue()
on
your new settings record, using DriverPropertyRecord.getPropertyType()
to determine the type, if
necessary.
If your old property was of type DriverPropertyType.Blob
, use
DriverPropertyRecord.getPropertyValueBlob()
to retrieve the value instead.protected abstract RecordMeta<T> getRecordMeta()
RecordMeta
of your new driver settings record.protected abstract ReferenceField<DeviceSettingsRecord> getReferenceField()
ReferenceField
in your settings record that points to the parent
DeviceSettingsRecord
.