Package com.seeq.link.sdk.services
Class DefaultConfigService
java.lang.Object
com.seeq.link.sdk.services.DefaultConfigService
- All Implemented Interfaces:
ConfigService
See
ConfigService
for documentation.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetGlobalArgument
(String argumentName) Deprecated.void
initialize
(FileConfigObjectProvider fileConfigObjectProvider, RemoteConfigObjectProvider remoteConfigObjectProvider) Initializes the service with itsFileConfigObjectProvider
(used to retrieve configuration from disk) and itsRemoteConfigObjectProvider
(used to retrieve the remote configuration).loadConfigObject
(String name, ConfigObject[] defaultConfigObjects) Loads a configuration Object from the config data store.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.void
Unregisters a callback previously registered.
-
Constructor Details
-
DefaultConfigService
public DefaultConfigService()
-
-
Method Details
-
initialize
public void initialize(FileConfigObjectProvider fileConfigObjectProvider, RemoteConfigObjectProvider remoteConfigObjectProvider) Description copied from interface:ConfigService
Initializes the service with itsFileConfigObjectProvider
(used to retrieve configuration from disk) and itsRemoteConfigObjectProvider
(used to retrieve the remote configuration).- Specified by:
initialize
in interfaceConfigService
- Parameters:
fileConfigObjectProvider
- Interface used to retrieve configuration from disk.remoteConfigObjectProvider
- Interface used to retrieve remote configuration.
-
getGlobalArgument
Deprecated.Deprecated: All configuration should now come from configuration files.- Specified by:
getGlobalArgument
in interfaceConfigService
- Parameters:
argumentName
- Name of the command line argument to retrieve.- Returns:
- Value of the command line argument.
-
loadConfigObject
public ConfigObject loadConfigObject(String name, ConfigObject[] defaultConfigObjects) throws IOException Description copied from interface:ConfigService
Loads a configuration Object from the config data store. 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 interfaceConfigService
- Parameters:
name
- The name of configuration store, which will normally be the connector name.defaultConfigObjects
- 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.
- Throws:
IOException
- Thrown if JSON file could not be successfully deserialized.
-
saveConfigObject
Description copied from interface:ConfigService
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 interfaceConfigService
- Parameters:
name
- The name of configuration store, which will normally be the connector name.configObject
- The configuration Object to serialize to the store.
-
registerChangeCallback
Description copied from interface:ConfigService
Registers a callback for when the configuration has changed.- Specified by:
registerChangeCallback
in interfaceConfigService
- 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:ConfigService
Unregisters a callback previously registered.- Specified by:
unregisterChangeCallback
in interfaceConfigService
- Parameters:
name
- Name of the configuration object you're interested in.
-