Class SimpleNodeSettingsService
- All Implemented Interfaces:
InstructionHandler,net.solarnetwork.service.Identifiable
This InstructionHandler responds to
TOPIC_SYSTEM_CONFIGURATION requests where the
PARAM_SERVICE value is
SETTINGS_SERVICE_UID. At a minimum a PARAM_SETTING_UID
value must also be provided, and optionally the PARAM_INSTANCE_ID
value can be provided. Those two parameters determine the results returned,
as outlined below. The result is always a JSON string on the
PARAM_SERVICE_RESULT result
parameter.
| uid | id | Operation |
|---|---|---|
| * | List providers | |
| {settingUid} | List settings | |
| * | * | List factories |
| {factoryUid} | * | List factory instances |
| {factoryUid} | {instanceId} | List factory instance settings |
List all available non-factory setting UIDs
Pass a uid parameter value of * to generate a JSON array
of objects, each representing a single provider, with the following
properties:
- id
- The provider ID (
settingUid). - title
- The component title.
List the settings for a non-factory provider
Pass a uid parameter value of the specific setting UID you'd like to
get the settings for. The result will be a JSON array of objects, each
representing a single setting, with the following properties:
- key
- The setting key.
- value
- The setting value.
- default
- A boolean, true indicating that the
valueis a "default" value provided by SolarNode, not one a user has specifically configured. This property might be omitted entirely instead of appearing with a false value.
List all available factory setting UIDs
Pass a uid parameter value of * and a id
parameter value of * to generate a JSON array of objects, each
representing a single factory, as shown in the list
providers section.
List the available instance IDs for a factory
To generate a JSON array of instance IDs for a specific factory UID, pass a
uid parameter value of the factory UID you'd like the list for, and a
id parameter value of *.
List the settings for a factory instance provider
Pass a uid parameter value of the specific factory UID and a
id parameter value of the specific factory instance ID you'd like to
list the settings for. The result will be a JSON array of objects, as shown
in the list settings section.
Specification mode
By passing a spec parameter value of true, then instead of
returning component setting values, setting specification objects will be
returned instead. At a minimum, each specification object has a type
property that is the setting type. Other specifications provide more
properties, as listed below.
Group specification
A group specification has the type
net.solarnetwork.settings.GroupSettingSpecifier. It will include a
dynamic boolean property, where true represents a dynamic
list of specifications. The groupSettings property will be an array
of nested specification objects that make up the group.
Other specifications
Most specifications provide a key property representing the setting
key for that specification.
- Since:
- 3.3
- Version:
- 1.0
- Author:
- matt
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringA specialPARAM_SETTING_UIDorPARAM_INSTANCE_IDvalue that signals to return the list of available IDs.static final StringAn optional instruction parameter containing a boolean flag that, when true, means the result JSON should be gzip-compressed and encoded into a Base64 string representation.static final StringAn optional instruction parameter containing a specific setting factory instance ID to get the settings for.static final StringAn optional instruction parameter containing a specific setting UID (or factory UID) to get the settings for.static final StringAn optional instruction parameter containing a boolean flag that, when true, means setting specifications should be returned instead of setting values.static final StringA redacted setting value.static final StringThe default UID for this service.Fields inherited from class net.solarnetwork.node.service.support.BaseIdentifiable
logFields inherited from interface net.solarnetwork.service.Identifiable
GROUP_UID_PROPERTY, UID_PROPERTYFields inherited from interface net.solarnetwork.node.reactor.InstructionHandler
PARAM_ID, PARAM_MESSAGE, PARAM_SERVICE, PARAM_SERVICE_ARGUMENT, PARAM_SERVICE_RESULT, PARAM_STATUS_CODE, TOPIC_CANCEL_INSTRUCTION, TOPIC_DEMAND_BALANCE, TOPIC_SET_CONTROL_PARAMETER, TOPIC_SET_OPERATING_STATE, TOPIC_SHED_LOAD, TOPIC_SIGNAL, TOPIC_SYSTEM_CONFIGURATION, TOPIC_SYSTEM_CONFIGURE -
Constructor Summary
ConstructorsConstructorDescriptionSimpleNodeSettingsService(net.solarnetwork.service.OptionalService<SettingsService> settingsService) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanhandlesTopic(String topic) Test if a topic is handled by this handler.processInstruction(Instruction instruction) Process an instruction.Methods inherited from class net.solarnetwork.node.service.support.BaseIdentifiable
baseIdentifiableSettings, baseIdentifiableSettings, getExpressionServices, getPlaceholderService, populateExpressionDatumProperties, resolvePlaceholders, resolvePlaceholders, setExpressionServices, setPlaceholderServiceMethods inherited from class net.solarnetwork.service.support.BasicIdentifiable
basicIdentifiableMetadataSettings, basicIdentifiableSettings, basicIdentifiableSettings, basicIdentifiableSettings, doubleMetadataValue, getDisplayName, getGroupUid, getGroupUID, getMessageSource, getMetadata, getMetadataCount, getUid, getUID, integerMetadataValue, metadataValue, numberMetadataValue, saveMetadataValue, saveMetadataValue, setDisplayName, setGroupUid, setGroupUID, setMessageSource, setMetadata, setMetadataCount, setUid, setUID, smartMetadataValueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.solarnetwork.service.Identifiable
getDisplayName, getGroupUid, getUid
-
Field Details
-
SETTINGS_SERVICE_UID
The default UID for this service.- See Also:
-
PARAM_SETTING_UID
An optional instruction parameter containing a specific setting UID (or factory UID) to get the settings for.- See Also:
-
PARAM_INSTANCE_ID
An optional instruction parameter containing a specific setting factory instance ID to get the settings for.If this is provided, then the
PARAM_SETTING_UIDparameter must also be provided, and that will be interpreted as the factory UID.- See Also:
-
PARAM_SPECIFICATION
An optional instruction parameter containing a boolean flag that, when true, means setting specifications should be returned instead of setting values.- See Also:
-
PARAM_COMPRESSED
An optional instruction parameter containing a boolean flag that, when true, means the result JSON should be gzip-compressed and encoded into a Base64 string representation.Note that only successful results will be compressed. If the compressed result is larger than the uncompressed JSON, the uncompressed JSON will be returned instead.
- See Also:
-
ID_LIST
A specialPARAM_SETTING_UIDorPARAM_INSTANCE_IDvalue that signals to return the list of available IDs.- See Also:
-
REDACTED_VALUE
A redacted setting value.- See Also:
-
-
Constructor Details
-
SimpleNodeSettingsService
public SimpleNodeSettingsService(net.solarnetwork.service.OptionalService<SettingsService> settingsService) Constructor.- Parameters:
settingsService- the settings service- Throws:
IllegalArgumentException- if any argument is null
-
-
Method Details
-
handlesTopic
Description copied from interface:InstructionHandlerTest if a topic is handled by this handler.- Specified by:
handlesTopicin interfaceInstructionHandler- Parameters:
topic- the topic- Returns:
- true only if this handler can execute the job for the given topic
-
processInstruction
Description copied from interface:InstructionHandlerProcess an instruction.- Specified by:
processInstructionin interfaceInstructionHandler- Parameters:
instruction- the instruction to process- Returns:
- the status for the instruction, or null if the instruction was not handled
-