Package io.openems.edge.core.appmanager
Class AbstractOpenemsAppWithProps<APP extends AbstractOpenemsAppWithProps<APP,PROPERTY,PARAMETER>,PROPERTY extends Type<PROPERTY,APP,PARAMETER> & Nameable,PARAMETER extends Type.Parameter>
java.lang.Object
io.openems.edge.core.appmanager.AbstractOpenemsApp<PROPERTY>
io.openems.edge.core.appmanager.AbstractOpenemsAppWithProps<APP,PROPERTY,PARAMETER>
- All Implemented Interfaces:
OpenemsApp
- Direct Known Subclasses:
EvcsCluster
,HardyBarthEvcs
,ModbusTcpApiReadOnly
,PrepareBatteryExtension
,RestJsonApiReadOnly
,SmaPvInverter
,Tibber
public abstract class AbstractOpenemsAppWithProps<APP extends AbstractOpenemsAppWithProps<APP,PROPERTY,PARAMETER>,PROPERTY extends Type<PROPERTY,APP,PARAMETER> & Nameable,PARAMETER extends Type.Parameter>
extends AbstractOpenemsApp<PROPERTY>
implements OpenemsApp
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class io.openems.edge.core.appmanager.AbstractOpenemsApp
cm, componentContext, componentManager, componentUtil
Fields inherited from interface io.openems.edge.core.appmanager.OpenemsApp
FALLBACK_IMAGE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractOpenemsAppWithProps
(ComponentManager componentManager, org.osgi.service.component.ComponentContext componentContext, org.osgi.service.cm.ConfigurationAdmin cm, ComponentUtil componentUtil) -
Method Summary
Modifier and TypeMethodDescriptioncom.google.gson.JsonObject
fillUpProperties
(com.google.gson.JsonObject original) Creates a copy of the original configuration and fills up properties which are binded bidirectional.protected abstract APP
getApp()
getAppAssistant
(Language language) Gets theAppAssistant
for thisOpenemsApp
.getAppConfiguration
(ConfigurationTarget target, com.google.gson.JsonObject config, Language language) Gets theAppConfiguration
needed for theOpenemsApp
.protected boolean
getBoolean
(Map<PROPERTY, com.google.gson.JsonElement> map, PROPERTY property) protected boolean
getBoolean
(Map<PROPERTY, com.google.gson.JsonElement> map, PROPERTY property, Function<PROPERTY, AppDef<? super APP, ? super PROPERTY, ? super PARAMETER>> mapper) protected <E extends Enum<E>>
Eprotected <E extends Enum<E>>
EgetEnum
(Map<PROPERTY, com.google.gson.JsonElement> map, Class<E> enumType, PROPERTY property, Function<PROPERTY, AppDef<? super APP, ? super PROPERTY, ? super PARAMETER>> mapper) protected String
getId
(ConfigurationTarget target, Map<PROPERTY, com.google.gson.JsonElement> map, PROPERTY property) protected int
protected int
getInt
(Map<PROPERTY, com.google.gson.JsonElement> map, PROPERTY property, Function<PROPERTY, AppDef<? super APP, ? super PROPERTY, ? super PARAMETER>> mapper) protected com.google.gson.JsonArray
getJsonArray
(Map<PROPERTY, com.google.gson.JsonElement> map, PROPERTY property) Gets allOpenemsAppPropertyDefinition
of the app.protected String
protected String
getString
(Map<PROPERTY, com.google.gson.JsonElement> map, Language l, PROPERTY property, Function<PROPERTY, AppDef<? super APP, ? super PROPERTY, ? super PARAMETER>> mapper) getValidationErrors
(com.google.gson.JsonObject jProperties, List<Dependency> dependecies) Validate the App configuration.protected com.google.gson.JsonElement
getValueOrDefault
(Map<PROPERTY, com.google.gson.JsonElement> map, Language l, PROPERTY property, Function<PROPERTY, AppDef<? super APP, ? super PROPERTY, ? super PARAMETER>> mapper) Methods inherited from class io.openems.edge.core.appmanager.AbstractOpenemsApp
appPropertyConfigurationFactory, assertCheckables, base64OfImage, getAppId, getAppPermissions, getComponentWithFactoryId, getId, getImage, getName, getPropertyByName, getTranslation, getTranslationBundle, getValidateBuilder, getValidatorConfig, getValueOrDefault, hasProperty, installationValidation, propertyValues, validate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.openems.edge.core.appmanager.OpenemsApp
getAppDescriptor, getAppId, getAppPermissions, getCardinality, getCategories, getImage, getName, getValidatorConfig, validate
-
Constructor Details
-
AbstractOpenemsAppWithProps
protected AbstractOpenemsAppWithProps(ComponentManager componentManager, org.osgi.service.component.ComponentContext componentContext, org.osgi.service.cm.ConfigurationAdmin cm, ComponentUtil componentUtil)
-
-
Method Details
-
getId
protected String getId(ConfigurationTarget target, Map<PROPERTY, com.google.gson.JsonElement> map, PROPERTY property) throws OpenemsException- Throws:
OpenemsException
-
getValueOrDefault
-
getString
-
getString
-
getJsonArray
protected com.google.gson.JsonArray getJsonArray(Map<PROPERTY, com.google.gson.JsonElement> map, PROPERTY property) throws OpenemsError.OpenemsNamedException -
getInt
-
getInt
protected int getInt(Map<PROPERTY, com.google.gson.JsonElement> map, PROPERTY property) throws OpenemsError.OpenemsNamedException -
getEnum
-
getEnum
-
getBoolean
-
getBoolean
protected boolean getBoolean(Map<PROPERTY, com.google.gson.JsonElement> map, PROPERTY property) throws OpenemsError.OpenemsNamedException -
getProperties
Description copied from interface:OpenemsApp
Gets allOpenemsAppPropertyDefinition
of the app.- Specified by:
getProperties
in interfaceOpenemsApp
- Overrides:
getProperties
in classAbstractOpenemsApp<PROPERTY extends Type<PROPERTY,
APP, PARAMETER> & Nameable> - Returns:
- the
OpenemsAppPropertyDefinitions
-
getAppAssistant
Description copied from interface:OpenemsApp
Gets theAppAssistant
for thisOpenemsApp
.- Specified by:
getAppAssistant
in interfaceOpenemsApp
- Parameters:
language
- the language of theAppAssistant
- Returns:
- the AppAssistant
-
getAppConfiguration
public AppConfiguration getAppConfiguration(ConfigurationTarget target, com.google.gson.JsonObject config, Language language) throws OpenemsError.OpenemsNamedException Description copied from interface:OpenemsApp
Gets theAppConfiguration
needed for theOpenemsApp
.- Specified by:
getAppConfiguration
in interfaceOpenemsApp
- Overrides:
getAppConfiguration
in classAbstractOpenemsApp<PROPERTY extends Type<PROPERTY,
APP, PARAMETER> & Nameable> - Parameters:
target
- theConfigurationTarget
config
- the configured app 'properties'language
- the language of the configuration- Returns:
- the app Configuration
- Throws:
OpenemsError.OpenemsNamedException
-
getValidationErrors
protected List<String> getValidationErrors(com.google.gson.JsonObject jProperties, List<Dependency> dependecies) Description copied from class:AbstractOpenemsApp
Validate the App configuration.- Overrides:
getValidationErrors
in classAbstractOpenemsApp<PROPERTY extends Type<PROPERTY,
APP, PARAMETER> & Nameable> - Parameters:
jProperties
- a JsonObject holding the App propertiesdependecies
- the dependencies of the current instance- Returns:
- a list of validation errors. Empty list says 'no errors'
-
fillUpProperties
public com.google.gson.JsonObject fillUpProperties(com.google.gson.JsonObject original) Creates a copy of the original configuration and fills up properties which are binded bidirectional.e. g. a property in a component is the same as one configured in the app so it directly gets stored in the component configuration and not twice to avoid miss matching errors.
- Parameters:
original
- the original configuration- Returns:
- a copy of the original one with the filled up properties
-
getApp
-