Interface CockpitConfigurationService

  • All Known Implementing Classes:
    DefaultCockpitConfigurationService, ModuleAwareCockpitConfigurationService

    public interface CockpitConfigurationService
    This 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 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 configuration
        configurationType - 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 configuration
        configType - desired configuration type
        widgetInstance - 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 configuration
        configuration - 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:
        SchemaValidationStatus status 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 serialization
        marshaller - 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 string
        unmarshaller - 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.