Package com.seeq.link.sdk.services
Class DefaultRemoteConfigObjectProvider
java.lang.Object
com.seeq.link.sdk.services.DefaultRemoteConfigObjectProvider
- All Implemented Interfaces:
ConfigObjectProvider
,RemoteConfigChangeListener
,RemoteConfigObjectProvider
public class DefaultRemoteConfigObjectProvider
extends Object
implements RemoteConfigObjectProvider, RemoteConfigChangeListener
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
initialize
(SeeqApiProvider apiProvider, String agentName) Initializes the provider with a seeq api provider to persist config objects to.loadConfigObject
(String name, ConfigObject[] supportedConfigObjects) Loads a configuration Object from the config data store and retrieves its metadata.void
onConfigChanged
(String name) void
registerChangeCallback
(String name, Consumer<String> callback) Registers a callback for when the configuration has changed.void
saveConfigObject
(String name, Object configObject) Saves a configuration Object to the config data store.static Long
toEpochTime
(String iso8601UTCDateTime) void
Unregisters a callback previously registered.
-
Constructor Details
-
DefaultRemoteConfigObjectProvider
public DefaultRemoteConfigObjectProvider()
-
-
Method Details
-
initialize
Description copied from interface:RemoteConfigObjectProvider
Initializes the provider with a seeq api provider to persist config objects to.- Specified by:
initialize
in interfaceRemoteConfigObjectProvider
-
registerChangeCallback
Description copied from interface:RemoteConfigObjectProvider
Registers a callback for when the configuration has changed.- Specified by:
registerChangeCallback
in interfaceRemoteConfigObjectProvider
- Parameters:
name
- Name of the configuration object you're interested in.callback
- Callback function that takes the name as its only parameter.
-
unregisterChangeCallback
Description copied from interface:RemoteConfigObjectProvider
Unregisters a callback previously registered.- Specified by:
unregisterChangeCallback
in interfaceRemoteConfigObjectProvider
- Parameters:
name
- Name of the configuration object you're interested in.
-
loadConfigObject
public ConfigObjectWrapper loadConfigObject(String name, ConfigObject[] supportedConfigObjects) throws IOException Description copied from interface:ConfigObjectProvider
Loads a configuration Object from the config data store and retrieves its metadata. This function requires an array of config objects to use as a means of discovering what Object type is encoded in the store.- Specified by:
loadConfigObject
in interfaceConfigObjectProvider
- Parameters:
name
- The name of configuration store, which will normally be the connector name.supportedConfigObjects
- An array of ConfigObject instances that represent the possible Object types that can be successfully retrieved from the store. If the persisted Object type does not match anything in the list, then the first item in the array is passed back (being effectively a means to have a 'default' config).- Returns:
- The configuration Object, which must be cast to a ConfigObject-derived class wrapped into a
ConfigObjectWrapper
together with its metadata. - Throws:
IOException
- Thrown if JSON file could not be successfully deserialized.
-
saveConfigObject
Description copied from interface:ConfigObjectProvider
Saves a configuration Object to the config data store. The config object's type will be encoded in 'Version' field in the data store.- Specified by:
saveConfigObject
in interfaceConfigObjectProvider
- Parameters:
name
- The name of configuration store, which will normally be the connector name.configObject
- The configuration Object to serialize to the store.
-
onConfigChanged
- Specified by:
onConfigChanged
in interfaceRemoteConfigChangeListener
-
toEpochTime
-