Package com.hybris.cockpitng.core.config
Interface CockpitConfigurationService
-
- All Known Implementing Classes:
DefaultCockpitConfigurationService,ModuleAwareCockpitConfigurationService
public interface CockpitConfigurationServiceThis service provides functionality to load and store cockpit related configuration. The configuration is queried by a context object which is a String->String map. Each entry represents single value in a single dimension. For example context like this:{ "component"="editorArea", "type"="Product", "principal"="productmanager" }would find configuration for type "Product", component "editorArea" and principal "productmanager". Dimensions and their values are not limited, you can use any amount of any dimensions to store and load your configuration.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default ConfiggetChangesAsConfig(java.lang.String changes, javax.xml.bind.Unmarshaller unmarshaller)Deserialize xml string as config objectdefault java.lang.StringgetConfigAsString(Config originalConfig, javax.xml.bind.Marshaller marshaller)Serialize config as xml string<C> CloadConfiguration(ConfigContext context, java.lang.Class<C> configurationType)Loads a single piece of cockpit configuration according to context provided.default <C> CloadConfiguration(ConfigContext context, java.lang.Class<C> configType, WidgetInstance widgetInstance)Loads a single piece of cockpit configuration according to context provided for specific widgetInstancedefault voidresetToDefaults()Clears stored configuration and sets it to defaults.<C> voidstoreConfiguration(ConfigContext context, C configuration)Stores a single piece of cockpit configuration according to context provided.default SchemaValidationStatusvalidate(java.io.InputStream contentStream)Responsible for processing a validation for a given content.
-
-
-
Method Detail
-
loadConfiguration
<C> C loadConfiguration(ConfigContext context, java.lang.Class<C> configurationType) throws CockpitConfigurationException
Loads a single piece of cockpit configuration according to context provided.- Parameters:
context- the context to be used to look for the configurationconfigurationType- desired configuration type- Returns:
- single piece of cockpit configuration according to context provided
- Throws:
CockpitConfigurationException- if configuration could not be found or some error occured during loading
-
loadConfiguration
default <C> C loadConfiguration(ConfigContext context, java.lang.Class<C> configType, WidgetInstance widgetInstance) throws CockpitConfigurationException
Loads a single piece of cockpit configuration according to context provided for specific widgetInstance- Parameters:
context- the context to be used to look for the configurationconfigType- desired configuration typewidgetInstance- given widget instance- Returns:
- single piece of cockpit configuration according to context provided
- Throws:
CockpitConfigurationException- if configuration could not be found or some error occured during loading
-
storeConfiguration
<C> void storeConfiguration(ConfigContext context, C configuration) throws CockpitConfigurationException
Stores a single piece of cockpit configuration according to context provided.- Parameters:
context- the context to be used to store the configurationconfiguration- the configuration to be stored- Throws:
CockpitConfigurationException- if configuration could not be stored for some reason
-
resetToDefaults
default void resetToDefaults()
Clears stored configuration and sets it to defaults.
-
validate
default SchemaValidationStatus validate(java.io.InputStream contentStream)
Responsible for processing a validation for a given content.- Parameters:
contentStream- represents a xml content that needs to be validated- Returns:
SchemaValidationStatusstatus of the validation
-
getConfigAsString
default java.lang.String getConfigAsString(Config originalConfig, javax.xml.bind.Marshaller marshaller) throws javax.xml.bind.JAXBException
Serialize config as xml string- Parameters:
originalConfig- subject for serializationmarshaller- marshaller to be used during serialization- Returns:
- xml representation of config
- Throws:
javax.xml.bind.JAXBException- If any unexpected problem occurs during the marshalling.
-
getChangesAsConfig
default Config getChangesAsConfig(java.lang.String changes, javax.xml.bind.Unmarshaller unmarshaller) throws javax.xml.bind.JAXBException
Deserialize xml string as config object- Parameters:
changes- xml stringunmarshaller- unmarshaller to be used during deserialization- Returns:
- config object
- Throws:
javax.xml.bind.JAXBException- If any unexpected errors occur while unmarshalling.java.lang.IllegalArgumentException- If the passed string is null.
-
-