Class ConfigurationApi


  • public class ConfigurationApi
    extends AttributeableEntity
    A configuration api describes the set of supported OSGi configurations and framework properties. This object can be stored as an extension inside a feature model. This class is not thread safe.
    • Constructor Detail

      • ConfigurationApi

        public ConfigurationApi()
    • Method Detail

      • getConfigurationApi

        public static ConfigurationApi getConfigurationApi​(org.apache.sling.feature.Feature feature)
        Get the configuration api from the feature - if it exists. If the configuration api is updated, the containing feature is left untouched. setConfigurationApi(Feature, ConfigurationApi) can be used to update the feature.
        Parameters:
        feature - The feature
        Returns:
        The configuration api or null.
        Throws:
        IllegalArgumentException - If the extension is wrongly formatted
      • getConfigurationApi

        public static ConfigurationApi getConfigurationApi​(org.apache.sling.feature.Extension ext)
        Get the configuration api from the extension. If the configuration api is updated, the containing extension is left untouched.
        Parameters:
        ext - The extension
        Returns:
        The configuration api or null if the extension is null.
        Throws:
        IllegalArgumentException - If the extension is wrongly formatted
      • setConfigurationApi

        public static void setConfigurationApi​(org.apache.sling.feature.Feature feature,
                                               ConfigurationApi api)
        Set the configuration api as an extension to the feature
        Parameters:
        feature - The feature
        api - The configuration api
        Throws:
        IllegalStateException - If the feature has already an extension of a wrong type
        IllegalArgumentException - If the api configuration can't be serialized to JSON
      • fromJSONObject

        public void fromJSONObject​(javax.json.JsonObject jsonObj)
                            throws IOException
        Extract the metadata from the JSON object. This method first calls clear().
        Overrides:
        fromJSONObject in class AttributeableEntity
        Parameters:
        jsonObj - The JSON Object
        Throws:
        IOException - If JSON parsing fails
      • getConfigurationDescriptions

        public Map<String,​ConfigurationDescription> getConfigurationDescriptions()
        Get the configuration descriptions
        Returns:
        Mutable map of configuration descriptions by pid
      • getFactoryConfigurationDescriptions

        public Map<String,​FactoryConfigurationDescription> getFactoryConfigurationDescriptions()
        Get the factory configuration descriptions
        Returns:
        Mutable map of factory descriptions by factory pid
      • getFrameworkPropertyDescriptions

        public Map<String,​FrameworkPropertyDescription> getFrameworkPropertyDescriptions()
        Get the framework properties
        Returns:
        Mutable map of framework properties
      • getInternalConfigurations

        public Set<String> getInternalConfigurations()
        Get the internal configuration pids
        Returns:
        Mutable set of internal configuration pids
      • getInternalFactoryConfigurations

        public Set<String> getInternalFactoryConfigurations()
        Get the internal factory pids
        Returns:
        Mutable set of internal factory configuration pids
      • getInternalFrameworkProperties

        public Set<String> getInternalFrameworkProperties()
        Get the internal framework property names
        Returns:
        Mutable set of internal framework property names
      • getRegion

        public Region getRegion()
        Get the api configuration region
        Returns:
        The region or null
      • setRegion

        public void setRegion​(Region value)
        Set the api configuration region
        Parameters:
        value - The region to set
      • detectRegion

        public Region detectRegion()
        Detect the region, either return the stored region or the default (GLOBAL)
        Returns:
        The region
        Since:
        1.1
      • getFeatureToRegionCache

        public Map<org.apache.sling.feature.ArtifactId,​Region> getFeatureToRegionCache()
        Get the feature to region cache to keep track of regions for origin features
        Returns:
        The cache
        Since:
        1.1.